git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] clone: add refs/remotes/* to Pull: targets when cloning

From
Junio C Hamano <junkio@cox.net>
Date
Mar 9, 2006, 18:23 UTC
Message-ID
<7vfylr5vfs.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20060309115535.GB13369@localdomain>
Eric Wong <normalperson@yhbt.net> writes:
Show 15 quoted lines
> diff --git a/git-clone.sh b/git-clone.sh
> index 4ed861d..a8ab7fd 100755
> --- a/git-clone.sh
> +++ b/git-clone.sh
> @@ -249,6 +249,12 @@ Pull: $head_points_at:$origin" &&
>  			test "$origin" = "$head" ||
>  			echo "Pull: ${head}:${head}"
>  		done >>"$GIT_DIR/remotes/origin"
> +		(test -d "$GIT_DIR"/refs/remotes && cd "$GIT_DIR" &&
> +		 find "refs/remotes" -type f -print | sed -e 's|^refs/||') |
> +		while read ref
> +		do
> +			echo "Pull: $ref:$ref"
> +		done >>"$GIT_DIR/remotes/origin"
>  	esac

I am not sure I agree with what you are doing here. I thought the idea behind refs/remotes is to migrate away from copying all the remote heads into refs/heads (so that Linus does not need to see my "next" and "pu" under his refs/heads), and putting foreign SCM tracking branches used by SVN and CVS importers in there instead of in refs/heads naturally falls out from that pattern.

Now I do not propose to change the current clone that contaminates the local branch namespace by copying remote refs/heads into local refs/heads in the middle of v1.3.0 development without laying out a transition plan, but I think that is a sensible future direction. Instead of copying everything from refs/heads to refs/heads, we only copy what remote HEAD points at to refs/heads/master to initialize the local clone, and copy everything from refs/heads to refs/remotes, _and_ set up Pull: lines to do the same tracking. The part of the code you are touching corresponds to the last part.

We would probably be better off not doing this right now. When we are sure everybody thinks it is a better approach to use refs/remotes for remote branch tracking, we would need to change the part you did not change (I think the clone-pack part is the hardest to change since it has a built-in "copy refs to matching locations" logic) alongside with the part you touched with this patch to make things consistent. At that time also you would need to remove several lines above the part you touched so that we do not use local refs/heads/* for tracking.

How does that sound?
Previous: Eric WongNext: Junio C Hamano
Message 3 of 5 in “fetch/parse-remote: refs/remotes/* support”
  1. fetch/parse-remote: refs/remotes/* supportEric Wong, Mar 9, 2006
  2. clone: add refs/remotes/* to Pull: targets when cloningEric Wong, Mar 9, 2006
  3. Junio C HamanoMar 9, 2006
  4. Junio C HamanoMar 9, 2006
  5. fetch,parse-remote,fmt-merge-msg: refs/remotes/* supportEric Wong, Mar 10, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.