rebase: refuse to switch to branch already checked out elsewhere
commitb5cabb4a967fa455378ee7ddfa831a9bf0244753
authorEric Sunshine <sunshine@sunshineco.com>
Sun, 23 Feb 2020 10:14:07 +0000 (23 05:14 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 24 Feb 2020 19:34:41 +0000 (24 11:34 -0800)
treeff679012db6fa875e43265ced26a6e1548872b1c
parentdf126ca14269efaf4d28453743a386be81ebec85
rebase: refuse to switch to branch already checked out elsewhere

The invocation "git rebase <upstream> <branch>" switches to <branch>
before performing the rebase operation. However, unlike git-switch,
git-checkout, and git-worktree which all refuse to switch to a branch
that is already checked out in some other worktree, git-rebase switches
to <branch> unconditionally. Curb this careless behavior by making
git-rebase also refuse to switch to a branch checked out elsewhere.

Reported-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/rebase.c
t/t3400-rebase.sh