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

Re: [PATCH v2 9/9] fetch: allow explicit --refmap to override configuration

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Jun 18, 2014, 12:21 UTC
Message-ID
<53A18445.8090607@alum.mit.edu>
In-Reply-To
<xmqqy4xbrynr.fsf@gitster.dls.corp.google.com>
On 06/05/2014 08:36 PM, Junio C Hamano wrote:
Show 9 quoted lines
> Marc Branchaud <marcnarc@xiplink.com> writes:
> 
>> I don't have any objection to the option per se.  But I do wonder if there's
>> a need to add yet another knob to git just for completeness.  Has anyone ever
>> needed this?
> 
> It is not a good yardstick, as everybody has survived without it
> since Git's inception.  The right question to ask is: would it help
> new use patterns, or improve existing use patterns?

I agree that this feature is pretty esoteric and probably more cognitive load than it's worth. One of your use cases has workarounds shown below.

Show 5 quoted lines
> Two possible scenarios I can think of offhand are
> 
>  * using an empty refmap to ensure that your "fetch" this time is
>    really ephemeral without affecting the longer-term configured
>    remote-tracking branches

Doesn't specifying an explicit URL get around the refspecs configured for the remote? E.g.,

    git fetch $(git config remote.github.url) master

Or if we had a way to temporarily unset multivalued configuration values (which we may have soon thanks to the GSoC project of Tanay Abhra), one could use

    git --unset=remote.github.fetch fetch github master
Show 12 quoted lines
>  * grabbing only a few selected branches out of hundreds, e.g.
> 
>    $ git fetch https://github.com/gitster/git \
>        --refmap=refs/heads/*:refs/remotes/jch/* maint master next +pu
> 
>    instead of having to spell its long-hand
> 
>    $ git fetch https://github.com/gitster/git \
>        refs/heads/maint:refs/remotes/jch/maint \
>        refs/heads/master:refs/remotes/jch/master \
>        refs/heads/next:refs/remotes/jch/next \
>        +refs/heads/pu:refs/remotes/jch/pu

I'm not quite sure what your goal is here, but if you want to fetch some branches on the fly without setting up a remote, then

    git -c remote.github.fetch='refs/heads/*:refs/remotes/jch/*' \
             fetch https://github.com/gitster/git maint master next +pu
should work, no?
> but there may be more useful scenarios other people can come up
> with ;-).
Michael
-- 
Michael Haggerty
mhagger@alum.mit.edu
Previous: Junio C Hamano
Message 24 of 24 in “Clarify two uses of remote.*.fetch”
  1. 0/9 Clarify two uses of remote.*.fetchJunio C Hamano, Jun 3, 2014
  2. 1/9 fetch doc: update introductory part for clarityJunio C Hamano, Jun 3, 2014
  3. 2/9 fetch doc: move FETCH_HEAD material lower and add an exampleJunio C Hamano, Jun 3, 2014
  4. 3/9 fetch doc: update note on '+' in front of the refspecJunio C Hamano, Jun 3, 2014
  5. Michael HaggertyJun 18, 2014
  6. 4/9 fetch doc: remove notes on outdated "mixed layout"Junio C Hamano, Jun 3, 2014
  7. 5/9 fetch doc: on pulling multiple refspecsJunio C Hamano, Jun 3, 2014
  8. Marc BranchaudJun 4, 2014
  9. 6/9 fetch doc: update refspec format descriptionJunio C Hamano, Jun 3, 2014
  10. 7/9 fetch doc: remove "short-cut" sectionJunio C Hamano, Jun 3, 2014
  11. Marc BranchaudJun 4, 2014
  12. 8/9 fetch doc: add a section on configured remote-tracking branchesJunio C Hamano, Jun 3, 2014
  13. Marc BranchaudJun 4, 2014
  14. Junio C HamanoJun 4, 2014
  15. Marc BranchaudJun 5, 2014
  16. docs: Explain the purpose of fetch's and pull's <refspec> parameter.Marc Branchaud, Jun 5, 2014
  17. Junio C HamanoJun 5, 2014
  18. docs: Explain the purpose of fetch's and pull's <refspec> parameter.Marc Branchaud, Jun 11, 2014
  19. 9/9 fetch: allow explicit --refmap to override configurationJunio C Hamano, Jun 3, 2014
  20. Marc BranchaudJun 4, 2014
  21. Junio C HamanoJun 4, 2014
  22. Marc BranchaudJun 5, 2014
  23. Junio C HamanoJun 5, 2014
  24. Michael HaggertyJun 18, 2014

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.