From: Tao Klerks <tao@klerks.biz>
To: git <git@vger.kernel.org>
Subject: Plumbing for mapping from a remote tracking ref to the remote ref?
Date: Wed, 15 Jun 2022 21:12:18 +0200 [thread overview]
Message-ID: <CAPMMpogUxq59zj+=7UDiURYbydAwvymOqhEWaheT9fkU8HaP4Q@mail.gmail.com> (raw)
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
next reply other threads:[~2022-06-15 19:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-15 19:12 Tao Klerks [this message]
2022-06-15 20:18 ` Plumbing for mapping from a remote tracking ref to the remote ref? 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
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='CAPMMpogUxq59zj+=7UDiURYbydAwvymOqhEWaheT9fkU8HaP4Q@mail.gmail.com' \
--to=tao@klerks.biz \
--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;
as well as URLs for NNTP newsgroup(s).