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

Re: [PATCH] fetch: document that pruning happens before fetching

From
Jeff King <peff@peff.net>
Date
Jun 14, 2016, 06:17 UTC
Message-ID
<20160614061752.GA11935@sigill.intra.peff.net>
In-Reply-To
<CA+P7+xpk6HqeJfUcAkpTbW_hO6dyjanXoqaaKqdTU363n=-Stw@mail.gmail.com>
On Mon, Jun 13, 2016 at 11:14:36PM -0700, Jacob Keller wrote:
Show 29 quoted lines
> On Mon, Jun 13, 2016 at 4:58 PM, Jeff King <peff@peff.net> wrote:
> > This was changed in 10a6cc8 (fetch --prune: Run prune before
> > fetching, 2014-01-02), but it seems that nobody in that
> > discussion realized we were advertising the "after"
> > explicitly.
> >
> > Signed-off-by: Jeff King <peff@peff.net>
> > ---
> > I include myself in that "nobody" of course. :)
> >
> >  Documentation/fetch-options.txt | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt
> > index 036edfb..b05a834 100644
> > --- a/Documentation/fetch-options.txt
> > +++ b/Documentation/fetch-options.txt
> > @@ -52,7 +52,7 @@ ifndef::git-pull[]
> >
> >  -p::
> >  --prune::
> > -       After fetching, remove any remote-tracking references that no
> > +       Before fetching, remove any remote-tracking references that no
> >         longer exist on the remote.  Tags are not subject to pruning
> >         if they are fetched only because of the default tag
> >         auto-following or due to a --tags option.  However, if tags
> 
> What's the difference in behavior due to pruning before instead of
> after? Curious. It seems like pruning after would make more sense?
See 10a6cc8. :)

Basically, you have to prune first to make way for new incoming refs when there is a D/F conflict.

The downside is that there is a moment where objects may be unreferenced (e.g., if upstream moved "foo" to "bar", we delete "foo" and _then_ create "bar"). And due to the way refs are stored, we do not keep even a reflog for the deleted ref in the interim.

-Peff
Previous: Jacob KellerNext: Jacob Keller
Message 3 of 8 in “fetch: document that pruning happens before fetching”
  1. fetch: document that pruning happens before fetchingJeff King, Jun 13, 2016
  2. Jacob KellerJun 14, 2016
  3. Jeff KingJun 14, 2016
  4. Jacob KellerJun 14, 2016
  5. Duy NguyenJun 14, 2016
  6. Jeff KingJun 14, 2016
  7. Duy NguyenJun 14, 2016
  8. Jeff KingJun 15, 2016

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.