git: Add strict checks for supported extensions by pjbgf · Pull Request #1850 · go-git/go-git
AI review requested due to automatic review settings
February 16, 2026 16:56Git extensions may be Storer-specific, like reftables or objectformat. By implementing this interface, the Storers will be able to tell the core go-git precisely what extensions they support. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
pjbgf added a commit to pjbgf/go-git that referenced this pull request
Feb 16, 2026The SHA256 implementation introduced a temporary ObjectFormatGetter interface that had two key goals: - Provide a way to access the ObjectFormat from a storer.Storer, without changing the existing API. - Be able to distinguish between storer.Storer implementations that support the objectformat extension. The PR go-git#1850 ensures that the storer.Storer being used supports the required objectformat. With that, this interface can be replaced by config.ConfigStorer, making the config the single source of truth for the objectformat. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
pjbgf
mentioned this pull request
pjbgf added a commit to pjbgf/go-git that referenced this pull request
Feb 16, 2026The SHA256 implementation introduced a temporary ObjectFormatGetter interface that had two key goals: - Provide a way to access the ObjectFormat from a storer.Storer, without changing the existing API. - Be able to distinguish between storer.Storer implementations that support the objectformat extension. The PR go-git#1850 ensures that the storer.Storer being used supports the required objectformat. With that, this interface can be replaced by config.ConfigStorer, making the config the single source of truth for the objectformat. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
The upstream Git enforces fail-safe heuristics to ensure that older git versions will avoid handling repositories using extensions they are unaware of. The logic is largely based on the value of core.repositoryformatversion. As per official Git docs: > This version specifies the rules for operating on the on-disk repository data. > An implementation of git which does not understand a particular version > advertised by an on-disk repository MUST NOT operate on that repository; > doing so risks not only producing wrong results, but actually losing data. Now go-git will ensure that: - The git.Open logic will verify and enforces the extension support rules. - go-git will keep track of built-in extensions that it supports. - Any extension that is Storer-specific (e.g. objectformat, reftables), will be confirmed by the specific Storer via new x/storage.ExtensionChecker interface. Failing to do so, it will be assumed that the extension is unsupported and the Open operation will return an error. This is a breaking change and it will force go-git to not be able to open repositories that it in fact doesn't really support. Conversaly, the error messages will be more useful (e.g. unknown extension vs object not found). Upstream refs: - https://git-scm.com/docs/git-config#Documentation/git-config.txt-extensions - https://git-scm.com/docs/gitrepository-layout#_git_repository_format_versions Signed-off-by: Paulo Gomes <pjbgf@linux.com>
pjbgf
mentioned this pull request
pjbgf added a commit to pjbgf/go-git that referenced this pull request
Feb 26, 2026The SHA256 implementation introduced a temporary ObjectFormatGetter interface that had two key goals: - Provide a way to access the ObjectFormat from a storer.Storer, without changing the existing API. - Be able to distinguish between storer.Storer implementations that support the objectformat extension. The PR go-git#1850 ensures that the storer.Storer being used supports the required objectformat. With that, this interface can be replaced by config.ConfigStorer, making the config the single source of truth for the objectformat. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
pjbgf added a commit to pjbgf/go-git that referenced this pull request
Feb 26, 2026The SHA256 implementation introduced a temporary ObjectFormatGetter interface that had two key goals: - Provide a way to access the ObjectFormat from a storer.Storer, without changing the existing API. - Be able to distinguish between storer.Storer implementations that support the objectformat extension. The PR go-git#1850 ensures that the storer.Storer being used supports the required objectformat. With that, this interface can be replaced by config.ConfigStorer, making the config the single source of truth for the objectformat. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
pjbgf added a commit to pjbgf/go-git that referenced this pull request
Mar 2, 2026Previous to go-git#1850, go-git was oblivious to Git extensions, which meant that at times it would try to handle repositories where the underlying feature was not fully supported. An example of that being worktreeConfig, meaning that any worktree specific config were being ignored. This commit adds that support to storage/filesystem, resulting into worktree configs being overlayed the local config, providing upstream parity with upstream Git. References: - https://git-scm.com/docs/git-worktree#_configuration_file Signed-off-by: Paulo Gomes <pjbgf@linux.com>
pjbgf added a commit to pjbgf/go-git that referenced this pull request
Mar 2, 2026Previous to go-git#1850, go-git was oblivious to Git extensions, which meant that at times it would try to handle repositories where the underlying feature was not fully supported. An example of that being worktreeConfig, meaning that any worktree specific config were being ignored. This commit adds that support to storage/filesystem, resulting into worktree configs being overlayed the local config, providing upstream parity with upstream Git. References: - https://git-scm.com/docs/git-worktree#_configuration_file Signed-off-by: Paulo Gomes <pjbgf@linux.com>
pjbgf added a commit to pjbgf/go-git that referenced this pull request
Mar 2, 2026Previous to go-git#1850, go-git was oblivious to Git extensions, which meant that at times it would try to handle repositories where the underlying feature was not fully supported. An example of that being worktreeConfig, meaning that any worktree specific config were being ignored. This commit adds that support to storage/filesystem, resulting into worktree configs being overlayed the local config, providing upstream parity with upstream Git. References: - https://git-scm.com/docs/git-worktree#_configuration_file Signed-off-by: Paulo Gomes <pjbgf@linux.com>
pjbgf added a commit to pjbgf/go-git that referenced this pull request
Mar 2, 2026Previous to go-git#1850, go-git was oblivious to Git extensions, which meant that at times it would try to handle repositories where the underlying feature was not fully supported. An example of that being worktreeConfig, meaning that any worktree specific config were being ignored. This commit adds that support to storage/filesystem, resulting into worktree configs being overlayed the local config, providing upstream parity with upstream Git. References: - https://git-scm.com/docs/git-worktree#_configuration_file Signed-off-by: Paulo Gomes <pjbgf@linux.com>
pjbgf
mentioned this pull request
pjbgf added a commit to pjbgf/go-git that referenced this pull request
Mar 3, 2026Previous to go-git#1850, go-git was oblivious to Git extensions, which meant that at times it would try to handle repositories where the underlying feature was not fully supported. An example of that being worktreeConfig, meaning that any worktree specific config were being ignored. This commit adds that support to storage/filesystem, resulting into worktree configs being overlayed the local config, providing upstream parity with upstream Git. References: - https://git-scm.com/docs/git-worktree#_configuration_file Signed-off-by: Paulo Gomes <pjbgf@linux.com>
pjbgf added a commit to pjbgf/go-git that referenced this pull request
Mar 3, 2026Previous to go-git#1850, go-git was oblivious to Git extensions, which meant that at times it would try to handle repositories where the underlying feature was not fully supported. An example of that being worktreeConfig, meaning that any worktree specific config were being ignored. This commit adds that support to storage/filesystem, resulting into worktree configs being overlayed the local config, providing upstream parity with upstream Git. References: - https://git-scm.com/docs/git-worktree#_configuration_file Signed-off-by: Paulo Gomes <pjbgf@linux.com>
cedric-appdirect pushed a commit to cedric-appdirect/go-git that referenced this pull request
Mar 12, 2026The SHA256 implementation introduced a temporary ObjectFormatGetter interface that had two key goals: - Provide a way to access the ObjectFormat from a storer.Storer, without changing the existing API. - Be able to distinguish between storer.Storer implementations that support the objectformat extension. The PR go-git#1850 ensures that the storer.Storer being used supports the required objectformat. With that, this interface can be replaced by config.ConfigStorer, making the config the single source of truth for the objectformat. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters