Skip to content

Commit 6ed6405

Browse files
author
Junio C Hamano
committed
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>
1 parent a4caa52 commit 6ed6405

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

git-repack.sh

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ case ",$all_into_one," in
3232
rev_list=
3333
rev_parse='--all'
3434
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`
3539
;;
3640
esac
3741
if [ "$local" ]; then
@@ -42,14 +46,6 @@ name=$(git-rev-list --objects $rev_list $(git-rev-parse $rev_parse) |
4246
exit 1
4347
if [ -z "$name" ]; then
4448
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
5349
exit 0
5450
fi
5551
echo "Pack pack-$name created."
@@ -62,23 +58,20 @@ exit
6258

6359
if test "$remove_redundant" = t
6460
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" != ''
6764
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
7269
case "$e" in
7370
./pack-$name.pack | ./pack-$name.idx) ;;
74-
*) rm -f $e ;;
71+
*) rm -f $e ;;
7572
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+
)
8275
fi
8376
fi
8477

0 commit comments

Comments
 (0)