Allow fetch-pack to decide keeping the fetched pack without exploding
[gitweb.git] / git-clone.sh
index 3d388de62a9ee212c8f54f3a5dc9a8b823bc8934..ced7dfba3e205214e9e88d25d58017649e7ffe07 100755 (executable)
@@ -163,7 +163,9 @@ while
        1,-u|1,--upload-pack) usage ;;
        *,-u|*,--upload-pack)
                shift
-               upload_pack="--exec=$1" ;;
+               upload_pack="--upload-pack=$1" ;;
+       *,--upload-pack=*)
+               upload_pack=--upload-pack=$(expr "$1" : '-[^=]*=\(.*\)') ;;
        1,--depth) usage;;
        *,--depth)
                shift
@@ -214,7 +216,7 @@ yes)
        GIT_DIR="$D" ;;
 *)
        GIT_DIR="$D/.git" ;;
-esac && export GIT_DIR && git-init-db ${template+"$template"} || usage
+esac && export GIT_DIR && git-init ${template+"$template"} || usage
 
 if test -n "$reference"
 then
@@ -355,7 +357,7 @@ then
        # The name under $remote_top the remote HEAD seems to point at.
        head_points_at=$(
                (
-                       echo "master"
+                       test -f "$GIT_DIR/$remote_top/master" && echo "master"
                        cd "$GIT_DIR/$remote_top" &&
                        find . -type f -print | sed -e 's/^\.\///'
                ) | (