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

partial clone: promisor fetch during push (pack-objects)

From
Robert Coup <robert.coup@koordinates.com>
Date
Feb 26, 2021, 12:01 UTC
Message-ID
<CAFLLRpJgfseK5P8ZJm7iEW1onf7ROVSkyeuPfh1+qoHHjsC8uw@mail.gmail.com>

For a partially-cloned repository, push (pack-objects) does a fetch for missing objects to do delta compression with.

Test-case to reproduce, with annotated output: https://gist.github.com/rcoup/5593a0627cca52f226580c72743d8e33 (git v2.30.1.602.g966e671106)

My use case is partially-cloning some large repositories with the majority of the blobs not fetched locally, writing some blobs to replace some specific paths I don't currently have cloned, committing & pushing (while leaving most trees as-is). I didn't expect git to attempt promisor fetches during a push :)

I happened to see it because allowAnySha1InWant wasn't enabled, so it printed errors but happily continued and completed the push (after a fetch attempt for each object).

My current workaround is setting `pack.window=0` during push. Looks from builtin/pack_objects.c:prepare_pack() that `pack.depth=0` should skip it too, but that didn't seem to work.

Invoking pack-objects directly with any --missing= value still tries to fetch. And regardless, it carries on if the fetches fail. The fetches happen at the end of builtin/pack_objects.c:check_object().

1. Feels to me that fetching from a promisor remote is never going to
be quicker than skipping delta compression during a push. Maybe
there's a case for doing it during other pack invocations to minimise
size though?
2. Seems like a bug that check_object() doesn't honour
fetch_if_missing and skip the call to prefetch_to_pack().
3. But push doesn't pass --missing= to pack-objects anyway, so that
wouldn't actually solve the original issue. Should it?

Thanks! Rob :)

Next: Jonathan Tan
Message 1 of 4 in “partial clone: promisor fetch during push (pack-objects)”
  1. Robert CoupFeb 26, 2021
  2. Jonathan TanFeb 26, 2021
  3. Robert CoupMar 1, 2021
  4. Jonathan TanMar 1, 2021

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.