X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=git-clone.sh;h=c27a913b1ddf1474df4300dc68bebeeb06f145f1;hb=d317e4384acd5646f2ba44197a531c129b26b57e;hp=18e692a67b1515c57a20c8574ed53836fb53f2bd;hpb=4ae22d96fe9248dac4f26b1fc91154ba5e879799;p=git.git diff --git a/git-clone.sh b/git-clone.sh index 18e692a6..c27a913b 100755 --- a/git-clone.sh +++ b/git-clone.sh @@ -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