2005-04-18 23:15:10 +04:00
|
|
|
#!/bin/sh
|
2005-07-08 21:57:21 +04:00
|
|
|
|
|
|
|
. git-sh-setup-script || die "Not a git archive"
|
|
|
|
|
2005-05-04 12:33:33 +04:00
|
|
|
dryrun=
|
|
|
|
while case "$#" in 0) break ;; esac
|
|
|
|
do
|
|
|
|
case "$1" in
|
|
|
|
-n) dryrun=echo ;;
|
|
|
|
--) break ;;
|
|
|
|
-*) echo >&2 "usage: git-prune-script [ -n ] [ heads... ]"; exit 1 ;;
|
|
|
|
*) break ;;
|
|
|
|
esac
|
|
|
|
shift;
|
|
|
|
done
|
|
|
|
|
|
|
|
git-fsck-cache --cache --unreachable "$@" |
|
|
|
|
sed -ne '/unreachable /{
|
|
|
|
s/unreachable [^ ][^ ]* //
|
|
|
|
s|\(..\)|\1/|p
|
|
|
|
}' | {
|
2005-05-10 09:57:58 +04:00
|
|
|
cd "$GIT_OBJECT_DIRECTORY" || exit
|
2005-05-04 12:33:33 +04:00
|
|
|
xargs -r $dryrun rm -f
|
|
|
|
}
|
2005-05-10 09:57:58 +04:00
|
|
|
|