Code

Merge branch 'maint'
[git.git] / git-repack.sh
index 8c32724be75b77f145106f96257afccb56cfc1ef..7220635c96a75a17634297b33bac8322647b8270 100755 (executable)
@@ -3,23 +3,26 @@
 # Copyright (c) 2005 Linus Torvalds
 #
 
-USAGE='[-a] [-d] [-f] [-l] [-n] [-q] [--max-pack-size=N] [--window=N] [--depth=N]'
+USAGE='[-a|-A] [-d] [-f] [-l] [-n] [-q] [--max-pack-size=N] [--window=N] [--window-memory=N] [--depth=N]'
 SUBDIRECTORY_OK='Yes'
 . git-sh-setup
 
-no_update_info= all_into_one= remove_redundant=
+no_update_info= all_into_one= remove_redundant= keep_unreachable=
 local= quiet= no_reuse= extra=
-while case "$#" in 0) break ;; esac
+while test $# != 0
 do
        case "$1" in
        -n)     no_update_info=t ;;
        -a)     all_into_one=t ;;
+       -A)     all_into_one=t
+               keep_unreachable=--keep-unreachable ;;
        -d)     remove_redundant=t ;;
        -q)     quiet=-q ;;
        -f)     no_reuse=--no-reuse-object ;;
        -l)     local=--local ;;
        --max-pack-size=*) extra="$extra $1" ;;
        --window=*) extra="$extra $1" ;;
+       --window-memory=*) extra="$extra $1" ;;
        --depth=*) extra="$extra $1" ;;
        *)      usage ;;
        esac
@@ -58,23 +61,28 @@ case ",$all_into_one," in
                        fi
                done
        fi
-       [ -z "$args" ] && args='--unpacked --incremental'
+       if test -z "$args"
+       then
+               args='--unpacked --incremental'
+       elif test -n "$keep_unreachable"
+       then
+               args="$args $keep_unreachable"
+       fi
        ;;
 esac
 
 args="$args $local $quiet $no_reuse$extra"
-names=$(git-pack-objects --non-empty --all --reflog $args </dev/null "$PACKTMP") ||
+names=$(git pack-objects --non-empty --all --reflog $args </dev/null "$PACKTMP") ||
        exit 1
 if [ -z "$names" ]; then
-       echo Nothing new to pack.
+       if test -z "$quiet"; then
+               echo Nothing new to pack.
+       fi
 fi
 for name in $names ; do
        fullbases="$fullbases pack-$name"
        chmod a-w "$PACKTMP-$name.pack"
        chmod a-w "$PACKTMP-$name.idx"
-       if test "$quiet" != '-q'; then
-           echo "Pack pack-$name created."
-       fi
        mkdir -p "$PACKDIR" || exit
 
        for sfx in pack idx
@@ -113,7 +121,7 @@ then
                  done
                )
        fi
-       git-prune-packed $quiet
+       git prune-packed $quiet
 fi
 
 case "$no_update_info" in