From: Junio C Hamano Date: Sun, 10 Sep 2017 08:08:23 +0000 (+0900) Subject: Merge branch 'nd/worktree-kill-parse-ref' X-Git-Tag: v2.15.0-rc0~104 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/79553b94f966f3cec6156a68001650ca26a584c4 Merge branch 'nd/worktree-kill-parse-ref' "git branch -M a b" while on a branch that is completely unrelated to either branch a or branch b misbehaved when multiple worktree was in use. This has been fixed. * nd/worktree-kill-parse-ref: branch: fix branch renaming not updating HEADs correctly --- 79553b94f966f3cec6156a68001650ca26a584c4 diff --cc t/t3200-branch.sh index 51738fb969,c5c371888b..d971649979 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@@ -162,16 -145,19 +162,29 @@@ test_expect_success 'git branch -M baz grep "^0\{40\}.*$msg$" .git/logs/HEAD ' + test_expect_success 'git branch -M should leave orphaned HEAD alone' ' + git init orphan && + ( + cd orphan && + test_commit initial && + git checkout --orphan lonely && + grep lonely .git/HEAD && + test_path_is_missing .git/refs/head/lonely && + git branch -M master mistress && + grep lonely .git/HEAD + ) + ' + +test_expect_success 'resulting reflog can be shown by log -g' ' + oid=$(git rev-parse HEAD) && + cat >expect <<-EOF && + HEAD@{0} $oid $msg + HEAD@{2} $oid checkout: moving from foo to baz + EOF + git log -g --format="%gd %H %gs" -2 HEAD >actual && + test_cmp expect actual +' + 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 &&