From: Junio C Hamano Date: Sun, 18 Sep 2005 06:35:49 +0000 (-0700) Subject: Archive-destroying "git repack -a -d" bug. X-Git-Tag: v0.99.7~9 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=490e23d22afad5734daa447f1a991eeff3a669bb;p=git.git Archive-destroying "git repack -a -d" bug. Using "git repack -a -d" can destroy your git archive if you use it twice in succession, because the new pack can be called the same as the old pack. Found by Linus. Signed-off-by: Junio C Hamano --- diff --git a/git-repack.sh b/git-repack.sh index 064c85cb..b395d0ef 100755 --- a/git-repack.sh +++ b/git-repack.sh @@ -58,7 +58,15 @@ then # all-into-one is used. if test "$all_into_one" != '' && test "$existing" != '' then - ( cd "$PACKDIR" && rm -f $existing ) + ( cd "$PACKDIR" && + for e in $existing + do + case "$e" in + ./pack-$name.pack | ./pack-$name.idx) ;; + *) rm -f $e ;; + esac + done + ) fi fi