GNU bug report logs -
#75884
29.4; Dash character "-" appears as diff when it is the leading character in a line in a patch
Previous Next
Reported by: Husain Alshehhi <husain <at> alshehhi.io>
Date: Mon, 27 Jan 2025 03:41:02 UTC
Severity: minor
Tags: confirmed
Found in version 29.4
Fixed in version 31.1
Done: Stefan Kangas <stefankangas <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 75884 <at> debbugs.gnu.org (full text, mbox):
Hello,
On Sat 08 Feb 2025 at 11:32am +02, Eli Zaretskii wrote:
>> Date: Sun, 26 Jan 2025 21:39:35 -0600
>> From: Husain Alshehhi <husain <at> alshehhi.io>
>>
>> diff-mode does not handle a patch very well. In particular, if a patch
>> contains the commit message, and if the commit message contains a dash
>> character "-" at the beginning of a line, diff-mode interprets this as a
>> diff rather than part of the commit message.
>>
>> To replicate this bug: copy the following in a file (e.g. test.patch),
>> open it in diff-mode, and you will see that the line "- unordered lists"
>> shows up in `diff-indicator-removed' face:
>
> I also see the final "--" line in that face, FWIW.
>
> Dmitry, Juri, Sean: any comments or suggestions?
For patches generated by git, indeed, anything before the first hunk
should not be fontified as though it were a patch.
Similarly we should look for a "-- " line at the end of the message and
treat it as an e-mail signature.
But one question I immediately have is how much of this is Git-specific.
Is there some specification of the unified diff format anywhere?
Could there be non-Git unidifed diffs this would break?
--
Sean Whitton
This bug report was last modified 130 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.