@matheusbsbs / matheus-bagliano / commits / 62af0b532b
Fork 0

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 <lukass@etek.chalmers.se> Signed-off-by: Junio C Hamano <junkio@cox.net>

Lukas Sandström committed Nov 18, 2005 at 21:36 UTC 62af0b532b5ab94d231205db2db444a638a4ce49
1 file changed +16 -3
git-repack.sh
+16 -3
@@ -63,9 +63,22 @@ exit
63 if test "$remove_redundant" = t
64 then
65 sync
66 - redundant=$(git-pack-redundant --all)
67 - if test "$redundant" != "" ; then
68 - echo $redundant | xargs rm
66 + if test "$all_into_one" = t
67 + then
68 + cd "$PACKDIR"
69 + existing=`find . -type f \( -name '*.pack' -o -name '*.idx' \) -print`
70 + for e in $existing
71 + do
72 + case "$e" in
73 + ./pack-$name.pack | ./pack-$name.idx) ;;
74 + *) rm -f $e ;;
75 + esac
76 + done
77 + else
78 + redundant=$(git-pack-redundant --all)
79 + if test "$redundant" != "" ; then
80 + echo $redundant | xargs rm
81 + fi
82 fi
83 fi
84