diff options
author | Nanako Shiraishi <nanako3@bluebottle.com> | 2007-06-17 02:26:08 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-06-21 03:33:24 +0400 |
commit | 6762079a96dd18bcaab75f2d05034f7447434161 (patch) | |
tree | b145c14b68a17cf0b963c9acf3722e3e1de87832 | |
parent | 45fd8bd32dd68ce6b14a406d0abbd6f56490131c (diff) |
Cloning from a repo without "current branch"
If the remote repository does not have a "current branch", git-clone
was confused and did not set up the resulting new repository
correctly. It did not reset HEAD from the default 'master', and did
not write the SHA1 to the master branch.
Signed-off-by: Nanako Shiraishi <nanako3@bluebottle.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-x | git-clone.sh | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/git-clone.sh b/git-clone.sh index 3a410624d3..bd44ce1c84 100755 --- a/git-clone.sh +++ b/git-clone.sh @@ -377,6 +377,13 @@ then ) ) + # Upstream URL + git-config remote."$origin".url "$repo" && + + # Set up the mappings to track the remote branches. + git-config remote."$origin".fetch \ + "+refs/heads/*:$remote_top/*" '^$' && + # Write out remote.$origin config, and update our "$head_points_at". case "$head_points_at" in ?*) @@ -384,21 +391,20 @@ then git-symbolic-ref HEAD "refs/heads/$head_points_at" && # Tracking branch for the primary branch at the remote. - origin_track="$remote_top/$head_points_at" && git-update-ref HEAD "$head_sha1" && - # Upstream URL - git-config remote."$origin".url "$repo" && - - # Set up the mappings to track the remote branches. - git-config remote."$origin".fetch \ - "+refs/heads/*:$remote_top/*" '^$' && rm -f "refs/remotes/$origin/HEAD" git-symbolic-ref "refs/remotes/$origin/HEAD" \ "refs/remotes/$origin/$head_points_at" && git-config branch."$head_points_at".remote "$origin" && git-config branch."$head_points_at".merge "refs/heads/$head_points_at" + ;; + '') + # Source had detached HEAD pointing nowhere + git-update-ref --no-deref HEAD "$head_sha1" && + rm -f "refs/remotes/$origin/HEAD" + ;; esac case "$no_checkout" in |