Merge branch 'es/do-not-let-rebase-switch-to-protected-branch'
"git rebase BASE BRANCH" rebased/updated the tip of BRANCH and checked it out, even when the BRANCH is checked out in a different worktree. This has been corrected. * es/do-not-let-rebase-switch-to-protected-branch: rebase: refuse to switch to branch already checked out elsewhere t3400: make test clean up after itself
This commit is contained in:
@ -2044,10 +2044,11 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
|
||||
/* Is it a local branch? */
|
||||
strbuf_reset(&buf);
|
||||
strbuf_addf(&buf, "refs/heads/%s", branch_name);
|
||||
if (!read_ref(buf.buf, &options.orig_head))
|
||||
if (!read_ref(buf.buf, &options.orig_head)) {
|
||||
die_if_checked_out(buf.buf, 1);
|
||||
options.head_name = xstrdup(buf.buf);
|
||||
/* If not is it a valid ref (branch or commit)? */
|
||||
else if (!get_oid(branch_name, &options.orig_head))
|
||||
} else if (!get_oid(branch_name, &options.orig_head))
|
||||
options.head_name = NULL;
|
||||
else
|
||||
die(_("fatal: no such branch/commit '%s'"),
|
||||
|
Reference in New Issue
Block a user