summaryrefslogtreecommitdiff
path: root/builtin/branch.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-04-18 10:48:11 -0700
committerJunio C Hamano <gitster@pobox.com>2016-04-18 10:48:11 -0700
commit741a6942eb241dfc1317b7692381fc41dbb92501 (patch)
treed716da40ac03d8fbe811aeebacd9168d247ba186 /builtin/branch.c
parentb8b4d93100651876299eabaf76248510e616fab3 (diff)
parent18eb3a9ce7c544e74d424b942c5a5c9720c20112 (diff)
downloadgit-741a6942eb241dfc1317b7692381fc41dbb92501.tar.gz
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 'builtin/branch.c')
-rw-r--r--builtin/branch.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/builtin/branch.c b/builtin/branch.c
index 8885d9f8e2..de6df09ed3 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -558,8 +558,7 @@ static void rename_branch(const char *oldname, const char *newname, int force)
if (recovery)
warning(_("Renamed a misnamed branch '%s' away"), oldref.buf + 11);
- /* no need to pass logmsg here as HEAD didn't really move */
- if (!strcmp(oldname, head) && create_symref("HEAD", newref.buf, NULL))
+ if (replace_each_worktree_head_symref(oldref.buf, newref.buf))
die(_("Branch renamed to %s, but HEAD is not updated!"), newname);
strbuf_addf(&oldsection, "branch.%s", oldref.buf + 11);