diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-05-02 14:24:05 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-05-02 14:24:05 -0700 |
commit | 3c383a30c854232b2a678110dd191b639a8b7989 (patch) | |
tree | 2cb164e470ca962978422638f86e42899c4fb23b /t/t3200-branch.sh | |
parent | Merge branch 'ky/branch-d-worktree' into maint (diff) | |
parent | set_worktree_head_symref(): fix error message (diff) | |
download | tgif-3c383a30c854232b2a678110dd191b639a8b7989.tar.xz |
Merge branch 'ky/branch-m-worktree' into maint
When "git worktree" feature is in use, "git branch -m" renamed a
branch that is checked out in another worktree without adjusting
the HEAD symbolic ref for the worktree.
* ky/branch-m-worktree:
set_worktree_head_symref(): fix error message
branch -m: update all per-worktree HEADs
refs: add a new function set_worktree_head_symref
Diffstat (limited to 't/t3200-branch.sh')
-rwxr-xr-x | t/t3200-branch.sh | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 508007fd37..f3e3b6cf2e 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -126,7 +126,28 @@ test_expect_success 'git branch -M foo bar should fail when bar is checked out' test_expect_success 'git branch -M baz bam should succeed when baz is checked out' ' git checkout -b baz && git branch bam && - git branch -M baz bam + git branch -M baz bam && + test $(git rev-parse --abbrev-ref HEAD) = bam +' + +test_expect_success 'git branch -M baz bam should succeed when baz is checked out as linked working tree' ' + git checkout master && + git worktree add -b baz bazdir && + git worktree add -f bazdir2 baz && + git branch -M baz bam && + test $(git -C bazdir rev-parse --abbrev-ref HEAD) = bam && + test $(git -C bazdir2 rev-parse --abbrev-ref HEAD) = bam +' + +test_expect_success 'git branch -M baz bam should succeed within a worktree in which baz is checked out' ' + git checkout -b baz && + git worktree add -f bazdir3 baz && + ( + cd bazdir3 && + git branch -M baz bam && + test $(git rev-parse --abbrev-ref HEAD) = bam + ) && + test $(git rev-parse --abbrev-ref HEAD) = bam ' test_expect_success 'git branch -M master should work when master is checked out' ' |