@matheusbsbs / matheus-bagliano / commits / 6ed64058e1
Fork 0

git-repack: do not do complex redundancy check.

With "-a", redundant pack removal is trivial, and otherwise redundant pack removal is pointless; do not call git-redundant-pack from this script. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Nov 19, 2005 at 12:13 UTC 6ed64058e1241f9939c4abf5d6a9eaed6a2cc795
1 file changed +14 -21
git-repack.sh
+14 -21
@@ -32,6 +32,10 @@ case ",$all_into_one," in
32 rev_list=
33 rev_parse='--all'
34 pack_objects=
35 +
36 + # Redundancy check in all-into-one case is trivial.
37 + existing=`cd "$PACKDIR" && \
38 + find . -type f \( -name '*.pack' -o -name '*.idx' \) -print`
39 ;;
40 esac
41 if [ "$local" ]; then
@@ -42,14 +46,6 @@ name=$(git-rev-list --objects $rev_list $(git-rev-parse $rev_parse) |
46 exit 1
47 if [ -z "$name" ]; then
48 echo Nothing new to pack.
45 - if test "$remove_redundant" = t ; then
46 - echo "Removing redundant packs."
47 - sync
48 - redundant=$(git-pack-redundant --all)
49 - if test "$redundant" != "" ; then
50 - echo $redundant | xargs rm
51 - fi
52 - fi
49 exit 0
50 fi
51 echo "Pack pack-$name created."
@@ -62,23 +58,20 @@ exit
58
59 if test "$remove_redundant" = t
60 then
65 - sync
66 - if test "$all_into_one" = t
61 + # We know $existing are all redundant only when
62 + # all-into-one is used.
63 + if test "$all_into_one" != '' && test "$existing" != ''
64 then
68 - cd "$PACKDIR"
69 - existing=`find . -type f \( -name '*.pack' -o -name '*.idx' \) -print`
70 - for e in $existing
71 - do
65 + sync
66 + ( cd "$PACKDIR" &&
67 + for e in $existing
68 + do
69 case "$e" in
70 ./pack-$name.pack | ./pack-$name.idx) ;;
74 - *) rm -f $e ;;
71 + *) rm -f $e ;;
72 esac
76 - done
77 - else
78 - redundant=$(git-pack-redundant --all)
79 - if test "$redundant" != "" ; then
80 - echo $redundant | xargs rm
81 - fi
73 + done
74 + )
75 fi
76 fi
77