summaryrefslogtreecommitdiff
path: root/git-prune-script
diff options
context:
space:
mode:
Diffstat (limited to 'git-prune-script')
-rwxr-xr-xgit-prune-script4
1 files changed, 3 insertions, 1 deletions
diff --git a/git-prune-script b/git-prune-script
index b6e927a..a24ba61 100755
--- a/git-prune-script
+++ b/git-prune-script
@@ -1,2 +1,4 @@
#!/bin/sh
-git-fsck-cache --unreachable $(cat .git/HEAD ) | grep unreachable | cut -d' ' -f3 | sed 's:^\(..\):.git/objects/\1/:' | xargs rm
+REFS=$(cat .git/refs/*/*)
+[ "$REFS" ] || exit 1
+git-fsck-cache --unreachable $REFS | grep unreachable | cut -d' ' -f3 | sed 's:^\(..\):.git/objects/\1/:' | xargs -r rm