Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Kaseorg <andersk@mit.edu>2021-12-02 01:15:47 +0300
committerJunio C Hamano <gitster@pobox.com>2021-12-02 09:18:25 +0300
commit593a2a5d0639b4b4f91ff6e6ffb64e72020f8fd8 (patch)
tree2903e1a81584b4d98ec45d96134fbffefc517917 /t/t3200-branch.sh
parent9fdf4f1db422cc259e4a3ce0023a255102c6fa3b (diff)
branch: protect branches checked out in all worktrees
Refuse to force-move a branch over the currently checked out branch of any working tree, not just the current one. Signed-off-by: Anders Kaseorg <andersk@mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3200-branch.sh')
-rwxr-xr-xt/t3200-branch.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index e35e119bee..8a619d785e 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -168,6 +168,13 @@ test_expect_success 'git branch -M foo bar should fail when bar is checked out'
test_must_fail git branch -M bar foo
'
+test_expect_success 'git branch -M foo bar should fail when bar is checked out in worktree' '
+ git branch -f bar &&
+ test_when_finished "git worktree remove wt && git branch -D wt" &&
+ git worktree add wt &&
+ test_must_fail git branch -M bar wt
+'
+
test_expect_success 'git branch -M baz bam should succeed when baz is checked out' '
git checkout -b baz &&
git branch bam &&