]> asedeno.scripts.mit.edu Git - git.git/blobdiff - git-clone.sh
Merge branch 'maint'
[git.git] / git-clone.sh
index 4c9b1c9710c0fd55dfdbaf6bec6b77e0dae93562..0ea3c24f59e32055e4d514e55fe3a6f6be095f9c 100755 (executable)
@@ -28,13 +28,18 @@ get_repo_base() {
        ) 2>/dev/null
 }
 
-if [ -n "$GIT_SSL_NO_VERIFY" ]; then
+if [ -n "$GIT_SSL_NO_VERIFY" -o \
+       "`git config --bool http.sslVerify`" = false ]; then
     curl_extra_args="-k"
 fi
 
 http_fetch () {
        # $1 = Remote, $2 = Local
-       curl -nsfL $curl_extra_args "$1" >"$2"
+       curl -nsfL $curl_extra_args "$1" >"$2" ||
+               case $? in
+               126|127) exit ;;
+               *)       return $? ;;
+               esac
 }
 
 clone_dumb_http () {
@@ -99,6 +104,7 @@ origin_override=
 use_separate_remote=t
 depth=
 no_progress=
+local_explicitly_asked_for=
 test -t 1 || no_progress=--no-progress
 while
        case "$#,$1" in
@@ -109,6 +115,7 @@ while
        *,--na|*,--nak|*,--nake|*,--naked|\
        *,-b|*,--b|*,--ba|*,--bar|*,--bare) bare=yes ;;
        *,-l|*,--l|*,--lo|*,--loc|*,--loca|*,--local)
+         local_explicitly_asked_for=yes
          use_local_hardlink=yes ;;
        *,--no-h|*,--no-ha|*,--no-har|*,--no-hard|*,--no-hardl|\
        *,--no-hardli|*,--no-hardlin|*,--no-hardlink|*,--no-hardlinks)
@@ -215,7 +222,12 @@ else
        GIT_DIR="$D/.git"
 fi &&
 export GIT_DIR &&
-git-init $quiet ${template+"$template"} || usage
+GIT_CONFIG="$GIT_DIR/config" git-init $quiet ${template+"$template"} || usage
+
+if test -n "$bare"
+then
+       GIT_CONFIG="$GIT_DIR/config" git config core.bare true
+fi
 
 if test -n "$reference"
 then
@@ -276,7 +288,8 @@ yes)
                        then
                                rm -f "$GIT_DIR/objects/sample"
                                l=l
-                       else
+                       elif test -n "$local_explicitly_asked_for"
+                       then
                                echo >&2 "Warning: -l asked but cannot hardlink to $repo"
                        fi
                fi &&