GNU bug report logs - #72059
[PATCH] Ensure that git diffs without signature (--) are properly identified

Previous Next

Package: emacs;

Reported by: Luis Henriques <henrix <at> camandro.org>

Date: Thu, 11 Jul 2024 13:10:03 UTC

Severity: normal

Tags: patch

Merged with 72058

Fixed in version 31.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
To: Luis Henriques <henrix <at> camandro.org>
Cc: 72059 <at> debbugs.gnu.org, Robert Pluim <rpluim <at> gmail.com>
Subject: bug#72059: [PATCH] Ensure that git diffs without signature (--) are properly identified
Date: Fri, 12 Jul 2024 08:34:25 +0200
Luis Henriques <henrix <at> camandro.org> writes:

>> Also, how does this work for messages containing multiple patches? Is
>> detection of just the start of each patch enough?
>
> Do you have an example where this happens?  I don't think I ever saw an
> email with two inlined patches.  But obviously, with this patch applied,
> everything from the "^diff --git " up to the end of the email will be a
> diff.  Just like everything after "^=== modified file " or "^Index: " will
> be a diff.

FWIW, I've had this uncommitted kludge in my config for some time now:

  @@ -403,6 +431,9 @@

   ;; TODO: handle inline diffs in Gnus articles; maybe tweaking
   ;; mm-uu-type-alist?
  +(with-eval-after-load 'mm-uu
  +  (setf (nth 1 (alist-get 'git-format-patch mm-uu-type-alist))
  +        "^-- \\|^$"))

Past Me wasn't considerate enough to add a Message-ID demonstrating
where this fixes problems.  An earlier version of that config featured:

  ;; Gerrit does not include trailing "-- ".
  (with-eval-after-load 'mm-uu
    (setf (nth 1 (alist-get 'git-format-patch mm-uu-type-alist))
          "^-- \\|\\'"))

Past Me eventually ditched this for being, citing the commit message,
"too flaky".  Again, did not bother to add a reference to a problematic
sample 🙄

I think the logic behind "^-- \\|^$" is that ^$ ought to find the end of
a "very-inlined patch" (i.e. not "attached", not even as an inlined
part; think 'C-x v d', 'C-x h' 'M-w', 'C-x o', 'C-y') because even empty
context lines have a leading space…

… but that's just guesswork.  Thought it'd be worth mentioning, but feel
free to ignore the noise if not helpful.




This bug report was last modified 351 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.