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

Re: [PATCH] fetch: when deepening, check connectivity fully

From
JTJonathan Tan <jonathantanmy@google.com>
Date
Jun 29, 2018, 22:30 UTC
Message-ID
<20180629223024.62002-1-jonathantanmy@google.com>
In-Reply-To
<xmqqwoujdejl.fsf@gitster-ct.c.googlers.com>
Show 11 quoted lines
> > That is the way it should work, but after thinking about it once more, I
> > realize that it isn't.
> >
> > opt->shallow_file is not set to anything. And fetch-pack updates the
> > shallow file by itself (at least, that is my understanding of
> > update_shallow() in fetch-pack.c) before fetch calls check_connected(),
> > meaning that if check_connected() fails, there is still no rollback of
> > the shallow file.
> 
> Ouch.  We need to fix that; otherwise, a broken server will keep
> giving you a corrupt repository even with this fix, no?
Yes, that is true - the repository will be left in a corrupt state.

I did some more investigation, and usually things are OK because unpack-trees runs a fsck_walk on all the objects it unpacks (with --shallow-file appropriately set). Things are bad only if the packfile is empty (or, presumably, if the packfile only has unrelated objects).

I managed to use the one-time-sed mechanism to craft a response that triggers this case. This both enables me to avoid the brittle check of "rev-list" appearing in the GIT_TRACE output (as discussed in [1]), and to verify that a rollback of the shallow file works, once such a patch is written. I'll look into writing such a patch, so feel free to hold off on this until that patch is done.

[1] https://public-inbox.org/git/20180627225105.155996-1-jonathantanmy@google.com/
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 8 in “fetch: when deepening, check connectivity fully”
  1. fetch: when deepening, check connectivity fullyJonathan Tan, Jun 27, 2018
  2. Junio C HamanoJun 27, 2018
  3. Jonathan TanJun 27, 2018
  4. Junio C HamanoJun 27, 2018
  5. Jonathan TanJun 29, 2018
  6. Junio C HamanoJun 27, 2018
  7. Jonathan TanJun 27, 2018
  8. Junio C HamanoJun 27, 2018

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.