Skip to content

Commit 18ea595

Browse files
derrickstoleegitster
authored andcommitted
t2407: test branches currently using apply backend
The tests in t2407 that verify the branch_checked_out() helper in the case of bisects and rebases were added by 9347303 (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1bec4d1 commit 18ea595

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

t/t2407-worktree-heads.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,17 @@ test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in bisect' '
6161
grep "cannot force update the branch '\''wt-4'\'' checked out at.*wt-4" err
6262
'
6363

64-
test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in rebase' '
64+
test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in rebase (apply)' '
65+
test_when_finished git -C wt-2 rebase --abort &&
66+
67+
# This will fail part-way through due to a conflict.
68+
test_must_fail git -C wt-2 rebase --apply conflict-2 &&
69+
70+
test_must_fail git branch -f wt-2 HEAD 2>err &&
71+
grep "cannot force update the branch '\''wt-2'\'' checked out at.*wt-2" err
72+
'
73+
74+
test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in rebase (merge)' '
6575
test_when_finished git -C wt-2 rebase --abort &&
6676
6777
# This will fail part-way through due to a conflict.

0 commit comments

Comments
 (0)