From: Junio C Hamano <gitster@pobox.com>
To: Phillip Wood <phillip.wood123@gmail.com>
Cc: Matheus Tavares <matheus.bernardino@usp.br>,
git@vger.kernel.org, avarab@gmail.com, l.s.r@web.de
Subject: Re: [PATCH v2 2/2] format-patch: warn if commit msg contains a patch delimiter
Date: Wed, 07 Sep 2022 11:36:25 -0700 [thread overview]
Message-ID: <xmqqa67buj4m.fsf@gitster.g> (raw)
In-Reply-To: <4d750ff2-9df5-504f-9972-59b082000db0@gmail.com> (Phillip Wood's message of "Wed, 7 Sep 2022 19:09:05 +0100")
Phillip Wood <phillip.wood123@gmail.com> writes:
> Hi Matheus
>
> On 07/09/2022 15:44, Matheus Tavares wrote:
>> When applying a patch, `git am` looks for special delimiter strings
>> (such as "---") to know where the message ends and the actual diff
>> starts. If one of these strings appears in the commit message itself,
>> `am` might get confused and fail to apply the patch properly. This has
>> already caused inconveniences in the past [1][2]. To help avoid such
>> problem, let's make `git format-patch` warn on commit messages
>> containing one of the said strings.
>
> Thanks for working on this, having a warning for this is a useful
> addition. If the user embeds a diff in their commit message then they
> will receive three warnings
>
> warning: commit message has a patch delimiter: 'diff --git a/file b/file'
> warning: commit message has a patch delimiter: '--- file'
> warning: git am might fail to apply this patch. Consider indenting the
> offending lines.
>
> I guess it's helpful to show all the lines that are considered
> delimiters but it gets quite noisy.
True. I wonder if automatically indenting these lines is an option ;-)
>> +
>> + if (found_delimiter) {
>> + warning(_("git am might fail to apply this patch. "
>> + "Consider indenting the offending lines."));
>
> The message says the patch might fail to apply, but isn't it
> guaranteed to fail?
Worse is it may apply a wrong thing (i.e. an illustration patch in
the proposed log message gets applied and committed with a truncated
log message).
next prev parent reply other threads:[~2022-09-07 18:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-04 23:12 [PATCH] format-patch: warn if commit msg contains a patch delimiter Matheus Tavares
2022-09-05 8:01 ` Ævar Arnfjörð Bjarmason
2022-09-05 10:57 ` René Scharfe
2022-09-07 14:44 ` [PATCH v2 0/2] " Matheus Tavares
2022-09-07 14:44 ` [PATCH v2 1/2] patchbreak(), is_scissors_line(): work with a buf/len pair Matheus Tavares
2022-09-07 18:20 ` Phillip Wood
2022-09-08 0:35 ` Eric Sunshine
2022-09-07 14:44 ` [PATCH v2 2/2] format-patch: warn if commit msg contains a patch delimiter Matheus Tavares
2022-09-07 18:09 ` Phillip Wood
2022-09-07 18:36 ` Junio C Hamano [this message]
2022-09-09 1:08 ` Matheus Tavares
2022-09-09 16:47 ` Junio C Hamano
2022-09-07 17:44 ` [PATCH v2 0/2] " René Scharfe
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=xmqqa67buj4m.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=l.s.r@web.de \
--cc=matheus.bernardino@usp.br \
--cc=phillip.wood123@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 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).