]> git.ipfire.org Git - thirdparty/git.git/blame - git-prune-script
Add hooks to tools/git-applypatch.
[thirdparty/git.git] / git-prune-script
CommitLineData
839a7a06 1#!/bin/sh
b33e9666
LT
2
3. git-sh-setup-script || die "Not a git archive"
4
ae7c0c92
JH
5dryrun=
6while case "$#" in 0) break ;; esac
7do
8 case "$1" in
9 -n) dryrun=echo ;;
10 --) break ;;
11 -*) echo >&2 "usage: git-prune-script [ -n ] [ heads... ]"; exit 1 ;;
12 *) break ;;
13 esac
14 shift;
15done
16
b0966e10 17git-fsck-cache --full --cache --unreachable "$@" |
ae7c0c92
JH
18sed -ne '/unreachable /{
19 s/unreachable [^ ][^ ]* //
20 s|\(..\)|\1/|p
21}' | {
8ac069ac 22 cd "$GIT_OBJECT_DIRECTORY" || exit
bd6bc56d 23 xargs $dryrun rm -f
ae7c0c92 24}
8ac069ac 25