git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: git@vger.kernel.org
Subject: Re: git am fails because of weird text in commit log
Date: Wed, 13 Jan 2021 12:33:21 -0800	[thread overview]
Message-ID: <xmqqzh1cwp9q.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <20210113085846-mutt-send-email-mst@kernel.org> (Michael S. Tsirkin's message of "Wed, 13 Jan 2021 09:01:16 -0500")

"Michael S. Tsirkin" <mst@redhat.com> writes:

> So someone sends me a patch with --- in the commit log, like this below.
> Result: git am gets confused and can't apply the patch.

Quite understandable.

> Shouldn't git format-patch at least complain about commit log
> like this, if not mangle it in some way?

It probably is too early to warn, mangle or quote in "git commit".
I agree with you that "git format-patch" would be the best step in a
typical workflow to warn, mangle or quote.

The solution would probably begin with identifying the lines in the
commit log that mailinfo.c::patchbreak() considers the beginning of
the patch part.  After finding such a line:

 - Warning is easy.  

 - Mangling the line by prefixing something like " " in front of it
   would also be easy.

 - Quoting thru to the end of "patch that shouldn't have been there"
   in possibly a reversible way is probably too hard.

Mangling or quoting should be hidden behind an option, I would
think.

Patches welcome.

Thanks.

      reply	other threads:[~2021-01-13 20:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-13 14:01 git am fails because of weird text in commit log Michael S. Tsirkin
2021-01-13 20:33 ` Junio C Hamano [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=xmqqzh1cwp9q.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).