On Fri, Feb 7, 2020 at 12:59 PM Junio C Hamano <gitster@xxxxxxxxx> wrote: > > Masaya Suzuki <masayasuzuki@xxxxxxxxxx> writes: > > > On Fri, Feb 7, 2020 at 12:42 PM Masaya Suzuki <masayasuzuki@xxxxxxxxxx> 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. > 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).