From: Junio C Hamano <gitster@pobox.com>
To: Tao Klerks <tao@klerks.biz>
Cc: git <git@vger.kernel.org>
Subject: Re: Plumbing for mapping from a remote tracking ref to the remote ref?
Date: Wed, 15 Jun 2022 13:18:26 -0700 [thread overview]
Message-ID: <xmqqilp1znn1.fsf@gitster.g> (raw)
In-Reply-To: <CAPMMpogUxq59zj+=7UDiURYbydAwvymOqhEWaheT9fkU8HaP4Q@mail.gmail.com> (Tao Klerks's message of "Wed, 15 Jun 2022 21:12:18 +0200")
Tao Klerks <tao@klerks.biz> writes:
> 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?
next prev parent reply other threads:[~2022-06-15 20:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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=xmqqilp1znn1.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=tao@klerks.biz \
/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).