aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/bisect.c
diff options
context:
space:
mode:
authorRubén Justo <rjusto@gmail.com>2023-01-22 02:38:10 +0100
committerJunio C Hamano <gitster@pobox.com>2023-01-22 09:23:11 -0800
commit7fb89047cc3957bf829233786c00edd5d87f0225 (patch)
tree7e74d9e7c68e3511fc939f6750d982c39d06a601 /builtin/bisect.c
parent56c8fb1e95377900ec9d53c07886022af0a5d3c2 (diff)
downloadgit-7fb89047cc3957bf829233786c00edd5d87f0225.tar.gz
bisect: fix "reset" when branch is checked out elsewhere
Since 1d0fa89 (checkout: add --ignore-other-wortrees, 2015-01-03) we have a safety valve in checkout/switch to prevent the same branch from being checked out simultaneously in multiple worktrees. If a branch is bisected in a worktree while also being checked out in another worktree; when the bisection is finished, checking out the branch back in the current worktree may fail. Let's teach bisect to use the "--ignore-other-worktrees" flag. Signed-off-by: Rubén Justo <rjusto@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/bisect.c')
-rw-r--r--builtin/bisect.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/bisect.c b/builtin/bisect.c
index 7301740267..e405fff9e9 100644
--- a/builtin/bisect.c
+++ b/builtin/bisect.c
@@ -244,7 +244,8 @@ static int bisect_reset(const char *commit)
struct child_process cmd = CHILD_PROCESS_INIT;
cmd.git_cmd = 1;
- strvec_pushl(&cmd.args, "checkout", branch.buf, "--", NULL);
+ strvec_pushl(&cmd.args, "checkout", "--ignore-other-worktrees",
+ branch.buf, "--", NULL);
if (run_command(&cmd)) {
error(_("could not check out original"
" HEAD '%s'. Try 'git bisect"