3 # Copyright (c) 2005 Linus Torvalds
6 . git-sh-setup || die "Not a git archive"
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'
38 pack_objects="$pack_objects --local"
40 name=$(git-rev-list --objects $rev_list $(git-rev-parse $rev_parse) |
41 git-pack-objects --non-empty $pack_objects .tmp-pack) ||
43 if [ -z "$name" ]; then
44 echo Nothing new to pack.
45 if test "$remove_redundant" = t ; then
46 echo "Removing redundant packs."
48 redundant=$(git-pack-redundant --all)
49 if test "$redundant" != "" ; then
50 echo $redundant | xargs rm
55 echo "Pack pack-$name created."
57 mkdir -p "$PACKDIR" || exit
59 mv .tmp-pack-$name.pack "$PACKDIR/pack-$name.pack" &&
60 mv .tmp-pack-$name.idx "$PACKDIR/pack-$name.idx" ||
63 if test "$remove_redundant" = t
66 if test "$all_into_one" = t
69 existing=`find . -type f \( -name '*.pack' -o -name '*.idx' \) -print`
73 ./pack-$name.pack | ./pack-$name.idx) ;;
78 redundant=$(git-pack-redundant --all)
79 if test "$redundant" != "" ; then
80 echo $redundant | xargs rm
85 case "$no_update_info" in
87 *) git-update-server-info ;;