format-patch/commit: Quote single quote in the author name properly.
[alt-git.git] / git-prune.sh
blob7b61d05c4b58c57c833563955e3206f0e4142c39
1 #!/bin/sh
3 USAGE='[-n] [--] [<head>...]'
4 . git-sh-setup
6 dryrun=
7 echo=
8 while case "$#" in 0) break ;; esac
9 do
10 case "$1" in
11 -n) dryrun=-n echo=echo ;;
12 --) break ;;
13 -*) usage ;;
14 *) break ;;
15 esac
16 shift;
17 done
19 sync
20 case "$#" in
21 0) git-fsck-objects --full --cache --unreachable ;;
22 *) git-fsck-objects --full --cache --unreachable $(git-rev-parse --all) "$@" ;;
23 esac |
25 sed -ne '/unreachable /{
26 s/unreachable [^ ][^ ]* //
27 s|\(..\)|\1/|p
28 }' | {
29 cd "$GIT_OBJECT_DIRECTORY" || exit
30 xargs $echo rm -f
31 rmdir 2>/dev/null [0-9a-f][0-9a-f]
34 git-prune-packed $dryrun
36 redundant=$(git-pack-redundant --all)
37 if test "" != "$redundant"
38 then
39 if test "" = "$dryrun"
40 then
41 echo "$redundant" | xargs rm -f
42 else
43 echo rm -f "$redundant"