git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Christoph Anton Mitterer <calestyo@scientia.org>
Cc: git@vger.kernel.org
Subject: Re: git format-patch escaping issues in the patch format
Date: Mon, 04 Nov 2024 16:22:41 -0800	[thread overview]
Message-ID: <xmqqttcmv8a6.fsf@gitster.g> (raw)
In-Reply-To: <ca13705ae4817ffba16f97530637411b59c9eb19.camel@scientia.org> (Christoph Anton Mitterer's message of "Mon, 04 Nov 2024 20:24:14 +0100")

Christoph Anton Mitterer <calestyo@scientia.org> writes:

> There seems unfortunately only little (written) definition of that
> format, git-format-patch(1) merely says it's in UNIX mailbox format
> (which itself is, AFAIK, not really formally defined).
>
>
> Anyway, it seems to turn out, that no escaping is done for the commit
> message in the patch format and that this can cause actual breakage
> with valid commit messages.

Yes, so ...

> Consider the following example:
>    ~/test/foo$ git commit -m "msg1
>    
>    From 0000000000000000000000000000000061603705 Mon Sep 17 00:00:00 2001
>    --

... this falls squarely into "if it hurts, don't do it" category.

A commonly used trick, when you are working on Git and have to
include such a line in the commit log message, e.g., when you
discuss how the output produced by "git log --format=email" looks
like, is to indent such lines in the paragraph you talk about them,
e.g.

    In a format-patch output file, the contents of each commit
    begins with

	From 8f8d6eee531b3fa1a8ef14f169b0cb5035f7a772 Mon Sep 17 00:00:00 2001

    where the string 8f8d... is replaced with the name of the commit
    object the patch was taken from.


  parent reply	other threads:[~2024-11-05  0:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-04 19:24 git format-patch escaping issues in the patch format Christoph Anton Mitterer
2024-11-04 22:15 ` Kristoffer Haugsbakk
2024-11-05  1:26   ` Christoph Anton Mitterer
2024-11-05 14:32     ` Kristoffer Haugsbakk
2024-11-05 15:02       ` Christoph Anton Mitterer
2024-11-04 23:54 ` Jeff King
2024-11-05  1:03   ` Christoph Anton Mitterer
2024-11-05 15:05     ` Jeff King
2024-11-05  0:22 ` Junio C Hamano [this message]
2024-11-05  1:01   ` Christoph Anton Mitterer

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=xmqqttcmv8a6.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=calestyo@scientia.org \
    --cc=git@vger.kernel.org \
    /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 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 NNTP newsgroup(s).