3 # Copyright (c) 2005 Linus Torvalds
6 USAGE='[-a] [-d] [-l] [-n]'
9 no_update_info= all_into_one= remove_redundant= local=
10 while case "$#" in 0) break ;; esac
13 -n) no_update_info=t ;;
15 -d) remove_redundant=t ;;
23 PACKDIR="$GIT_OBJECT_DIRECTORY/pack"
25 # There will be more repacking strategies to come...
26 case ",$all_into_one," in
30 pack_objects='--incremental'
37 # Redundancy check in all-into-one case is trivial.
38 existing=`cd "$PACKDIR" && \
39 find . -type f \( -name '*.pack' -o -name '*.idx' \) -print`
43 pack_objects="$pack_objects --local"
45 name=$(git-rev-list --objects $rev_list $(git-rev-parse $rev_parse) 2>&1 |
46 git-pack-objects --non-empty $pack_objects .tmp-pack) ||
48 if [ -z "$name" ]; then
49 echo Nothing new to pack.
52 echo "Pack pack-$name created."
54 mkdir -p "$PACKDIR" || exit
56 mv .tmp-pack-$name.pack "$PACKDIR/pack-$name.pack" &&
57 mv .tmp-pack-$name.idx "$PACKDIR/pack-$name.idx" ||
60 if test "$remove_redundant" = t
62 # We know $existing are all redundant only when
63 # all-into-one is used.
64 if test "$all_into_one" != '' && test "$existing" != ''
71 ./pack-$name.pack | ./pack-$name.idx) ;;
79 case "$no_update_info" in
81 *) git-update-server-info ;;