@matheusbsbs / matheus-bagliano / commits / 490e23d22a
Fork 0

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>

Junio C Hamano committed Sep 17, 2005 at 23:35 UTC 490e23d22afad5734daa447f1a991eeff3a669bb
1 file changed +9 -1
git-repack.sh
+9 -1
@@ -58,7 +58,15 @@ then
58 # all-into-one is used.
59 if test "$all_into_one" != '' && test "$existing" != ''
60 then
61 - ( cd "$PACKDIR" && rm -f $existing )
61 + ( cd "$PACKDIR" &&
62 + for e in $existing
63 + do
64 + case "$e" in
65 + ./pack-$name.pack | ./pack-$name.idx) ;;
66 + *) rm -f $e ;;
67 + esac
68 + done
69 + )
70 fi
71 fi
72