From: Junio C Hamano Date: Mon, 23 Oct 2017 05:14:16 +0000 (+0900) Subject: Merge branch 'nd/worktree-kill-parse-ref' into maint X-Git-Tag: v2.14.3~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5253ad109af7691d0b0fb3c9670aaaf775412c72;p=git Merge branch 'nd/worktree-kill-parse-ref' into maint "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 --- 5253ad109af7691d0b0fb3c9670aaaf775412c72 diff --cc t/t3200-branch.sh index 9d707d2a40,c5c371888b..5fc2fb425b --- 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 &&