git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Plumbing for mapping from a remote tracking ref to the remote ref?
@ 2022-06-15 19:12 Tao Klerks
  2022-06-15 20:18 ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Tao Klerks @ 2022-06-15 19:12 UTC (permalink / raw)
  To: git

Hi folks,

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 understand I can parse the fetch refspecs myself, assuming any
asterisk is only ever on the tail end of the ref pattern... but that
seems very complicated, given that this is *probably* something others
have needed to do in the past?

Fwiw I've noticed that "git rev-parse --symbolic-full-name" knows how
to do almost exactly the *opposite* of that, when presented with the
"@{u}" pattern - it looks up the "branch.XXX.merge" value, which is
written in a remote-relative form ("refs/heads/branch_A" in this
example), and converts that to the "local" fetch destination (eg
"refs/remotes/somepath/branch_A"). But I don't know how to go the
opposite way, given only a local fetch destination and wanting to tell
fetch what to get - it expects a remote-relative ref.

Any help appreciated!

Thanks,
Tao

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-09-06  4:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-15 19:12 Plumbing for mapping from a remote tracking ref to the remote ref? Tao Klerks
2022-06-15 20:18 ` Junio C Hamano
2022-06-18 22:04   ` Johannes Schindelin
2022-06-18 23:04     ` Junio C Hamano
2023-09-03  7:16       ` Tao Klerks
2023-09-05 22:18         ` Junio C Hamano
2023-09-06  4:21           ` Tao Klerks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).