git-unpack-objects: start parsing the actual packed data
[git/git.git] / git-prune-script
CommitLineData
839a7a06 1#!/bin/sh
ae7c0c92
JH
2dryrun=
3while case "$#" in 0) break ;; esac
4do
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;
12done
13
8ac069ac
JH
14: ${GIT_DIR=.git}
15: ${GIT_OBJECT_DIRECTORY="${SHA1_FILE_DIRECTORY-"$GIT_DIR/objects"}"}
16
ae7c0c92
JH
17git-fsck-cache --cache --unreachable "$@" |
18sed -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