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

Re: [RFC PATCH 1/1] Teach remote add the --prefix-tags option

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 15, 2019, 03:07 UTC
Message-ID
<xmqq4l0ad7vn.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<d47c5de5fc812b1fbd04bb259a522e453d4b21e2.1571089481.git.wink@saville.com>
Wink Saville <wink@saville.com> writes:
> When --prefix-tags is passed to `git remote add` the tagopt is set to
> --prefix-tags and a second fetch line is added so tags are placed in
> a separate hierarchy per remote.

In the olden days, there was no refs/remotes/$remoteName/ hiearchy, and until we made it the default at around Git 1.5.0, such a modern layout for the branches were called the "separate remote" layout, and can be opted into with "clone --use-separate-remote" by early adopters.

I doubt that use of refs/tags/$remoteName/ is a good design if we want to achieve similar isolation between local tags and and tags obtained from each remote.

An obvious alternative, refs/remotes/$remoteName/tags/, is not a good design for exactly the same reason. You cannot tell between a local tag foo/bar and a tag bar obtained from remote foo when you see refs/tags/foo/bar, and you cannot tell between a branch tag/bar obtained from remote foo and a tag bar obtained from remote foo when you see refs/remotes/foo/tags/bar. In the past, people suggested to use refs/remoteTags/$remoteName/ for proper isolation, and it might be a better middle-ground than either of the two, at least in the shorter term, but not ideal.

In short, if you truly want to see "separate hierarchy per remote", you should consider how you can reliably implement an equivalent of "git branch --list --remote"; a design that does not allow it is a failure.

A better solution with longer lifetime would probably be to use
	refs/remotes/$remoteName/{heads,tags,...}/

when core.useTotallySeparateRemote configuration exists (and eventually at Git 3.0 make the layout the default). It would involve changes in the refname look-up rules, but it would not have to pollute refs/ namespace like the refs/remoteTags/ half-ground design, which would require us to add refs/remoteNotes/ and friends, who knows how many more we would end up having to support if we go that route.

Thanks.
Previous: Wink SavilleNext: Wink Saville
Message 3 of 6 in “Teach remote add a --prefix-tags option”
  1. 0/1 Teach remote add a --prefix-tags optionWink Saville, Oct 14, 2019
  2. 1/1 Teach remote add the --prefix-tags optionWink Saville, Oct 14, 2019
  3. Junio C HamanoOct 15, 2019
  4. Wink SavilleOct 15, 2019
  5. Jacob KellerOct 15, 2019
  6. Jacob KellerOct 16, 2019

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.