-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mailinfo: make ">From" in-body header check more robust
Since commit 81c5cf7 (mailinfo: skip bogus UNIX From line inside body, 2006-05-21), we have treated lines like ">From" in the body as headers. This makes "git am" work for people who erroneously paste the whole output from format-patch: From 12345abcd...fedcba543210 Mon Sep 17 00:00:00 2001 From: them Subject: [PATCH] whatever into their email body (assuming that an mbox writer then quotes "From" as ">From", as otherwise we would actually mailsplit on the in-body line). However, this has false positives if somebody actually has a commit body that starts with "From "; in this case we erroneously remove the line entirely from the commit message. We can make this check more robust by making sure the line actually looks like a real mbox "From" line. Inspect the line that begins with ">From " a more carefully to only skip lines that match the expected pattern (note that the datestamp part of the format-patch output is designed to be kept constant to help those who write magic(5) entries). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Loading branch information
Jeff King
authored and
Junio C Hamano
committed
Sep 16, 2014
1 parent
96db324
commit 2da1f36
Showing
6 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Author: Commit Author | ||
Email: commit@example.com | ||
Subject: patch subject | ||
Date: Sat, 13 Sep 2014 21:13:23 -0400 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
From 1234567890123456789012345678901234567890 Mon Sep 17 00:00:00 2001 | ||
From: Email Author <email@example.com> | ||
Date: Sun, 25 May 2008 00:38:18 -0700 | ||
Subject: [PATCH] email subject | ||
|
||
>From 1234567890123456789012345678901234567890 Mon Sep 17 00:00:00 2001 | ||
From: Commit Author <commit@example.com> | ||
Date: Sat, 13 Sep 2014 21:13:23 -0400 | ||
Subject: patch subject | ||
|
||
patch body | ||
--- | ||
patch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
>From the depths of history, we are stuck with the | ||
flaky mbox format. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
From 1234567890123456789012345678901234567890 Mon Sep 17 00:00:00 2001 | ||
From: Author Name <somebody@example.com> | ||
Date: Sun, 25 May 2008 00:38:18 -0700 | ||
Subject: [PATCH] testing quoted >From | ||
|
||
>From the depths of history, we are stuck with the | ||
flaky mbox format. | ||
|
||
--- | ||
patch |