Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: git@vger.kernel.org
Subject: Re: [PATCH] git-clone: fix handling of upsteram whose HEAD does not point at master.
Date: Sun, 02 Apr 2006 21:22:01 -0700	[thread overview]
Message-ID: <7vvetrgufq.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: 7vu09bimj9.fsf@assigned-by-dhcp.cox.net

Junio C Hamano <junkio@cox.net> writes:

> When cloning from a remote repository that has master, main, and
> origin branches _and_ with the HEAD pointing at main branch, we
> did quite confused things during clone.  So this cleans things
> up.  The behaviour is a bit different between separate remotes/
> layout and the mixed branches layout.
>
> The newer layout with $GIT_DIR/refs/remotes/$origin/, things are
> simpler and more transparent:
>
>  - remote branches are copied to refs/remotes/$origin/.
>  - HEAD points at refs/heads/master, which starts at where the
>    remote HEAD points at.
>  - $GIT_DIR/remotes/$origin file is set up to fetch all remote
>    branches, and merge the branch HEAD pointed at at the time of
>    the cloning.

BTW, the behaviour under --use-separate-remote may be made more
consistent with the traditional layout case by using the same
branch name as the original repository even in that case.

On top of the previous patch, something like the attached one.
I'll put this in "next" and see how it goes, unless anybody
complains.

---

diff --git a/git-clone.sh b/git-clone.sh
index 9cc374e..c013e48 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -376,15 +376,11 @@ then
 	case "$head_points_at" in
 	?*)
 		mkdir -p "$GIT_DIR/remotes" &&
+		git-symbolic-ref HEAD "refs/heads/$head_points_at" &&
 		case "$use_separate_remote" in
-		# With separete-remote, our primary branch is always
-		# at 'master'
 		t)	origin_track="$remote_top/$head_points_at"
 			git-update-ref HEAD "$head_sha1" ;;
-		# Otherwise our primary branch is the same as the remote;
-		# we track upstream with $origin.
 		*)	origin_track="$remote_top/$origin"
-			git-symbolic-ref HEAD "refs/heads/$head_points_at"
 			git-update-ref "refs/heads/$origin" "$head_sha1" ;;
 		esac &&
 		echo >"$GIT_DIR/remotes/$origin" \

      reply	other threads:[~2006-04-03  4:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-02 23:29 [PATCH] git-clone: fix handling of upsteram whose HEAD does not point at master Junio C Hamano
2006-04-03  4:22 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vvetrgufq.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox