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

Re: Plumbing for mapping from a remote tracking ref to the remote ref?

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 15, 2022, 20:18 UTC
Message-ID
<xmqqilp1znn1.fsf@gitster.g>
In-Reply-To
<CAPMMpogUxq59zj+=7UDiURYbydAwvymOqhEWaheT9fkU8HaP4Q@mail.gmail.com>
Tao Klerks <tao@klerks.biz> writes:
Show 14 quoted lines
> Given the following configured fetch refspec for a remote:
>
> [remote "origin"]
>         url = git@someserver:somerepo.git
>         fetch = +refs/heads/*:refs/remotes/somepath/*
>
> And given a ref of the form "refs/remotes/somepath/branch_A",
>
> I'm wondering whether there is any plumbing that would be able to tell
> me what to put in a "fetch" command, to get
> "refs/remotes/somepath/branch_A" fetched - in other words, is there
> any plumbing that can use the configured fetch refspecs to map
> "refs/remotes/somepath/branch_A" to "refs/heads/branch_A" for me, so
> that I can then do "git fetch origin refs/heads/branch_A".
I am fairly certain that I never have written one myself ;-)
I wonder how the end-user experience should look like.
	$ git refmap refs/remotes/somepath/branch-A
	origin refs/heads/branch-A
	$ git refmap refs/remotes/somepath/{branch-A,branch-B}
	origin refs/heads/branch-A
	origin refs/heads/branch-B

IOW, you give name(s) of remote-tracking branches and then you get the remote and their ref for these?

I do not oppose to such a command existing, but I do not know what the right answer should be for a case like this:

	[remote "origin"]
		url = ... the official project repository ...
		fetch = +refs/heads/*:refs/remotes/upstream/*
	[remote "mirror"]
		url = ... a local mirror you'd use regularly ...
		fetch = +refs/heads/*:refs/remotes/upstream/*

In order to support such a "more than one can update the same" case sensibly, the output may have to repeat the input, e.g.

	$ git refmap refs/remotes/upstream/main
	refs/remotes/upstream/main	origin refs/heads/main
	refs/remotes/upstream/main	mirror refs/heads/main
perhaps?
Previous: Tao KlerksNext: Johannes Schindelin
Message 2 of 7 in “Plumbing for mapping from a remote tracking ref to the remote ref?”
  1. Tao KlerksJun 15, 2022
  2. Junio C HamanoJun 15, 2022
  3. Johannes SchindelinJun 18, 2022
  4. Junio C HamanoJun 18, 2022
  5. Tao KlerksSep 3, 2023
  6. Junio C HamanoSep 5, 2023
  7. Tao KlerksSep 6, 2023

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.