aboutsummaryrefslogtreecommitdiff
path: root/lisp/magit-bisect.el
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2021-06-19 23:47:22 -0400
committerKyle Meyer <kyle@kyleam.com>2021-06-20 00:35:53 -0400
commitf592e367d7602106d6f8f8349148bd31a94ba231 (patch)
treebd86e3b5d082ab5cdf24b786f33af1913bc4cf87 /lisp/magit-bisect.el
parentd74095dd2ccd6ba388b333028f54935c11a305d2 (diff)
magit-bisect-run: Don't start bisect asynchronously
As of 56354898 (Run "git bisect" asynchronously, 2019-04-20), magit-git-bisect runs `git bisect' calls asynchronously. While beneficial in most spots, this switch creates a race if magit-bisect-run is called when a bisect hasn't been started. In that case, magit-bisect-run calls magit-bisect-start (which calls the asynchronous magit-git-bisect underneath) and then immediately follows with a `git bisect run' call via magit-git-bisect. This second call depends on the first asynchronous call completing, so it leads to a "Not bisecting" user error. That's quickly buried when the magit-bisect-start call finishes, and the end result looks like the user just called magit-bisect-start. Before 56354898, magit-git-bisect used the now removed magit-run-git-with-logfile. Inline that code for magit-bisect-run's start call.
Diffstat (limited to 'lisp/magit-bisect.el')
-rw-r--r--lisp/magit-bisect.el9
1 files changed, 8 insertions, 1 deletions
diff --git a/lisp/magit-bisect.el b/lisp/magit-bisect.el
index 66aca68..fe43029 100644
--- a/lisp/magit-bisect.el
+++ b/lisp/magit-bisect.el
@@ -196,7 +196,14 @@ bisect run'."
(magit-bisect-start-read-args))))
(cons (read-shell-command "Bisect shell command: ") args)))
(when (and bad good)
- (magit-bisect-start bad good args))
+ ;; Avoid `magit-git-bisect' because it's asynchronous, but the
+ ;; next `git bisect run' call requires the bisect to be started.
+ (magit-with-toplevel
+ (apply #'magit-process-file magit-git-executable
+ nil (list :file (magit-git-dir "BISECT_CMD_OUTPUT")) nil
+ (magit-process-git-arguments
+ (list "bisect" "start" bad good args)))
+ (magit-refresh)))
(magit-git-bisect "run" (list shell-file-name shell-command-switch cmdline)))
(defun magit-git-bisect (subcommand &optional args no-assert)