Skip to content

config: read repositoryformatversion in unmarshalCore - #2167

Merged
pjbgf merged 1 commit into
go-git:releases/v5.xfrom
c-tonneslan:fix/unmarshal-core-repositoryformatversion
Jul 31, 2026
Merged

config: read repositoryformatversion in unmarshalCore#2167
pjbgf merged 1 commit into
go-git:releases/v5.xfrom
c-tonneslan:fix/unmarshal-core-repositoryformatversion

Conversation

@c-tonneslan

Copy link
Copy Markdown

`marshalCore` writes `core.repositoryformatversion` when it isn't empty, but `unmarshalCore` never set `Core.RepositoryFormatVersion` from the parsed section. So on a repo with explicit `repositoryformatversion=1` the field loaded as the zero value and `verifyExtensions` treated the repo as version 0, which then rejected V1 extensions like `worktreeConfig` that the on-disk config clearly enabled.

Mirror of the V6 fix on `main` (the read is already there in commit 6923824). Test fails on `releases/v5.x` without the change.

fixes #2155

marshalCore writes core.repositoryformatversion when it isn't empty,
but unmarshalCore never set Core.RepositoryFormatVersion from the parsed
section. On a repo with explicit repositoryformatversion=1 the field
loaded as the zero value, so verifyExtensions treated the repo as
version 0 and rejected V1 extensions like worktreeConfig that the on-disk
config clearly enabled.

Mirror the V6 fix (commit 6923824) so Version_1 round-trips correctly.

Closes go-git#2155

Signed-off-by: Charlie Tonneslan <cst0520@gmail.com>

@pjbgf pjbgf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@c-tonneslan thanks for working on this. 🙇

@pjbgf
pjbgf merged commit 42852fd into go-git:releases/v5.x Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants