Code

GIT 1.5.3-rc6
[git.git] / git-clone.sh
index 4c9b1c9710c0fd55dfdbaf6bec6b77e0dae93562..18003ab4b39ad0a7848cc20db2f6ad55e1291264 100755 (executable)
@@ -99,6 +99,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 +110,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 +217,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 +283,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 &&