Fix typo in http-push.c
[tgit.git] / git-prune.sh
blob1fd8c731cdd3651e3cd3c527915db7a4c4324be0
1 #!/bin/sh
3 . git-sh-setup
5 dryrun=
6 echo=
7 while case "$#" in 0) break ;; esac
8 do
9 case "$1" in
10 -n) dryrun=-n echo=echo ;;
11 --) break ;;
12 -*) echo >&2 "usage: git-prune [ -n ] [ heads... ]"; exit 1 ;;
13 *) break ;;
14 esac
15 shift;
16 done
18 sync
19 git-fsck-objects --full --cache --unreachable "$@" |
20 sed -ne '/unreachable /{
21 s/unreachable [^ ][^ ]* //
22 s|\(..\)|\1/|p
23 }' | {
24 cd "$GIT_OBJECT_DIRECTORY" || exit
25 xargs $echo rm -f
26 rmdir 2>/dev/null [0-9a-f][0-9a-f]
29 git-prune-packed $dryrun
31 redundant=$(git-pack-redundant --all)
32 if test "" != "$redundant"
33 then
34 if test "" = "$dryrun"
35 then
36 echo "$redundant" | xargs rm -f
37 else
38 echo rm -f "$redundant"