Deb Packaging fixes: Build against Mozilla libs for Debian, conflict with "git"
[git.git] / git-prune-script
blob2c678f26a4ec8c9a319944b76c427b30450bf861
1 #!/bin/sh
3 . git-sh-setup-script || die "Not a git archive"
5 dryrun=
6 while case "$#" in 0) break ;; esac
7 do
8 case "$1" in
9 -n) dryrun=echo ;;
10 --) break ;;
11 -*) echo >&2 "usage: git-prune-script [ -n ] [ heads... ]"; exit 1 ;;
12 *) break ;;
13 esac
14 shift;
15 done
17 git-fsck-cache --full --cache --unreachable "$@" |
18 sed -ne '/unreachable /{
19 s/unreachable [^ ][^ ]* //
20 s|\(..\)|\1/|p
21 }' | {
22 cd "$GIT_OBJECT_DIRECTORY" || exit
23 xargs -r $dryrun rm -f