Re: [PATCH 2/2] repository: allow repository format upgrade with extensions
From: Junio C Hamano <hidden>
Date: 2020-07-16 20:27:30
Junio C Hamano [off-list ref] writes:
Jeff King [off-list ref] writes:quoted
Hmm, this is actually a bit trickier than I expected because of the way the code is written. It's much easier to complain about extensions in a v0 repository than it is to ignore them. But I'm not sure if that isn't the right way to go anyway. The patch I came up with is below (and goes on top of Jonathan's). Even if we decide this is the right direction, it can definitely happen post-v2.28.It must happen already in 'seen' if we want to keep bc/sha-2-part-3 with us, though ;-)
FWIW, I needed to adjust t0001 while merging the SHA-2 topic. The internal use of "git config" via test_config triggers the "this is not a Git repository as the value of repositoryformatversion and the defined set of extensions are incompatible". diff --cc t/t0001-init.sh index 6d2467995e,34d2064660..ff538c0eed
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
...
-test_expect_success 'extensions.objectFormat is not honored with repo version 0' '
++test_expect_success 'extensions.objectFormat would cause an error in repo version 0' '
+ git init --object-format=sha256 explicit-v0 &&
- test_config -C explicit-v0 core.repositoryformatversion 0 &&
- git -C explicit-v0 rev-parse --show-object-format >actual &&
- echo sha1 >expected &&
- test_cmp expected actual
++ v=$(git config --file=explicit-v0/.git/config core.repositoryformatversion 0) &&
++ test_when_finished "
++ git config --file=explicit-v0/.git/config core.repositoryformatversion $v
++ " &&
++ git config --file=explicit-v0/.git/config core.repositoryformatversion 0 &&
++ test_must_fail git -C explicit-v0 rev-parse --show-object-format >actual
+ '