Remove all old packfiles when doing "git repack -a -d"
PATCH 1/1 Remove all old packfiles when doing "git repack -a -d"
No point in running git-pack-redundant if we already know which packs are redundant.
Signed-off-by Lukas Sandström <[email protected]>
---
This should be correct. I even tested it.
git-repack.sh | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-)
applies-to: 8c987c24bed7f7a30f4e74b12e8acc2cc5eeea93 2f49d2a3a7cf0fc64edfad2febf986252392b667
git-repack.sh +16 -3
@@ -63,9 +63,22 @@ exit if test "$remove_redundant" = t then sync - redundant=$(git-pack-redundant --all) - if test "$redundant" != "" ; then - echo $redundant | xargs rm + if test "$all_into_one" = t + then + cd "$PACKDIR" + existing=`find . -type f \( -name '*.pack' -o -name '*.idx' \) -print` + for e in $existing + do + case "$e" in + ./pack-$name.pack | ./pack-$name.idx) ;; + *) rm -f $e ;; + esac + done + else + redundant=$(git-pack-redundant --all) + if test "$redundant" != "" ; then + echo $redundant | xargs rm + fi fi fi
---
0.99.9.GIT
Quoted 4 lines · Lukas Sandström
No point in running git-pack-redundant if we already know which packs are redundant.
Signed-off-by Lukas Sandström <[email protected]>
This makes sense and makes me feel safer somehow. Thanks.