Code

[PATCH] read-tree: update documentation for 3-way merge.
[git.git] / git-prune-script
1 #!/bin/sh
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
14 : ${GIT_DIR=.git}
15 : ${GIT_OBJECT_DIRECTORY="${SHA1_FILE_DIRECTORY-"$GIT_DIR/objects"}"}
17 git-fsck-cache --cache --unreachable "$@" |
18 sed -ne '/unreachable /{
19     s/unreachable [^ ][^ ]* //
20     s|\(..\)|\1/|p
21 }' | {
22         cd "$GIT_OBJECT_DIRECTORY" || exit
23         xargs -r $dryrun rm -f
24 }