diff options
| author | Kyle Meyer <kyle@kyleam.com> | 2021-06-19 23:47:22 -0400 |
|---|---|---|
| committer | Kyle Meyer <kyle@kyleam.com> | 2021-06-20 00:35:53 -0400 |
| commit | f592e367d7602106d6f8f8349148bd31a94ba231 (patch) | |
| tree | bd86e3b5d082ab5cdf24b786f33af1913bc4cf87 | |
| parent | d74095dd2ccd6ba388b333028f54935c11a305d2 (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.
| -rw-r--r-- | Documentation/RelNotes/3.1.0.org | 3 | ||||
| -rw-r--r-- | lisp/magit-bisect.el | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/Documentation/RelNotes/3.1.0.org b/Documentation/RelNotes/3.1.0.org index c68d58a..d9a2307 100644 --- a/Documentation/RelNotes/3.1.0.org +++ b/Documentation/RelNotes/3.1.0.org @@ -7,3 +7,6 @@ - ~magit-blame~ didn't account for quoted file names when parsing output from ~git blame~. #4400 + +- A regression in v3.0.0 prevented ~magit-bisect-run~ from executing + ~git bisect run~ unless ~magit-bisect-start~ was called beforehand. 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) |
