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

Re: [PATCH 6/9] fetch: Check if all objects exist after fetching

From
AGAndreas Gruenbacher <agruen@suse.de>
Date
Mar 18, 2010, 19:36 UTC
Message-ID
<201003182036.46874.agruen@suse.de>
In-Reply-To
<20100318190816.GE10981@spearce.org>
On Thursday 18 March 2010 20:08:16 Shawn O. Pearce wrote:
Show 10 quoted lines
> Andreas Gruenbacher <agruen@suse.de> wrote:
> > Check if all objects reachable from the fetched refs exist after
> > fetching instead of before: this allows us to distinguish between a
> > repository which is not up to date and a corrupted repository, and to
> > ensure that the repository is up to date and complete after the fetch.
> 
> I'm against this particular change because it looks like it breaks
> the idea of "quickfetch", which we introduced to support faster
> fetches from the parent repository into a shared clone on the
> same disk.

I think you misunderstand the patch. Before the patch, we were doing a rev- list to determine if all objects needed are present. If rev-list fails, this can have two reasons: (a) some of the branches or tags needed do not exist, (b) all the branches and tags needed do exist, but other objects further up the tree are missing (i.e., a corrupted repository).

The patch changes that to first check which needed objects are missing (with has_sha1_file()), which is very efficient, by then fetching the objects which surely need to be fetched, and by then checking the repository consistency with rev-list. If rev-list then fails, which should only happen in the rarest cases, we know that we need to fetch all branches and tags so that we are sure to catch missing objects further up the tree.

So we never fetch more than we did before, and in some cases, we fetch less. We are also guaranteed to end up with a consistent repository in the end. (The old logic does not always guarantee that AFAICT: there seems to be one corner case where a fetch succeeds without retrieving missing objects further up the tree.)

Thanks, Andreas

Previous: Shawn O. PearceNext: Shawn O. Pearce
Message 12 of 14 in “Multiple remotes without conflicts”
  1. 0/9 Multiple remotes without conflictsAndreas Gruenbacher, Mar 18, 2010
  2. 1/9 fetch: Check for a "^{}" suffix with suffixcmp()Andreas Gruenbacher, Mar 13, 2010
  3. 2/9 fetch: Properly initialize refspec on stackAndreas Gruenbacher, Mar 12, 2010
  4. 3/9 fetch: Fix minor memory leakAndreas Gruenbacher, Mar 15, 2010
  5. 4/9 fetch: Move deepening fetch check into builtin/fetch.cAndreas Gruenbacher, Mar 16, 2010
  6. 5/9 fetch: Move loop checking which refs we have alreadyAndreas Gruenbacher, Mar 16, 2010
  7. 6/9 fetch: Check if all objects exist after fetchingAndreas Gruenbacher, Mar 16, 2010
  8. 7/9 fetch: Use the same ref map for all branches and tagsAndreas Gruenbacher, Mar 17, 2010
  9. 8/9 fetch: Don't fetch tags twiceAndreas Gruenbacher, Mar 17, 2010
  10. 9/9 fetch: Make automatic tag following work with arbitrary refspecsAndreas Gruenbacher, Mar 17, 2010
  11. Shawn O. PearceMar 18, 2010
  12. Andreas GruenbacherMar 18, 2010
  13. Shawn O. PearceMar 18, 2010
  14. Andreas GruenbacherMar 18, 2010

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.