diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-04-18 19:48:11 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-04-18 19:48:11 +0200 |
commit | 741a6942eb241dfc1317b7692381fc41dbb92501 (patch) | |
tree | d716da40ac03d8fbe811aeebacd9168d247ba186 /t | |
parent | Merge branch 'maint' (diff) | |
parent | set_worktree_head_symref(): fix error message (diff) | |
download | git-741a6942eb241dfc1317b7692381fc41dbb92501.tar.xz git-741a6942eb241dfc1317b7692381fc41dbb92501.zip |
Merge branch 'ky/branch-m-worktree'
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')
-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' ' |