#!/bin/sh
+
+. git-sh-setup-script || die "Not a git archive"
+
dryrun=
while case "$#" in 0) break ;; esac
do
shift;
done
-: ${GIT_DIR=.git}
-: ${GIT_OBJECT_DIRECTORY="${SHA1_FILE_DIRECTORY-"$GIT_DIR/objects"}"}
-
-git-fsck-cache --cache --unreachable "$@" |
+git-fsck-cache --full --cache --unreachable "$@" |
sed -ne '/unreachable /{
s/unreachable [^ ][^ ]* //
s|\(..\)|\1/|p
}' | {
cd "$GIT_OBJECT_DIRECTORY" || exit
- xargs -r $dryrun rm -f
+ xargs $dryrun rm -f
}