Make git-repack use git-pack-intersect.
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se> Signed-off-by: Junio C Hamano <junkio@cox.net>
Lukas_Sandström committed
Nov 9, 2005 at 02:25 UTC
b4ad3552de8b3231b55f5ee32ee2178202708118
1 file changed
+12
-18
git-repack.sh
+12
-18
@@ -32,10 +32,6 @@ case ",$all_into_one," in
32
rev_list=
33
rev_parse='--all'
34
pack_objects=
35
- # This part is a stop-gap until we have proper pack redundancy
36
- # checker.
37
- existing=`cd "$PACKDIR" && \
38
- find . -type f \( -name '*.pack' -o -name '*.idx' \) -print`
35
;;
36
esac
37
if [ "$local" ]; then
@@ -46,6 +42,14 @@ name=$(git-rev-list --objects $rev_list $(git-rev-parse $rev_parse) |
42
exit 1
43
if [ -z "$name" ]; then
44
echo Nothing new to pack.
45
+ if test "$remove_redandant" = t ; then
46
+ echo "Removing redundant packs."
47
+ sync
48
+ redundant=$(git-pack-intersect -a)
49
+ if test "$redundant" != "" ; then
50
+ echo $redundant | xargs rm
51
+ fi
52
+ fi
53
exit 0
54
fi
55
echo "Pack pack-$name created."
@@ -58,20 +62,10 @@ exit
62
63
if test "$remove_redandant" = t
64
then
61
- # We know $existing are all redandant only when
62
- # all-into-one is used.
63
- if test "$all_into_one" != '' && test "$existing" != ''
64
- then
65
- sync
66
- ( cd "$PACKDIR" &&
67
- for e in $existing
68
- do
69
- case "$e" in
70
- ./pack-$name.pack | ./pack-$name.idx) ;;
71
- *) rm -f $e ;;
72
- esac
73
- done
74
- )
65
+ sync
66
+ redundant=$(git-pack-intersect -a)
67
+ if test "$redundant" != "" ; then
68
+ echo $redundant | xargs rm
69
fi
70
fi
71