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. Signed-off-by: Colin Stagner <ask+git@howdoi.land> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Colin Stagner committed
Feb 3, 2026 at 22:38 UTC
486386c687609603a2c1ebc434384d1e380908ae
1 file changed
+3
-4
contrib/subtree/t/t7900-subtree.sh
+3
-4
@@ -1597,7 +1597,6 @@ test_expect_success 'push split to subproj' '
1597
1598
test_expect_success 'subtree descendant check' '
1599
subtree_test_create_repo "$test_count" &&
1600
- defaultBranch=$(sed "s,ref: refs/heads/,," "$test_count/.git/HEAD") &&
1600
test_create_commit "$test_count" folder_subtree/a &&
1601
(
1602
cd "$test_count" &&
@@ -1614,7 +1613,7 @@ test_expect_success 'subtree descendant check' '
1613
(
1614
cd "$test_count" &&
1615
git cherry-pick $cherry &&
1617
- git checkout $defaultBranch &&
1616
+ git checkout main &&
1617
git merge -m "merge should be kept on subtree" branch &&
1618
git branch no_subtree_work_branch
1619
) &&
@@ -1626,10 +1625,10 @@ test_expect_success 'subtree descendant check' '
1625
test_create_commit "$test_count" not_a_subtree_change &&
1626
(
1627
cd "$test_count" &&
1629
- git checkout $defaultBranch &&
1628
+ git checkout main &&
1629
git merge -m "merge should be skipped on subtree" no_subtree_work_branch &&
1630
1632
- git subtree split --prefix folder_subtree/ --branch subtree_tip $defaultBranch &&
1631
+ git subtree split --prefix folder_subtree/ --branch subtree_tip main &&
1632
git subtree split --prefix folder_subtree/ --branch subtree_branch branch &&
1633
test $(git rev-list --count subtree_tip..subtree_branch) = 0
1634
)