aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2023-04-08 01:17:22 -0400
committerKyle Meyer <kyle@kyleam.com>2023-04-08 01:17:22 -0400
commitbeb3d6cae23e10a92797ac3c6d9f581d75e59cc3 (patch)
tree1546c7344d7176f68fe4f03e9d7da11f8e523341
parent9b2bc1cb0116881433c6b748141a878460662b33 (diff)
magit-wash-bisect-log: Ignore '# status:' lines
As of Git v2.37.0, bisect outputs a status line if either the good or bad revision isn't specified. For example: $ git bisect start status: waiting for both good and bad commits If a user starts a bisect from the command line and then visits the repo with Magit, these status lines trigger a parse error. (Starting a bisect from Magit never emits these status messages because both revisions are always specified upfront.) There's not much value in parsing and displaying this info, so teach magit-wash-bisect-log to detect and delete these lines when processing the 'git bisect log' output. Fixes #4787.
-rw-r--r--lisp/magit-bisect.el31
1 files changed, 17 insertions, 14 deletions
diff --git a/lisp/magit-bisect.el b/lisp/magit-bisect.el
index fd93271..8713771 100644
--- a/lisp/magit-bisect.el
+++ b/lisp/magit-bisect.el
@@ -284,20 +284,23 @@ bisect run'."
(defun magit-wash-bisect-log (_args)
(let (beg)
(while (progn (setq beg (point-marker))
- (re-search-forward "^\\(git bisect [^\n]+\n\\)" nil t))
- (magit-bind-match-strings (heading) nil
- (magit-delete-match)
- (save-restriction
- (narrow-to-region beg (point))
- (goto-char (point-min))
- (magit-insert-section (bisect-item heading t)
- (insert (propertize heading 'font-lock-face
- 'magit-section-secondary-heading))
- (magit-insert-heading)
- (magit-wash-sequence
- (apply-partially #'magit-log-wash-rev 'bisect-log
- (magit-abbrev-length)))
- (insert ?\n)))))
+ (re-search-forward
+ "^\\(\\(?:git bisect\\|# status:\\) [^\n]+\n\\)" nil t))
+ (if (string-prefix-p "# status:" (match-string 1))
+ (magit-delete-match)
+ (magit-bind-match-strings (heading) nil
+ (magit-delete-match)
+ (save-restriction
+ (narrow-to-region beg (point))
+ (goto-char (point-min))
+ (magit-insert-section (bisect-item heading t)
+ (insert (propertize heading 'font-lock-face
+ 'magit-section-secondary-heading))
+ (magit-insert-heading)
+ (magit-wash-sequence
+ (apply-partially #'magit-log-wash-rev 'bisect-log
+ (magit-abbrev-length)))
+ (insert ?\n))))))
(when (re-search-forward
"# first bad commit: \\[\\([a-z0-9]\\{40,\\}\\)\\] [^\n]+\n" nil t)
(magit-bind-match-strings (hash) nil