]>
Commit | Line | Data |
---|---|---|
839a7a06 | 1 | #!/bin/sh |
b33e9666 | 2 | |
7ab099d2 | 3 | USAGE='[-n] [--] [<head>...]' |
ae2b0f15 | 4 | . git-sh-setup |
b33e9666 | 5 | |
ae7c0c92 | 6 | dryrun= |
51890a64 | 7 | echo= |
ae7c0c92 JH |
8 | while case "$#" in 0) break ;; esac |
9 | do | |
10 | case "$1" in | |
51890a64 | 11 | -n) dryrun=-n echo=echo ;; |
ae7c0c92 | 12 | --) break ;; |
7ab099d2 | 13 | -*) usage ;; |
ae7c0c92 JH |
14 | *) break ;; |
15 | esac | |
16 | shift; | |
17 | done | |
18 | ||
41f222e8 | 19 | sync |
2b86976b JH |
20 | case "$#" in |
21 | 0) git-fsck-objects --full --cache --unreachable ;; | |
22 | *) git-fsck-objects --full --cache --unreachable $(git-rev-parse --all) "$@" ;; | |
23 | esac | | |
24 | ||
ae7c0c92 JH |
25 | sed -ne '/unreachable /{ |
26 | s/unreachable [^ ][^ ]* // | |
27 | s|\(..\)|\1/|p | |
28 | }' | { | |
8ac069ac | 29 | cd "$GIT_OBJECT_DIRECTORY" || exit |
51890a64 | 30 | xargs $echo rm -f |
9106c097 | 31 | rmdir 2>/dev/null [0-9a-f][0-9a-f] |
ae7c0c92 | 32 | } |
8ac069ac | 33 | |
51890a64 | 34 | git-prune-packed $dryrun |
d7b1a1dd JH |
35 | |
36 | redundant=$(git-pack-redundant --all) | |
37 | if test "" != "$redundant" | |
38 | then | |
c3e24a7d | 39 | if test "" = "$dryrun" |
d7b1a1dd JH |
40 | then |
41 | echo "$redundant" | xargs rm -f | |
42 | else | |
43 | echo rm -f "$redundant" | |
44 | fi | |
45 | fi |