1#!/bin/sh
23
USAGE='[-n] [--] [<head>...]'
4. git-sh-setup
56
dryrun=
7echo=
8while case "$#" in 0) break ;; esac
9do
10case "$1" in
11-n) dryrun=-n echo=echo ;;
12--) break ;;
13-*) usage ;;
14*) break ;;
15esac
16shift;
17done
1819
sync
20case "$#" in
210) git-fsck-objects --full --cache --unreachable ;;
22*) git-fsck-objects --full --cache --unreachable $(git-rev-parse --all) "$@" ;;
23esac |
2425
sed -ne '/unreachable /{
26s/unreachable [^ ][^ ]* //
27s|\(..\)|\1/|p
28}' | {
29cd "$GIT_OBJECT_DIRECTORY" || exit
30xargs $echo rm -f
31rmdir 2>/dev/null [0-9a-f][0-9a-f]
32}
3334
git-prune-packed $dryrun
3536
redundant=$(git-pack-redundant --all)
37if test "" != "$redundant"
38then
39if test "" = "$dryrun"
40then
41echo "$redundant" | xargs rm -f
42else
43echo rm -f "$redundant"
44fi
45fi