summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-09-18 06:35:49 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-09-18 06:35:49 (GMT)
commit490e23d22afad5734daa447f1a991eeff3a669bb (patch)
treeebbb45fcf93d3080f6abafb7868eb189aa14849c
parent434d036fe4b8f1b7571eb912957590a483944b26 (diff)
downloadgit-490e23d22afad5734daa447f1a991eeff3a669bb.zip
git-490e23d22afad5734daa447f1a991eeff3a669bb.tar.gz
git-490e23d22afad5734daa447f1a991eeff3a669bb.tar.bz2
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 <junkio@cox.net>
-rwxr-xr-xgit-repack.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/git-repack.sh b/git-repack.sh
index 064c85c..b395d0e 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