]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t2407: test branches currently using apply backend
authorDerrick Stolee <derrickstolee@github.com>
Tue, 19 Jul 2022 18:33:34 +0000 (18:33 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 19 Jul 2022 19:49:03 +0000 (12:49 -0700)
The tests in t2407 that verify the branch_checked_out() helper in the
case of bisects and rebases were added by 9347303db89 (branch: check for
bisects and rebases, 2022-06-08). However, that commit failed to check
for rebases that are using the 'apply' backend.

Add a test that checks the apply backend. The implementation was already
correct here, but it is good to have regression tests before modifying
the implementation further.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t2407-worktree-heads.sh

index 100ab286d5c2979f0529976b02d4c011c8f31bc4..a67ce5fb003f71b06a0d58724dca4939102e3465 100755 (executable)
@@ -61,7 +61,17 @@ test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in bisect' '
        grep "cannot force update the branch '\''wt-4'\'' checked out at.*wt-4" err
 '
 
-test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in rebase' '
+test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in rebase (apply)' '
+       test_when_finished git -C wt-2 rebase --abort &&
+
+       # This will fail part-way through due to a conflict.
+       test_must_fail git -C wt-2 rebase --apply conflict-2 &&
+
+       test_must_fail git branch -f wt-2 HEAD 2>err &&
+       grep "cannot force update the branch '\''wt-2'\'' checked out at.*wt-2" err
+'
+
+test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in rebase (merge)' '
        test_when_finished git -C wt-2 rebase --abort &&
 
        # This will fail part-way through due to a conflict.