all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Kévin Le Gouguec" <kevin.legouguec@gmail.com>
To: Luis Henriques <henrix@camandro.org>
Cc: 72059@debbugs.gnu.org, Robert Pluim <rpluim@gmail.com>
Subject: bug#72059: [PATCH] Ensure that git diffs without signature (--) are properly identified
Date: Fri, 12 Jul 2024 08:34:25 +0200	[thread overview]
Message-ID: <87msmnnmoe.fsf@gmail.com> (raw)
In-Reply-To: <87cynkm0q8.fsf@orpheu.olymp> (Luis Henriques's message of "Thu,  11 Jul 2024 16:01:35 +0100")

Luis Henriques <henrix@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.





  reply	other threads:[~2024-07-12  6:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-11 12:20 bug#72059: [PATCH] Ensure that git diffs without signature (--) are properly identified Luis Henriques
2024-07-11 13:36 ` Robert Pluim
2024-07-11 15:01   ` Luis Henriques
2024-07-12  6:34     ` Kévin Le Gouguec [this message]
2024-07-12  6:51       ` Juri Linkov
2024-07-12  8:28         ` Robert Pluim
2024-07-12  8:53         ` Luís Henriques
2024-07-12 17:55           ` Juri Linkov
2024-07-11 13:57 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87msmnnmoe.fsf@gmail.com \
    --to=kevin.legouguec@gmail.com \
    --cc=72059@debbugs.gnu.org \
    --cc=henrix@camandro.org \
    --cc=rpluim@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.