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

Re: [PATCH v3] doc: describe Git bundle format

From
Masaya Suzuki <masayasuzuki@google.com>
Date
Feb 7, 2020, 22:21 UTC
Message-ID
<CAJB1erVZ5E6FxtD8gJXXpzJjquvksLxpz+h1TzG52Yr9DFmDRQ@mail.gmail.com>
In-Reply-To
<xmqqlfpe2jx3.fsf@gitster-ct.c.googlers.com>
On Fri, Feb 7, 2020 at 12:59 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 15 quoted lines
>
> Masaya Suzuki <masayasuzuki@google.com> writes:
>
> > On Fri, Feb 7, 2020 at 12:42 PM Masaya Suzuki <masayasuzuki@google.com> wrote:
> >> +=== Note on the shallow clone and a Git bundle
> >> +
> >> +Note that the prerequisites does not represent a shallow-clone boundary. The
> >
> > the prerequisites do not
>
> Grammo aside, I am not sure if that particular Note is beneficial to
> begin with.  I would imagine that you can get a bundle that holds
> all the objects in a shallow repository by specifying the range that
> match the shallow-clone boundary when you run "git bundle create"
> while disabling thin-pack generation.

Yes. The reason that I've been trying to check the semantics of the prerequisites is that I DO recognize that this is possible format-wise. I'm not sure if this Git implementation can create such bundles, but format-wise such bundles can be created.

When writing a Git bundle parser in other implementations (like JGit), it's not clear whether, as a library, I should support such use cases. If such usage is supported in the format, then the semantics of the prerequisites changes. Currently the prerequisites are defined as the objects that are NOT included in the bundle, and the reader of the bundle MUST already have, in order to use the data in the bundle. If the format supports shallow-cloned repository, this will be defined as the objects that are NOT included in the bundle. If the reader wants to read this bundle as if it's a non-shallow clone, the reader of the bundle MUST have the objects that are reachable from these prerequisites. If the reader wants to read this bundle as if it's a shallow clone, the reader MUST treat these as a shallow boundary.

Also, this change will put further restrictions on the pack. "Pack" is the pack data stream "git fetch" would send. If the writer of a bundle wants to write as a shallow-clone pack, the pack MUST NOT reference objects outside of the shallow boundary from the pack file as a delta base. The writer MAY reference the commit objects outside of the shallow boundary as a parent.

The readers and the writers of bundles MUST communicate whether a bundle represents a shallow clone repository in other means. The bundle file does not have any indicator whether it's a shallow clone bundle or not.

Show 5 quoted lines
> The support of shallow-clone by Git may be incomplete and it may not
> be easy to form such a range, and "git bundle create" command may
> not have a knob to disable thin-pack generation, but that does not
> mean that the bundle *format* cannot be used to represent the
> shallow boundary.

As I wrote above, if this bundle format supports the shallow clone state, the semantics will change and writers and readers have different constraints on the packs. In order to do so, the readers and the writers have to agree whether it's a shallow clone or not in other mean since the bundle file doesn't have such indicators. I think it's better to prohibit such use cases (or at least make it as unintended usage), and then create a different bundle format version that supports shallow clone boundary (so that the bundle file can be more close to the frozen git-fetch response).

Previous: Junio C HamanoNext: Junio C Hamano
Message 13 of 16 in “doc: describe Git bundle format”
  1. doc: describe Git bundle formatMasaya Suzuki, Jan 30, 2020
  2. Johannes SchindelinJan 31, 2020
  3. Junio C HamanoJan 31, 2020
  4. Masaya SuzukiJan 31, 2020
  5. Junio C HamanoJan 31, 2020
  6. Masaya SuzukiJan 31, 2020
  7. Junio C HamanoFeb 4, 2020
  8. doc: describe Git bundle formatMasaya Suzuki, Jan 31, 2020
  9. Junio C HamanoJan 31, 2020
  10. doc: describe Git bundle formatMasaya Suzuki, Feb 7, 2020
  11. Masaya SuzukiFeb 7, 2020
  12. Junio C HamanoFeb 7, 2020
  13. Masaya SuzukiFeb 7, 2020
  14. Junio C HamanoFeb 8, 2020
  15. Masaya SuzukiFeb 12, 2020
  16. Junio C HamanoFeb 12, 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.