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