All of lore.kernel.org
 help / color / mirror / Atom feed
From: "René Scharfe" <l.s.r@web.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>, git@vger.kernel.org
Subject: Re: bug? illegal text in commit log
Date: Fri, 7 Feb 2020 21:30:59 +0100	[thread overview]
Message-ID: <3cd137fa-b879-9850-0b81-5f907623ee6d@web.de> (raw)
In-Reply-To: <xmqqlfpf3qh3.fsf@gitster-ct.c.googlers.com>

Am 07.02.20 um 06:40 schrieb Junio C Hamano:
> René Scharfe <l.s.r@web.de> writes:
>
>>>  * the first line that
>>>    - begins with "diff " or "Index", or
>>>    - is "---" (and nothing else on the line)
>>>    signals that the line no longer is part of the log
>>>
>>>  * but if it finds a line that begins with "diff --git" (or
>>>    optionally just "diff "), do not blindly assume that is the end
>>>    of the log, and instead try to find the first "---" line.  If
>>>    there isn't any "---", then take that "diff" line the beginning
>>>    of the patch, but if there is, "---" is the end of the message.
>>>
>>> The latter rule is the new one.  And there is no need to change
>>> format-patch output.
>>
>> I like this idea.  It will probably be tricky to implement, though,
>> as mailinfo currently goes through the input line by line and has no
>> easy way to look ahead.
>>
>> René
>
> Another issue with the approach is that it will be fooled if the
> patch is about removing a line with double-dash and nothing else
> on it.  Unless we can trust the numbers on hunk header lines in the
> "sample patch" embedded in the log message, we cannot reliably tell
> if a line with "---" on it is such a line, or the true end of the
> log message.

Such a patch could be cited in the message as well, with or without a
correct hunk header.

Full patches in messages might be rare, lines starting with "diff -"
(perhaps talking about a certain diff invocation) or "Index: " (in a
language where nouns are capitalized) are probably more likely to occur
in the wild.

My problem with the situation is that innocent-looking commits that
can be diffed, pushed and pulled suddenly fall apart when used in a
mail-based workflow or with rebase am.

Supporting hand-edited messages is especially hard.  Git cannot warn
the sender, as it's out of the loop.

Bottling the message by adding some kind of header would be watertight,
but senders of patch-like messages would need to take care to use a
large enough bottle (update the header).  Clever rules can cover
common cases, but will leak sometimes and might be hard to implement.

René

  reply	other threads:[~2020-02-07 20:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-04  6:14 bug? illegal text in commit log Michael S. Tsirkin
2020-02-04 21:10 ` René Scharfe
2020-02-04 21:25   ` Junio C Hamano
2020-02-06  6:34     ` Michael S. Tsirkin
2020-02-06 16:17       ` Junio C Hamano
2020-02-06 16:45   ` Junio C Hamano
2020-02-06 17:30     ` René Scharfe
2020-02-07  5:40       ` Junio C Hamano
2020-02-07 20:30         ` René Scharfe [this message]
2020-02-12  2:24           ` Jeff King
2020-02-06 23:56     ` Michael S. Tsirkin
2020-02-07 11:02     ` Pratyush Yadav
2020-02-07 20:31       ` René Scharfe
2020-02-07 21:12         ` Junio C Hamano

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=3cd137fa-b879-9850-0b81-5f907623ee6d@web.de \
    --to=l.s.r@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mst@redhat.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.
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.