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

Re: [PATCH] fetch: add --no-update-remote-refs

From
Derrick Stolee <stolee@gmail.com>
Date
Jan 21, 2020, 00:57 UTC
Message-ID
<4e444a99-6785-1d11-d8cf-87903c3b3760@gmail.com>
In-Reply-To
<20200117192016.GB11358@coredump.intra.peff.net>
On 1/17/2020 2:20 PM, Jeff King wrote:
Show 17 quoted lines
> On Fri, Jan 17, 2020 at 03:28:59PM +0000, Derrick Stolee via GitGitGadget wrote:
>> Add a --[no-]update-remote-refs option to 'git fetch' which defaults
>> to the existing behavior of updating the remote refs. This allows
>> a user to run
>>
>>   git fetch <remote> --no-update-remote-refs +refs/heads/*:refs/hidden/*
>>
>> to populate a custom ref space and download a pack of the new
>> reachable objects. This kind of call allows a few things to happen:
> But I think there's already a way to do that: the --refmap option added
> by c5558f80c3 (fetch: allow explicit --refmap to override configuration,
> 2014-05-29). Using an empty refmap like:
> 
>   git fetch --refmap= <remote> refs/heads/*:refs/hidden/*
> 
> should do what you want. It suppresses the use of the configured
> refspecs, so we don't find any opportunistic mappings to make.
You're absolutely right. There are details at [1].

The tricky thing is that the documentation makes it look like you need a value there, and if you supply a value without a refspec argument, an error is given:

$ git fetch origin --refmap="+refs/heads/*:refs/hidden/origin/*" fatal: --refmap option is only meaningful with command-line refspec(s).

I think I'll follow up with a documentation patch to point out that an empty --refmap value will ignore the configured refspec and rely only on the provided refspec argument.

Thanks! -Stolee

[1] https://git-scm.com/docs/git-fetch#_configured_remote_tracking_branches_a_id_crtb_a
Previous: Jeff KingNext: Derrick Stolee via GitGitGadget
Message 7 of 13 in “fetch: add --no-update-remote-refs”
  1. fetch: add --no-update-remote-refsDerrick Stolee via GitGitGadget, Jan 17, 2020
  2. Eric SunshineJan 17, 2020
  3. Junio C HamanoJan 17, 2020
  4. Jeff KingJan 17, 2020
  5. Derrick StoleeJan 20, 2020
  6. Jeff KingJan 17, 2020
  7. Derrick StoleeJan 21, 2020
  8. fetch: document and test --refmap=""Derrick Stolee via GitGitGadget, Jan 21, 2020
  9. Jeff KingJan 21, 2020
  10. Derrick StoleeJan 21, 2020
  11. Jeff KingJan 21, 2020
  12. Junio C HamanoJan 21, 2020
  13. Junio C HamanoJan 21, 2020

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.