aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgit-clone.sh15
1 files changed, 11 insertions, 4 deletions
diff --git a/git-clone.sh b/git-clone.sh
index 18e692a67..c27a913b1 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