I noticed a default option in git core.repositoryFormatVersion
which defaults to 0, but what are "repository format versions" and what functional difference do they make?
what are the different repository format versions (for the core.repositoryFormatVersion setting) in git?
14.9k views Asked by Alexander Bird At
2
There are 2 answers
1
On
It's for future compatibility -- if the git developers ever find it necessary to change the way that repos are stored on disk to enable some new feature, then they can make upgraded repos have a core.repositoryformatversion
of 1
. Then newer versions of git that know about that new format will trigger the code to deal with it, and older versions of git that don't will gracefully error with "Expected git repo version <= 0, found 1. Please upgrade Git"
.
As of now, the only repo format version defined or recognized is 0
, which denotes the format that every public release of git has used.
git 2.7 (Nov. 2015) adds a lot more information in the new
Documentation/technical/repository-version.txt
.See commit 067fbd4, commit 00a09d5 (23 Jun 2015) by Jeff King (
peff
).(Merged by Junio C Hamano --
gitster
-- in commit fa46579, 26 Oct 2015)You now can define "extensions", and use
core.repositoryformatversion
as a "marker" to signal the existence of said extensions, instead of having to bump the Git version number itself:Extracts from the doc:
Now that is really an original approach to all the release version number policy and its semver policy.
As a first extension, you will have with git 2.7
preciousObjects
:The doc mentions:
That is:
Note that this
core.repositoryformatversion
business is old. Really old. commit ab9cb76, Nov. 2005, Git 0.99.9l.It was done initially for the db version:
Git 2.22 (Q2 2019) will avoid leaks around the
repository_format
structure.See commit e8805af (28 Feb 2019), and commit 1301997 (22 Jan 2019) by Martin Ågren (``).
(Merged by Junio C Hamano --
gitster
-- in commit 6b5688b, 20 Mar 2019)With Git 2.28 (Q3 2020), the runtime itself can upgrade the repository format version automatically, for example on an unshallow fetch.
See commit 14c7fa2, commit 98564d8, commit 01bbbbd, commit 16af5f1 (05 Jun 2020) by Xin Li (
livid
).(Merged by Junio C Hamano --
gitster
-- in commit 1033b98, 29 Jun 2020)Warning: In 2.28-rc0, we corrected a bug that some repository extensions are honored by mistake even in a version 0 repositories (these configuration variables in
extensions.*
namespace were supposed to have special meaning in repositories whose version numbers are 1 or higher), but this was a bit too big a change.See commit 62f2eca, commit 1166419 (15 Jul 2020) by Jonathan Nieder (
artagnon
).(Merged by Junio C Hamano --
gitster
-- in commit d13b7f2, 16 Jul 2020)