3 # Copyright (c) 2005 Linus Torvalds
8 no_update_info= all_into_one= remove_redundant= local=
9 while case "$#" in 0) break ;; esac
12 -n) no_update_info=t ;;
14 -d) remove_redundant=t ;;
22 PACKDIR="$GIT_OBJECT_DIRECTORY/pack"
24 # There will be more repacking strategies to come...
25 case ",$all_into_one," in
29 pack_objects='--incremental'
36 # Redundancy check in all-into-one case is trivial.
37 existing=`cd "$PACKDIR" && \
38 find . -type f \( -name '*.pack' -o -name '*.idx' \) -print`
42 pack_objects="$pack_objects --local"
44 name=$(git-rev-list --objects $rev_list $(git-rev-parse $rev_parse) 2>&1 |
45 git-pack-objects --non-empty $pack_objects .tmp-pack) ||
47 if [ -z "$name" ]; then
48 echo Nothing new to pack.
51 echo "Pack pack-$name created."
53 mkdir -p "$PACKDIR" || exit
55 mv .tmp-pack-$name.pack "$PACKDIR/pack-$name.pack" &&
56 mv .tmp-pack-$name.idx "$PACKDIR/pack-$name.idx" ||
59 if test "$remove_redundant" = t
61 # We know $existing are all redundant only when
62 # all-into-one is used.
63 if test "$all_into_one" != '' && test "$existing" != ''
70 ./pack-$name.pack | ./pack-$name.idx) ;;
78 case "$no_update_info" in
80 *) git-update-server-info ;;