3 # Copyright (c) 2005 Linus Torvalds
6 USAGE='[-a] [-d] [-f] [-l] [-n] [-q]'
9 no_update_info= all_into_one= remove_redundant=
10 local= quiet= no_reuse_delta=
11 while case "$#" in 0) break ;; esac
14 -n) no_update_info=t ;;
16 -d) remove_redundant=t ;;
18 -f) no_reuse_delta=--no-reuse-delta ;;
26 PACKDIR="$GIT_OBJECT_DIRECTORY/pack"
28 # There will be more repacking strategies to come...
29 case ",$all_into_one," in
32 pack_objects='--incremental'
38 # Redundancy check in all-into-one case is trivial.
39 existing=`cd "$PACKDIR" && \
40 find . -type f \( -name '*.pack' -o -name '*.idx' \) -print`
43 pack_objects="$pack_objects $local $quiet $no_reuse_delta"
44 name=$(git-rev-list --objects --all $rev_list 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) ;;
79 case "$no_update_info" in
81 *) git-update-server-info ;;