From: "Michael S. Tsirkin" <mst@redhat.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "René Scharfe" <l.s.r@web.de>, git@vger.kernel.org
Subject: Re: bug? illegal text in commit log
Date: Thu, 6 Feb 2020 01:34:11 -0500 [thread overview]
Message-ID: <20200206012854-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <xmqqimkm6o4r.fsf@gitster-ct.c.googlers.com>
On Tue, Feb 04, 2020 at 01:25:40PM -0800, Junio C Hamano wrote:
> René Scharfe <l.s.r@web.de> writes:
>
> > Am 04.02.20 um 07:14 schrieb Michael S. Tsirkin:
> >> It seems that it's not too hard to make commits such that
> >> the standard way of git format-patch -> email -> git am
> >> fails.
> >
> >> A work around is "don't do it" - avoid putting anything that looks like
> >> a unified diff in the commit log.
> >>
> >> However:
> >> - Users don't know what other restrictions exist
> >> - User sending the patch has no way to detect failure,
> >> it's only visible to user receiving the patch
> >
> > Putting a diff in a commit message can be useful, and forbidding it is
> > hard to justify.
> >
> >> Ideas:
> >> - validate commit log and warn users?
> >
> > That's only better than the status quo insofar it turns the issue from
> > a hidden pitfall into an open one.
> >
> >> - find a way to escape text in git format-patch, and unescape in git am?
> >
> > Like a Lines: header specifying the number of lines in the commit message?
>
> I think the existing practice is to indent such a diff in the
> message by a few characters.
So you are for validating commit log and warning users then?
> And I think that makes sense even
> without counting its value "as a workaround"---we indent materials
> inserted in the message for illustration, and a block of diff is
> just that.
It might be intended for other purposes, for example instructions:
To try out the new foobar flag, execute the following script:
git apply --foobar << EOF
--- a.txt 2020-02-04 01:09:27.927026571 -0500
+++ c.txt 2020-02-04 01:06:57.404688233 -0500
@@ -1 +1 @@
-AA
+BB
EOF
indenting would break the script, and make it harder for users
to follow the instructions.
--
MST
next prev parent reply other threads:[~2020-02-06 6:34 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 [this message]
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
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=20200206012854-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=l.s.r@web.de \
/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.