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:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2019-06-20 12:55:21 +0300
committerJunio C Hamano <gitster@pobox.com>2019-06-20 23:31:22 +0300
commitd16dc428b47837cebd231de1fad76d9c307f34b0 (patch)
treeefc7815836fc4ba2ed2ffe6c544002818eb7ae75 /builtin/checkout.c
parentbcba406532725fcdf17d5a3d9c6585e8fc879021 (diff)
switch: allow to switch in the middle of bisect
In c45f0f525d (switch: reject if some operation is in progress, 2019-03-29), a check is added to prevent switching when some operation is in progress. The reason is it's often not safe to do so. This is true for merge, am, rebase, cherry-pick and revert, but not so much for bisect because bisecting is basically jumping/switching between a bunch of commits to pin point the first bad one. git-bisect suggests the next commit to test, but it's not wrong for the user to test a different commit because git-bisect cannot have the knowledge to know better. For this reason, allow to switch when bisecting (*). I considered if we should still prevent switching by default and allow it with --ignore-in-progress. But I don't think the prevention really adds anything much. If the user switches away by mistake, since we print the previous HEAD value, even if they don't know about the "-" shortcut, switching back is still possible. The warning will be printed on every switch while bisect is still ongoing, not the first time you switch away from bisect's suggested commit, so it could become a bit annoying. (*) of course when it's safe to do so, i.e. no loss of local changes and stuff. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/checkout.c')
-rw-r--r--builtin/checkout.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index bed79ae595c..f884d27f1f5 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -1326,9 +1326,7 @@ static void die_if_some_operation_in_progress(void)
"Consider \"git revert --quit\" "
"or \"git worktree add\"."));
if (state.bisect_in_progress)
- die(_("cannot switch branch while bisecting\n"
- "Consider \"git bisect reset HEAD\" "
- "or \"git worktree add\"."));
+ warning(_("you are switching branch while bisecting"));
}
static int checkout_branch(struct checkout_opts *opts,