GIT 0.99.9c
[gitweb.git] / git-clone.sh
index 78c83e84c26ff6b75f08609ecc3b5cb2cac7c09b..c27a913b1ddf1474df4300dc68bebeeb06f145f1 100755 (executable)
@@ -54,9 +54,9 @@ Perhaps git-update-server-info needs to be run there?"
        do
                name=`expr "$refname" : 'refs/\(.*\)'` &&
                case "$name" in
-               *^{}) ;;
+               *^*)    ;;
                *)
-                       git-http-fetch -v -a -w "$name" "$name" "$1/" || exit 1 ;;
+                       git-http-fetch -v -a -w "$name" "$name" "$1/" || exit 1
                esac
        done <"$clone_tmp/refs"
        rm -fr "$clone_tmp"
@@ -196,10 +196,17 @@ cd $D || exit
 
 if test -f ".git/HEAD"
 then
-       mkdir -p .git/remotes || exit
-       echo >.git/remotes/origin \
-       "URL: $repo
-Pull: master:origin"
+       head_points_at=`git-symbolic-ref HEAD`
+       case "$head_points_at" in
+       refs/heads/*)
+               head_points_at=`expr "$head_points_at" : 'refs/heads/\(.*\)'`
+               mkdir -p .git/remotes &&
+               echo >.git/remotes/origin \
+               "URL: $repo
+Pull: $head_points_at:origin"
+               cp ".git/refs/heads/$head_points_at" .git/refs/heads/origin
+       esac
+
        case "$no_checkout" in
        '')
                git checkout