summaryrefslogtreecommitdiff
path: root/builtin/branch.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-05-02 14:24:05 -0700
committerJunio C Hamano <gitster@pobox.com>2016-05-02 14:24:05 -0700
commit3c383a30c854232b2a678110dd191b639a8b7989 (patch)
tree2cb164e470ca962978422638f86e42899c4fb23b /builtin/branch.c
parenta4127142c621c03cb0967d298ac0ea1e673162fd (diff)
parent18eb3a9ce7c544e74d424b942c5a5c9720c20112 (diff)
downloadgit-3c383a30c854232b2a678110dd191b639a8b7989.tar.gz
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 '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);