[PATCH] Documentation: Add asciidoc.conf file and gitlink: macro
[git/mjg.git] / git-prune.sh
blob9657dbf2711e40bfe035a22ec211811c88c89e8e
1 #!/bin/sh
3 . git-sh-setup || die "Not a git archive"
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 git-fsck-objects --full --cache --unreachable "$@" |
19 sed -ne '/unreachable /{
20 s/unreachable [^ ][^ ]* //
21 s|\(..\)|\1/|p
22 }' | {
23 cd "$GIT_OBJECT_DIRECTORY" || exit
24 xargs $echo rm -f
27 git-prune-packed $dryrun