@matheusbsbs / matheus-bagliano / commits / 6762079a96
Fork 0

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>

Nanako Shiraishi committed Jun 16, 2007 at 15:26 UTC 6762079a96dd18bcaab75f2d05034f7447434161
1 file changed +13 -7
git-clone.sh
+13 -7
@@ -377,6 +377,13 @@ then
377 )
378 )
379
380 + # Upstream URL
381 + git-config remote."$origin".url "$repo" &&
382 +
383 + # Set up the mappings to track the remote branches.
384 + git-config remote."$origin".fetch \
385 + "+refs/heads/*:$remote_top/*" '^$' &&
386 +
387 # Write out remote.$origin config, and update our "$head_points_at".
388 case "$head_points_at" in
389 ?*)
@@ -384,21 +391,20 @@ then
391 git-symbolic-ref HEAD "refs/heads/$head_points_at" &&
392
393 # Tracking branch for the primary branch at the remote.
387 - origin_track="$remote_top/$head_points_at" &&
394 git-update-ref HEAD "$head_sha1" &&
395
390 - # Upstream URL
391 - git-config remote."$origin".url "$repo" &&
392 -
393 - # Set up the mappings to track the remote branches.
394 - git-config remote."$origin".fetch \
395 - "+refs/heads/*:$remote_top/*" '^$' &&
396 rm -f "refs/remotes/$origin/HEAD"
397 git-symbolic-ref "refs/remotes/$origin/HEAD" \
398 "refs/remotes/$origin/$head_points_at" &&
399
400 git-config branch."$head_points_at".remote "$origin" &&
401 git-config branch."$head_points_at".merge "refs/heads/$head_points_at"
402 + ;;
403 + '')
404 + # Source had detached HEAD pointing nowhere
405 + git-update-ref --no-deref HEAD "$head_sha1" &&
406 + rm -f "refs/remotes/$origin/HEAD"
407 + ;;
408 esac
409
410 case "$no_checkout" in