From 2b86976bfd6e42609692d57fffaef72bd985c23a Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 8 Dec 2005 23:18:41 -0800 Subject: git-prune: never lose objects reachable from our refs. Explicit arguments to git-prune replaces, instead of extends, the list of heads used for reachability analysis by fsck-objects. By giving a subset of heads by mistake, objects reachable only from other heads can be removed, resulting in a corrupted repository. This commit stops replacing the list of heads, and makes the command line arguments to add to them instead for safety. Signed-off-by: Junio C Hamano --- git-prune.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'git-prune.sh') diff --git a/git-prune.sh b/git-prune.sh index 1fd8c731cd..7e7f0ad56d 100755 --- a/git-prune.sh +++ b/git-prune.sh @@ -16,7 +16,11 @@ do done sync -git-fsck-objects --full --cache --unreachable "$@" | +case "$#" in +0) git-fsck-objects --full --cache --unreachable ;; +*) git-fsck-objects --full --cache --unreachable $(git-rev-parse --all) "$@" ;; +esac | + sed -ne '/unreachable /{ s/unreachable [^ ][^ ]* // s|\(..\)|\1/|p -- cgit v1.3-5-g9baa