threads / discuss / 56014

git-format-patch does not encode lines starting with "From"

Subject: git-format-patch does not encode lines starting with "From"

## tl;dr

2 messages between Jun 27, 2021 and Jun 28, 2021.

replies: 1people: 2as markdown or json

Jan Engelhardt· Jun 27, 2021, 18:08 UTC · lore

Summary =======

git-format-patch in 2.32.0 fails to quote/escape lines starting with "From ", and mbox readers conclude there is an empty mail.

Observed ========

$ git commit -m 'subject
From ffffffffffffffffffffffffffffffffffffffff Mon Sep 17 00:00:00 2001
with love.'
$ git format-patch HEAD^!
$ head 0001-subject.patch
From d489071b4855a49b32e9b5ae5addd982d2ed8d7d Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Sun, 27 Jun 2021 20:04:20 +0200
Subject: [PATCH] subject

From ffffffffffffffffffffffffffffffffffffffff Mon Sep 17 00:00:00 2001 with love.

$ git reset --hard HEAD^ $ git am -p0 0001-subject.patch Patch is empty. When you have resolved this problem, run "git am --continue".

Expected to see ===============

$ head 0001-subject.patch
From d489071b4855a49b32e9b5ae5addd982d2ed8d7d Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Sun, 27 Jun 2021 20:04:20 +0200
Subject: [PATCH] subject
>From ffffffffffffffffffffffffffffffffffffffff Mon Sep 17 00:00:00 2001
with love.
Ævar Arnfjörð Bjarmason· Jun 28, 2021, 08:08 UTC · re: Jan Engelhardt · lore

Re: git-format-patch does not encode lines starting with "From"

On Sun, Jun 27 2021, Jan Engelhardt wrote:
Show 41 quoted lines
> Summary
> =======
>
> git-format-patch in 2.32.0 fails to quote/escape lines starting with
> "From ", and mbox readers conclude there is an empty mail.
>
>
> Observed
> ========
>
> $ git commit -m 'subject
>
> From ffffffffffffffffffffffffffffffffffffffff Mon Sep 17 00:00:00 2001
> with love.'
> $ git format-patch HEAD^!
> $ head 0001-subject.patch
> From d489071b4855a49b32e9b5ae5addd982d2ed8d7d Mon Sep 17 00:00:00 2001
> From: Jan Engelhardt <jengelh@inai.de>
> Date: Sun, 27 Jun 2021 20:04:20 +0200
> Subject: [PATCH] subject
>
> From ffffffffffffffffffffffffffffffffffffffff Mon Sep 17 00:00:00 2001
> with love.
>
> $ git reset --hard HEAD^
> $ git am -p0 0001-subject.patch
> Patch is empty.
> When you have resolved this problem, run "git am --continue".
>
>
> Expected to see
> ===============
>
> $ head 0001-subject.patch
> From d489071b4855a49b32e9b5ae5addd982d2ed8d7d Mon Sep 17 00:00:00 2001
> From: Jan Engelhardt <jengelh@inai.de>
> Date: Sun, 27 Jun 2021 20:04:20 +0200
> Subject: [PATCH] subject
>
>>From ffffffffffffffffffffffffffffffffffffffff Mon Sep 17 00:00:00 2001
> with love.

"git format-patch --pretty=mboxrd" and "git am --patch-format" should solve this issue for you.

← back to recent threads