Skip to contentSkip to conversation

Ensure git-repack -a -d --max-pack-size=N deletes correct packs

PATCH New Dana How 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore

Dana How

author
#0 lore raw

PATCH 1/1 Ensure git-repack -a -d --max-pack-size=N deletes correct packs

The packfile portion of the "remove redundant" code near the bottom of git-repack.sh is broken when pack splitting occurs. Particularly since this is the only place where we automatically delete packfiles, make sure it works properly for all cases, old or new.

This is based on "next".

---
 git-repack.sh |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
git-repack.sh +3 -2
index 4ea6e5b..0591bd7 100755
@@ -69,6 +69,7 @@ if [ -z "$names" ]; then
 	echo Nothing new to pack.
 fi
 for name in $names ; do
+	fullbases="$fullbases pack-$name"
 	chmod a-w "$PACKTMP-$name.pack"
 	chmod a-w "$PACKTMP-$name.idx"
 	if test "$quiet" != '-q'; then
@@ -105,8 +106,8 @@ then
 		( cd "$PACKDIR" &&
 		  for e in $existing
 		  do
-			case "$e" in
-			pack-$name) ;;
+			case " $fullbases " in
+			*\ $e\ *) ;;
 			*)	rm -f "$e.pack" "$e.idx" "$e.keep" ;;
 			esac
 		  done
Signature · 1 line
1.5.2.762.gd8c6-dirty