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

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

From
Jeff King <peff@peff.net>
Date
Jan 17, 2020, 19:26 UTC
Message-ID
<20200117192610.GC11358@coredump.intra.peff.net>
In-Reply-To
<xmqqa76lew1l.fsf@gitster-ct.c.googlers.com>
On Fri, Jan 17, 2020 at 11:13:10AM -0800, Junio C Hamano wrote:
Show 15 quoted lines
> > 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.
> 
> Hmph.  I have to wonder if this should have been the default.  That
> is, when refs/heads/X on the remote is configured to be copied to
> refs/remotes/origin/X on this side, and an explicit refspec says it
> should go some other place (i.e. refs/hidden/X), shouldn't that
> automatically bypass configured +refs/heads/*:refs/remotes/origin/*
> refspec?  In any case, it is too late to change that now.
It used to be the default. You can blame 2013-me. ;)

Before that, though, we had people complaining the other way ("I just fetched from the remote, but my tracking ref is stale!").

Show 7 quoted lines
> > 3. With fetch.writeCommitGraph enabled, the refs/hidden refs are
> >    used to update the commit-graph file.
> 
> I have a moderately strong suspicion that it would be better to make
> this "--ignore-configured-refspecs" and implemented without special
> casign the "refs/remotes/" hierarchy like the code does by
> hardcoding.

Yeah, I just independently wrote something similar. Your "--refmap" option can accomplish that already.

> I also wonder if auto-following of tags should be disabled at the
> same time.  I have no good argument either way (yet).

I _didn't_ think of tag auto-following in my other response. That's a good point. I think he'd probably just want to use "--no-tags" for the background fetch. You'd end up having to fetch the tag objects themselves during the "real" fetch, but presumably they're very small compared to the rest of history.

You could also do:
  git fetch --refmap= <remote> +refs/heads/*:refs/hidden/heads/* +refs/tags/*:refs/hidden/tags/*

to get everything in your pre-fetch (though you actually get more than the real fetch would need, since by default it won't grab tags which don't point to otherwise-reachable history).

-Peff
Previous: Junio C HamanoNext: Derrick Stolee
Message 4 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.