X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=git-repack.sh;h=430ddc5a706945035149464d0bea8f25acc21d3c;hb=bf3e274873e56d7df25d60800c8d59a309e0d8c6;hp=b395d0ef34758f2e3e3129a5131832e932ab7875;hpb=8ac93bc98f5e868e890e1a740df9f0c6513189c8;p=git.git diff --git a/git-repack.sh b/git-repack.sh index b395d0ef..430ddc5a 100755 --- a/git-repack.sh +++ b/git-repack.sh @@ -3,15 +3,16 @@ # Copyright (c) 2005 Linus Torvalds # -. git-sh-setup || die "Not a git archive" +. git-sh-setup -no_update_info= all_into_one= remove_redundant= +no_update_info= all_into_one= remove_redundant= local= while case "$#" in 0) break ;; esac do case "$1" in -n) no_update_info=t ;; -a) all_into_one=t ;; - -d) remove_redandant=t ;; + -d) remove_redundant=t ;; + -l) local=t ;; *) break ;; esac shift @@ -31,13 +32,16 @@ case ",$all_into_one," in rev_list= rev_parse='--all' pack_objects= - # This part is a stop-gap until we have proper pack redundancy - # checker. + + # Redundancy check in all-into-one case is trivial. existing=`cd "$PACKDIR" && \ find . -type f \( -name '*.pack' -o -name '*.idx' \) -print` ;; esac -name=$(git-rev-list --objects $rev_list $(git-rev-parse $rev_parse) | +if [ "$local" ]; then + pack_objects="$pack_objects --local" +fi +name=$(git-rev-list --objects $rev_list $(git-rev-parse $rev_parse) 2>&1 | git-pack-objects --non-empty $pack_objects .tmp-pack) || exit 1 if [ -z "$name" ]; then @@ -52,12 +56,13 @@ mv .tmp-pack-$name.pack "$PACKDIR/pack-$name.pack" && mv .tmp-pack-$name.idx "$PACKDIR/pack-$name.idx" || exit -if test "$remove_redandant" = t +if test "$remove_redundant" = t then - # We know $existing are all redandant only when + # We know $existing are all redundant only when # all-into-one is used. if test "$all_into_one" != '' && test "$existing" != '' then + sync ( cd "$PACKDIR" && for e in $existing do