]>
Commit | Line | Data |
---|---|---|
839a7a06 | 1 | #!/bin/sh |
ae7c0c92 JH |
2 | dryrun= |
3 | while case "$#" in 0) break ;; esac | |
4 | do | |
5 | case "$1" in | |
6 | -n) dryrun=echo ;; | |
7 | --) break ;; | |
8 | -*) echo >&2 "usage: git-prune-script [ -n ] [ heads... ]"; exit 1 ;; | |
9 | *) break ;; | |
10 | esac | |
11 | shift; | |
12 | done | |
13 | ||
8ac069ac JH |
14 | : ${GIT_DIR=.git} |
15 | : ${GIT_OBJECT_DIRECTORY="${SHA1_FILE_DIRECTORY-"$GIT_DIR/objects"}"} | |
16 | ||
ae7c0c92 JH |
17 | git-fsck-cache --cache --unreachable "$@" | |
18 | sed -ne '/unreachable /{ | |
19 | s/unreachable [^ ][^ ]* // | |
20 | s|\(..\)|\1/|p | |
21 | }' | { | |
8ac069ac | 22 | cd "$GIT_OBJECT_DIRECTORY" || exit |
ae7c0c92 JH |
23 | xargs -r $dryrun rm -f |
24 | } | |
8ac069ac | 25 |