Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-03-05 21:43:03 +0300
committerJunio C Hamano <gitster@pobox.com>2020-03-05 21:43:03 +0300
commita0ab37de61c9ac7f57105d6b170947abaf1b642c (patch)
tree25d416ba467d741ee231dab53392393b795875f4 /builtin/rebase.c
parent4a2e91db652e197803c6f29e2c2f1c9dfbc16506 (diff)
parentb5cabb4a967fa455378ee7ddfa831a9bf0244753 (diff)
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
Diffstat (limited to 'builtin/rebase.c')
-rw-r--r--builtin/rebase.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin/rebase.c b/builtin/rebase.c
index ffa467aad52..7bff0c87bc0 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -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'"),