Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Phillip Wood <phillip.wood123@gmail.com>
Cc: "Douglas Puchalski (dpuchals)" <dpuchals@cisco.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [Feature request] Separate explicit fetch mapping from default fetch selection
Date: Fri, 07 Aug 2026 07:55:26 -0700	[thread overview]
Message-ID: <xmqqtsp6f09t.fsf@gitster.g> (raw)
In-Reply-To: <10103c22-af8f-4bf3-b4ab-a3e4ce0491d4@gmail.com> (Phillip Wood's message of "Fri, 7 Aug 2026 14:08:22 +0100")

Phillip Wood <phillip.wood123@gmail.com> writes:

>> It was a long ago this was invented, and I haven't used it for
>> almost forever, but shouldn't this
>> 
>>      $ git fetch \
>>              --refmap="refs/heads/*:refs/remotes/origin/*" \
>>              origin topic/example
>> 
>> do what you want to do?  If so, perhaps it would make a good
>> starting point to make it easier to use (e.g., perhaps a
>> configuration variable can specify the refmap to be used, or
>> something).
>
> So we'd have something like "remote.<remote>.fetchMap" and 
> "remote.<remote>.pushMap" that mapped refnames, but did not affect what 
> gets fetched or push by default? That sounds useful (I've not thought 
> through the interaction with the existing settings though).

As I said, I do not know what the final system should look like,
but the idea behind 'refmap' was to separate (A) the rule
describing the correspondence between reference names on their end
and those on our end, and (B) the specification of which source
references are transferred to the destination repository.  Since the
transfer can work both ways, we would need two sets of maps, one for
each direction.

Once established, I suspect that 'git fetch' could learn something
like the 'matching' mode that 'git push' has in 'push.default'.
Using that mode, the OP's everyday 'git fetch' would then: (1)
interact with the default remote; (2) decide which of their
references to fetch by reverse-mapping the remote-tracking branches
we already have using the fetch 'refmap'; and (3) update the
remote-tracking references using those references we decided to
fetch in the previous step.  If the OP decides to extend the area of
interest by fetching a new branch from the remote,

    $ git fetch origin a-new-topic

naming only the remote and their branch, we would know which
remote-tracking branch to store the result in and add a new
refs/remotes/origin/a-new-topic remote-tracking branch.  This would
automatically extend what the next 'git fetch' grabs from them.

Or something like that, perhaps?


      reply	other threads:[~2026-08-07 14:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06 22:26 [Feature request] Separate explicit fetch mapping from default fetch selection Douglas Puchalski (dpuchals)
2026-08-07  2:42 ` Junio C Hamano
2026-08-07 13:08   ` Phillip Wood
2026-08-07 14:55     ` Junio C Hamano [this message]

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=xmqqtsp6f09t.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=dpuchals@cisco.com \
    --cc=git@vger.kernel.org \
    --cc=phillip.wood123@gmail.com \
    /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