In t1302 we exercise logic around "core.repositoryFormatVersion" and extensions. These tests are not particularly robust against extensions like the newly introduced "refStorage" extension. Refactor the tests to be more robust: - Check the DEFAULT_REPO_FORMAT prereq to determine the expected repository format version. This helps to ensure that we only need to update the prereq in a central place when new extensions are added. - Use a separate repository to rewrite ".git/config" to test combinations of the repository format version and extensions. This ensures that we don't break the main test repository. - Do not rewrite ".git/config" when exercising the "preciousObjects" extension. Signed-off-by: Patrick Steinhardt --- t/t1302-repo-version.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/t/t1302-repo-version.sh b/t/t1302-repo-version.sh index 179474fa65..fb30c87e1b 100755 --- a/t/t1302-repo-version.sh +++ b/t/t1302-repo-version.sh @@ -28,7 +28,12 @@ test_expect_success 'setup' ' ' test_expect_success 'gitdir selection on normal repos' ' - test_oid version >expect && + if test_have_prereq DEFAULT_REPO_FORMAT + then + echo 0 + else + echo 1 + fi >expect && git config core.repositoryformatversion >actual && git -C test config core.repositoryformatversion >actual2 && test_cmp expect actual && @@ -79,8 +84,13 @@ mkconfig () { while read outcome version extensions; do test_expect_success "$outcome version=$version $extensions" " - mkconfig $version $extensions >.git/config && - check_${outcome} + test_when_finished 'rm -rf extensions' && + git init extensions && + ( + cd extensions && + mkconfig $version $extensions >.git/config && + check_${outcome} + ) " done <<\EOF allow 0 @@ -94,7 +104,8 @@ allow 1 noop-v1 EOF test_expect_success 'precious-objects allowed' ' - mkconfig 1 preciousObjects >.git/config && + git config core.repositoryformatversion 1 && + git config extensions.preciousObjects 1 && check_allow ' -- 2.43.GIT