Re: repositoryformatversion and extensions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 11, 2024 at 11:54:55AM +0000, Edward Thomson wrote:
> While looking at worktree configuration, I realized that the
> extensions.worktreeconfig configuration option was honored even when
> core.repositoryformatversion was unset, or explicitly set to 0.
> 
> Re-reading the docs for repository-version, it doesn't explicitly state
> that extensions _require_ repositoryformatversion >= 1, it instead
> states that:
> 
> > When reading the core.repositoryformatversion variable, a git
> > implementation which supports version 1 MUST also read any configuration
> > keys found in the extensions section of the configuration file.

Yeah, indeed. As far as I understand, the major difference between
version 1 and version 0 is that version 1 asks the Git client to bail
out as soon as there is any extension that isn't understood by the
client. To me this behaviour is somewhat surprising because it doesn't
allow for in-between states where some extensions are mandatory whereas
others aren't. It would have been better to have a mechanism that
disregards the version but makes each extension itself highlight whether
it is mandatory or not.

> Despite that, at least one extension (objectformat) does require
> core.repositoryformatversion >= 1. Though, do note that objectformat
> is not mentioned in the repository-version documentation.
> 
> What other extensions require repository format version >= 1? Is
> core.objectformat the outlier here?

In any case, there are two extensions that make us set version 1 right
now: `objectFormat` and `refStorage`. For the latter it is quite
important for any client to bail out if it's not understood by them so
that we don't accidentally start to write e.g. loose refs in a reftable
repository.

> Is there documentation on which extensions are supported at which
> repository format versions?

Not that I'd know of. Right now, it includes "noop-v1", "objectFormat"
and "refStorage". But I only derive that info from `handle_extension()`
in "setup.c".

> Are there other extensions that are not documented in repository-version?

The only extension I'm aware of that is missing is "noop-v1". That
extension is mostly just used for testing purposes though, so it's of
rather dubious value to document it. On the other hand, the "noop"
extension is documented, as well.

In any case, the policy of the Git project is that any new extension
should only ever be understood when the repository format version is >=
1 from now on. At least, that's what the code tells us:

```
/*
 * Do not add new extensions to this function. It handles extensions which are
 * respected even in v0-format repositories for historical compatibility.
 */
static enum extension_result handle_extension_v0(const char *var,
						 const char *value,
						 const char *ext,
						 struct repository_format *data)
```

So it's probably safe to assume that every new extension should be at
least v1 from now on.

Patrick

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux