You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
500 B
28 lines
500 B
20 years ago
|
#!/bin/sh
|
||
20 years ago
|
|
||
19 years ago
|
. git-sh-setup || die "Not a git archive"
|
||
20 years ago
|
|
||
20 years ago
|
dryrun=
|
||
20 years ago
|
echo=
|
||
20 years ago
|
while case "$#" in 0) break ;; esac
|
||
|
do
|
||
|
case "$1" in
|
||
20 years ago
|
-n) dryrun=-n echo=echo ;;
|
||
20 years ago
|
--) break ;;
|
||
19 years ago
|
-*) echo >&2 "usage: git-prune [ -n ] [ heads... ]"; exit 1 ;;
|
||
20 years ago
|
*) break ;;
|
||
|
esac
|
||
|
shift;
|
||
|
done
|
||
|
|
||
19 years ago
|
git-fsck-objects --full --cache --unreachable "$@" |
|
||
20 years ago
|
sed -ne '/unreachable /{
|
||
|
s/unreachable [^ ][^ ]* //
|
||
|
s|\(..\)|\1/|p
|
||
|
}' | {
|
||
20 years ago
|
cd "$GIT_OBJECT_DIRECTORY" || exit
|
||
20 years ago
|
xargs $echo rm -f
|
||
20 years ago
|
}
|
||
20 years ago
|
|
||
20 years ago
|
git-prune-packed $dryrun
|