Re: Re* [RFH] adding test coverage for contrib/ in CI jobs
From: Junio C Hamano <hidden>
Date: 2026-02-04 19:55:19
Colin Stagner [off-list ref] writes:
I'll see what I can do about any remaining failures. I'd like to improve the test coverage for subtree split. split has a lot of complicated logic that needs to be preserved across updates.
Thanks.
Subject: contrib/subtree: fix tests with reftable backend
One git-subtree test-case relies on git internals to infer the
default branch name. This test fails with the new reftable
backend.
GIT_TEST_DEFAULT_REF_FORMAT=reftable \
meson test t7900-subtree
This test script already sets
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
which eliminates the need to infer a branch name at runtime.
Hardcode the branch name.Makes sense. I didn't read the test script carefully enough to be certain that we were on the initial branch when the defaultBranch computation happened. Thanks. Will replace my hack with this version.
quoted hunk
Signed-off-by: Colin Stagner <redacted> --- contrib/subtree/t/t7900-subtree.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh index 316dc5269e..e7040718f2 100755 --- a/contrib/subtree/t/t7900-subtree.sh +++ b/contrib/subtree/t/t7900-subtree.sh@@ -1597,7 +1597,6 @@ test_expect_success 'push split to subproj' ' test_expect_success 'subtree descendant check' ' subtree_test_create_repo "$test_count" && - defaultBranch=$(sed "s,ref: refs/heads/,," "$test_count/.git/HEAD") && test_create_commit "$test_count" folder_subtree/a && ( cd "$test_count" &&@@ -1614,7 +1613,7 @@ test_expect_success 'subtree descendant check' ' ( cd "$test_count" && git cherry-pick $cherry && - git checkout $defaultBranch && + git checkout main && git merge -m "merge should be kept on subtree" branch && git branch no_subtree_work_branch ) &&@@ -1626,10 +1625,10 @@ test_expect_success 'subtree descendant check' ' test_create_commit "$test_count" not_a_subtree_change && ( cd "$test_count" && - git checkout $defaultBranch && + git checkout main && git merge -m "merge should be skipped on subtree" no_subtree_work_branch && - git subtree split --prefix folder_subtree/ --branch subtree_tip $defaultBranch && + git subtree split --prefix folder_subtree/ --branch subtree_tip main && git subtree split --prefix folder_subtree/ --branch subtree_branch branch && test $(git rev-list --count subtree_tip..subtree_branch) = 0 )