diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2023-09-06 17:06:26 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2023-09-06 17:06:26 -0400 |
commit | 0438c6a107d3475895281146e51d68069a41dc3d (patch) | |
tree | c11c3228d534288edf326e3c169067976f333829 | |
parent | 8382882b9fb6c50737b6e19198a259850527d2a6 (diff) | |
download | b4-0438c6a107d3475895281146e51d68069a41dc3d.tar.gz |
am: properly handle non-git diffs
We were not properly parsing patches generated by something other than
"git diff" or "git format-patch". Notably, these are pretty rare, but we
still shouldn't fail when doing that.
This additionally adds a few tests and fixes a silly mistake that I had
all along in the sample data.
Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217852
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
29 files changed, 196 insertions, 51 deletions
diff --git a/b4/__init__.py b/b4/__init__.py index 14ef53d..e834af2 100644 --- a/b4/__init__.py +++ b/b4/__init__.py @@ -1752,8 +1752,12 @@ class LoreMessage: if len(basement): if not len(trailers): body += '\n' - body += '---\n' - body += basement.rstrip('\r\n') + '\n' + if DIFFSTAT_RE.search(basement): + body += '---\n' + else: + # If we don't have a diffstat, then we don't need to add a --- + body += '\n' + body += basement.strip('\r\n') + '\n' if len(signature): body += '-- \n' @@ -1787,6 +1791,12 @@ class LoreMessage: if len(parts) == 2: parts[1] = 'diff ' + parts[1] basement = parts[1].rstrip('\n') + elif body.find('\n--- a/') >= 0: + # patches generated by some really peculiar tools + parts = body.split('\n--- a/', 1) + if len(parts) == 2: + parts[1] = '--- a/' + parts[1] + basement = parts[1].rstrip('\n') mbody = parts[0].strip('\n') diff --git a/tests/samples/trailers-followup-custody-ref-ordered.txt b/tests/samples/trailers-followup-custody-ref-ordered.txt index 6f76718..be4d2ee 100644 --- a/tests/samples/trailers-followup-custody-ref-ordered.txt +++ b/tests/samples/trailers-followup-custody-ref-ordered.txt @@ -21,12 +21,11 @@ Suggested-by: Friendly Suggester <suggested-by@example.com> Reviewed-by: Followup Reviewer1 <followup-reviewer1@example.com> Tested-by: Followup Reviewer2 <followup-reviewer2@example.com> Signed-off-by: Test Override <test-override@example.com> ---- diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py ---- b/b4/junk.py ++++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): diff --git a/tests/samples/trailers-followup-custody-ref-unordered.txt b/tests/samples/trailers-followup-custody-ref-unordered.txt index 5a44260..86b50e4 100644 --- a/tests/samples/trailers-followup-custody-ref-unordered.txt +++ b/tests/samples/trailers-followup-custody-ref-unordered.txt @@ -21,12 +21,11 @@ Cc: Dev Eloper1 <dev-eloper1@example.com> Cc: Dev Eloper2 <dev-eloper2@example.com> Cc: Some List <list-1@lists.example.com> Signed-off-by: Test Override <test-override@example.com> ---- diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py ---- b/b4/junk.py ++++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): diff --git a/tests/samples/trailers-followup-custody-ref-with-ignored.txt b/tests/samples/trailers-followup-custody-ref-with-ignored.txt index c9d9cdf..11ccb7e 100644 --- a/tests/samples/trailers-followup-custody-ref-with-ignored.txt +++ b/tests/samples/trailers-followup-custody-ref-with-ignored.txt @@ -20,12 +20,11 @@ Cc: Dev Eloper1 <dev-eloper1@example.com> Cc: Dev Eloper2 <dev-eloper2@example.com> Cc: Some List <list-1@lists.example.com> Signed-off-by: Test Override <test-override@example.com> ---- diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py ---- b/b4/junk.py ++++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): diff --git a/tests/samples/trailers-followup-custody.mbox b/tests/samples/trailers-followup-custody.mbox index 0c4e4b8..511c7a2 100644 --- a/tests/samples/trailers-followup-custody.mbox +++ b/tests/samples/trailers-followup-custody.mbox @@ -21,7 +21,7 @@ Signed-off-by: Test Override <test-override@example.com> diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py ---- b/b4/junk.py ++++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): diff --git a/tests/samples/trailers-followup-non-git-patch-ref-defaults.txt b/tests/samples/trailers-followup-non-git-patch-ref-defaults.txt new file mode 100644 index 0000000..59d9b71 --- /dev/null +++ b/tests/samples/trailers-followup-non-git-patch-ref-defaults.txt @@ -0,0 +1,29 @@ +From git@z Thu Jan 1 00:00:00 1970 +Subject: [PATCH] Simple test +From: Test Test <test@example.com> +Date: Tue, 30 Aug 2022 11:19:07 -0400 +Message-Id: <orig-message@example.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 7bit + +Follow-up trailer collating test. + +Fixes: abcdef01234567890 +Reviewed-by: Original Reviewer <original-reviewer@example.com> +Link: https://msgid.link/some@msgid.here +Signed-off-by: Original Submitter <original-submitter@example.com> +Reviewed-by: Followup Reviewer1 <followup-reviewer1@example.com> + +--- a/b4/junk.py ++++ b/b4/junk.py +@@@ -1,1 +1,1 @@ def junk(): + + +-junk1 ++junk2 + + +-- +2.wong.fu + diff --git a/tests/samples/trailers-followup-non-git-patch.mbox b/tests/samples/trailers-followup-non-git-patch.mbox new file mode 100644 index 0000000..3bc722a --- /dev/null +++ b/tests/samples/trailers-followup-non-git-patch.mbox @@ -0,0 +1,42 @@ +From foo@z Thu Jan 1 00:00:00 1970 +From: Test Test <test@example.com> +Subject: [PATCH] Simple test +To: Some List <list-1@lists.example.com> +Cc: Dev Eloper1 <dev-eloper1@example.com>, + Dev Eloper2 <dev-eloper2@example.com> +Date: Tue, 30 Aug 2022 11:19:07 -0400 +Message-Id: <orig-message@example.com> + +Follow-up trailer collating test. + +Fixes: abcdef01234567890 +Reviewed-by: Original Reviewer <original-reviewer@example.com> +Link: https://msgid.link/some@msgid.here +Signed-off-by: Original Submitter <original-submitter@example.com> + +--- a/b4/junk.py ++++ b/b4/junk.py +@@@ -1,1 +1,1 @@ def junk(): + + +-junk1 ++junk2 + + +-- +2.wong.fu + +From foo@z Thu Jan 1 00:00:00 1970 +From: Followup Reviewer1 <followup-reviewer1@example.com> +Subject: Re: [PATCH] Simple test +Date: Tue, 30 Aug 2022 11:19:07 -0400 +Message-Id: <fwup-message-1@example.com> +In-Reply-To: <orig-message@example.com> +References: <orig-message@example.com> + +> This is a simple trailer parsing test. + +Reviewed-by: Followup Reviewer1 <followup-reviewer1@example.com> + +-- +My sig diff --git a/tests/samples/trailers-followup-nore-ref-defaults.txt b/tests/samples/trailers-followup-nore-ref-defaults.txt index 3794a89..9f78bd3 100644 --- a/tests/samples/trailers-followup-nore-ref-defaults.txt +++ b/tests/samples/trailers-followup-nore-ref-defaults.txt @@ -14,12 +14,11 @@ Reviewed-by: Original Reviewer <original-reviewer@example.com> Link: https://msgid.link/some@msgid.here Signed-off-by: Original Submitter <original-submitter@example.com> Reviewed-by: Followup Reviewer1 <followup-reviewer1@example.com> ---- diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py ---- b/b4/junk.py ++++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): diff --git a/tests/samples/trailers-followup-nore.mbox b/tests/samples/trailers-followup-nore.mbox index 458d958..27dddd6 100644 --- a/tests/samples/trailers-followup-nore.mbox +++ b/tests/samples/trailers-followup-nore.mbox @@ -18,7 +18,7 @@ Signed-off-by: Original Submitter <original-submitter@example.com> diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py ---- b/b4/junk.py ++++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): diff --git a/tests/samples/trailers-followup-partial-reroll-ref-defaults.txt b/tests/samples/trailers-followup-partial-reroll-ref-defaults.txt index ec5d604..2656e54 100644 --- a/tests/samples/trailers-followup-partial-reroll-ref-defaults.txt +++ b/tests/samples/trailers-followup-partial-reroll-ref-defaults.txt @@ -14,12 +14,11 @@ Reviewed-by: Original Reviewer <original-reviewer@example.com> Link: https://msgid.link/some@msgid.here Signed-off-by: Original Submitter <original-submitter@example.com> Signed-off-by: Test Override <test-override@example.com> ---- diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py ---- b/b4/junk.py ++++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): @@ -47,12 +46,11 @@ Reviewed-by: Original Reviewer <original-reviewer@example.com> Link: https://msgid.link/some@msgid.here Signed-off-by: Original Submitter <original-submitter@example.com> Signed-off-by: Test Override <test-override@example.com> ---- diff --git a/b4/bogus.py b/b4/bogus.py index 12345678..23456789 100644 --- a/b4/bogus.py ---- b/b4/bogus.py ++++ b/b4/bogus.py @@@ -1,1 +1,1 @@ def bogus(): diff --git a/tests/samples/trailers-followup-partial-reroll.mbox b/tests/samples/trailers-followup-partial-reroll.mbox index 0a5644f..1f78553 100644 --- a/tests/samples/trailers-followup-partial-reroll.mbox +++ b/tests/samples/trailers-followup-partial-reroll.mbox @@ -37,7 +37,7 @@ Signed-off-by: Original Submitter <original-submitter@example.com> diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py ---- b/b4/junk.py ++++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): @@ -70,7 +70,7 @@ Signed-off-by: Original Submitter <original-submitter@example.com> diff --git a/b4/bupkes.py b/b4/bupkes.py index 12345678..23456789 100644 --- a/b4/bupkes.py ---- b/b4/bupkes.py ++++ b/b4/bupkes.py @@@ -1,1 +1,1 @@ def bupkes(): @@ -134,7 +134,7 @@ Signed-off-by: Original Submitter <original-submitter@example.com> diff --git a/b4/bogus.py b/b4/bogus.py index 12345678..23456789 100644 --- a/b4/bogus.py ---- b/b4/bogus.py ++++ b/b4/bogus.py @@@ -1,1 +1,1 @@ def bogus(): diff --git a/tests/samples/trailers-followup-single-ref-addlink.txt b/tests/samples/trailers-followup-single-ref-addlink.txt index 07ec6cb..e0c4826 100644 --- a/tests/samples/trailers-followup-single-ref-addlink.txt +++ b/tests/samples/trailers-followup-single-ref-addlink.txt @@ -17,12 +17,11 @@ Reviewed-by: Followup Reviewer1 <followup-reviewer1@example.com> Tested-by: Followup Reviewer2 <followup-reviewer2@example.com> Link: https://lore.kernel.org/r/orig-message@example.com Signed-off-by: Test Override <test-override@example.com> ---- diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py ---- b/b4/junk.py ++++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): diff --git a/tests/samples/trailers-followup-single-ref-addmsgid.txt b/tests/samples/trailers-followup-single-ref-addmsgid.txt index fcdd79a..eeed03d 100644 --- a/tests/samples/trailers-followup-single-ref-addmsgid.txt +++ b/tests/samples/trailers-followup-single-ref-addmsgid.txt @@ -17,12 +17,11 @@ Reviewed-by: Followup Reviewer1 <followup-reviewer1@example.com> Tested-by: Followup Reviewer2 <followup-reviewer2@example.com> Message-Id: <orig-message@example.com> Signed-off-by: Test Override <test-override@example.com> ---- diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py ---- b/b4/junk.py ++++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): diff --git a/tests/samples/trailers-followup-single-ref-addmysob.txt b/tests/samples/trailers-followup-single-ref-addmysob.txt index 497d62e..31032ba 100644 --- a/tests/samples/trailers-followup-single-ref-addmysob.txt +++ b/tests/samples/trailers-followup-single-ref-addmysob.txt @@ -16,12 +16,11 @@ Signed-off-by: Original Submitter <original-submitter@example.com> Reviewed-by: Followup Reviewer1 <followup-reviewer1@example.com> Tested-by: Followup Reviewer2 <followup-reviewer2@example.com> Signed-off-by: Test Override <test-override@example.com> ---- diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py ---- b/b4/junk.py ++++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): diff --git a/tests/samples/trailers-followup-single-ref-copyccs.txt b/tests/samples/trailers-followup-single-ref-copyccs.txt index 86d1c97..6fc2d0a 100644 --- a/tests/samples/trailers-followup-single-ref-copyccs.txt +++ b/tests/samples/trailers-followup-single-ref-copyccs.txt @@ -19,12 +19,11 @@ Cc: Dev Eloper1 <dev-eloper1@example.com> Cc: Dev Eloper2 <dev-eloper2@example.com> Cc: Some List <list-1@lists.example.com> Signed-off-by: Test Override <test-override@example.com> ---- diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py ---- b/b4/junk.py ++++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): diff --git a/tests/samples/trailers-followup-single-ref-defaults.txt b/tests/samples/trailers-followup-single-ref-defaults.txt index 2d53ca7..d65ffce 100644 --- a/tests/samples/trailers-followup-single-ref-defaults.txt +++ b/tests/samples/trailers-followup-single-ref-defaults.txt @@ -15,12 +15,11 @@ Link: https://msgid.link/some@msgid.here Signed-off-by: Original Submitter <original-submitter@example.com> Reviewed-by: Followup Reviewer1 <followup-reviewer1@example.com> Tested-by: Followup Reviewer2 <followup-reviewer2@example.com> ---- diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py ---- b/b4/junk.py ++++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): diff --git a/tests/samples/trailers-followup-single-ref-noadd.txt b/tests/samples/trailers-followup-single-ref-noadd.txt index 6cab56c..cda0610 100644 --- a/tests/samples/trailers-followup-single-ref-noadd.txt +++ b/tests/samples/trailers-followup-single-ref-noadd.txt @@ -18,7 +18,7 @@ Signed-off-by: Original Submitter <original-submitter@example.com> diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py ---- b/b4/junk.py ++++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): diff --git a/tests/samples/trailers-followup-single-ref-ordered.txt b/tests/samples/trailers-followup-single-ref-ordered.txt index 44b2b72..309be50 100644 --- a/tests/samples/trailers-followup-single-ref-ordered.txt +++ b/tests/samples/trailers-followup-single-ref-ordered.txt @@ -19,12 +19,11 @@ Cc: Some List <list-1@lists.example.com> Tested-by: Followup Reviewer2 <followup-reviewer2@example.com> Reviewed-by: Followup Reviewer1 <followup-reviewer1@example.com> Signed-off-by: Test Override <test-override@example.com> ---- diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py ---- b/b4/junk.py ++++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): diff --git a/tests/samples/trailers-followup-single-ref-sloppy.txt b/tests/samples/trailers-followup-single-ref-sloppy.txt index 137a6ce..4cb72dd 100644 --- a/tests/samples/trailers-followup-single-ref-sloppy.txt +++ b/tests/samples/trailers-followup-single-ref-sloppy.txt @@ -17,12 +17,11 @@ Reviewed-by: Followup Reviewer1 <followup-reviewer1@example.com> Tested-by: Followup Reviewer2 <followup-reviewer2@example.com> Reviewed-by: Mismatched Reviewer1 <mismatched-reviewer1@example.net> Signed-off-by: Test Override <test-override@example.com> ---- diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py ---- b/b4/junk.py ++++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): diff --git a/tests/samples/trailers-followup-single.mbox b/tests/samples/trailers-followup-single.mbox index b12f6ba..f3f788f 100644 --- a/tests/samples/trailers-followup-single.mbox +++ b/tests/samples/trailers-followup-single.mbox @@ -18,7 +18,7 @@ Signed-off-by: Original Submitter <original-submitter@example.com> diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py ---- b/b4/junk.py ++++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): diff --git a/tests/samples/trailers-followup-with-cover-ref-addlink.txt b/tests/samples/trailers-followup-with-cover-ref-addlink.txt index d0091c6..8428a4a 100644 --- a/tests/samples/trailers-followup-with-cover-ref-addlink.txt +++ b/tests/samples/trailers-followup-with-cover-ref-addlink.txt @@ -15,12 +15,11 @@ Link: https://msgid.link/some@msgid.here Signed-off-by: Original Submitter <original-submitter@example.com> Link: https://lore.kernel.org/r/patch-1-message@example.com Signed-off-by: Test Override <test-override@example.com> ---- diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py ---- b/b4/junk.py ++++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): @@ -49,12 +48,11 @@ Signed-off-by: Original Submitter <original-submitter@example.com> Reviewed-by: Followup Reviewer1 <followup-reviewer1@example.com> Link: https://lore.kernel.org/r/patch-2-message@example.com Signed-off-by: Test Override <test-override@example.com> ---- diff --git a/b4/bupkes.py b/b4/bupkes.py index 12345678..23456789 100644 --- a/b4/bupkes.py ---- b/b4/bupkes.py ++++ b/b4/bupkes.py @@@ -1,1 +1,1 @@ def bupkes(): diff --git a/tests/samples/trailers-followup-with-cover-ref-covertrailers.txt b/tests/samples/trailers-followup-with-cover-ref-covertrailers.txt index d182f70..5ef0d7a 100644 --- a/tests/samples/trailers-followup-with-cover-ref-covertrailers.txt +++ b/tests/samples/trailers-followup-with-cover-ref-covertrailers.txt @@ -15,12 +15,11 @@ Link: https://msgid.link/some@msgid.here Signed-off-by: Original Submitter <original-submitter@example.com> Reviewed-by: Coverletter Reviewer1 <followup-reviewer1@example.com> Signed-off-by: Test Override <test-override@example.com> ---- diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py ---- b/b4/junk.py ++++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): @@ -49,12 +48,11 @@ Signed-off-by: Original Submitter <original-submitter@example.com> Reviewed-by: Followup Reviewer1 <followup-reviewer1@example.com> Reviewed-by: Coverletter Reviewer1 <followup-reviewer1@example.com> Signed-off-by: Test Override <test-override@example.com> ---- diff --git a/b4/bupkes.py b/b4/bupkes.py index 12345678..23456789 100644 --- a/b4/bupkes.py ---- b/b4/bupkes.py ++++ b/b4/bupkes.py @@@ -1,1 +1,1 @@ def bupkes(): diff --git a/tests/samples/trailers-followup-with-cover-ref-defaults.txt b/tests/samples/trailers-followup-with-cover-ref-defaults.txt index 86538a8..858d103 100644 --- a/tests/samples/trailers-followup-with-cover-ref-defaults.txt +++ b/tests/samples/trailers-followup-with-cover-ref-defaults.txt @@ -14,12 +14,11 @@ Reviewed-by: Original Reviewer <original-reviewer@example.com> Link: https://msgid.link/some@msgid.here Signed-off-by: Original Submitter <original-submitter@example.com> Signed-off-by: Test Override <test-override@example.com> ---- diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py ---- b/b4/junk.py ++++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): @@ -47,12 +46,11 @@ Link: https://msgid.link/some@msgid.here Signed-off-by: Original Submitter <original-submitter@example.com> Reviewed-by: Followup Reviewer1 <followup-reviewer1@example.com> Signed-off-by: Test Override <test-override@example.com> ---- diff --git a/b4/bupkes.py b/b4/bupkes.py index 12345678..23456789 100644 --- a/b4/bupkes.py ---- b/b4/bupkes.py ++++ b/b4/bupkes.py @@@ -1,1 +1,1 @@ def bupkes(): diff --git a/tests/samples/trailers-followup-with-cover.mbox b/tests/samples/trailers-followup-with-cover.mbox index 52c14c4..f2c2c6d 100644 --- a/tests/samples/trailers-followup-with-cover.mbox +++ b/tests/samples/trailers-followup-with-cover.mbox @@ -37,7 +37,7 @@ Signed-off-by: Original Submitter <original-submitter@example.com> diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py ---- b/b4/junk.py ++++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): @@ -70,7 +70,7 @@ Signed-off-by: Original Submitter <original-submitter@example.com> diff --git a/b4/bupkes.py b/b4/bupkes.py index 12345678..23456789 100644 --- a/b4/bupkes.py ---- b/b4/bupkes.py ++++ b/b4/bupkes.py @@@ -1,1 +1,1 @@ def bupkes(): diff --git a/tests/samples/trailers-followup-with-diffstat-ref-defaults.txt b/tests/samples/trailers-followup-with-diffstat-ref-defaults.txt new file mode 100644 index 0000000..3555f6e --- /dev/null +++ b/tests/samples/trailers-followup-with-diffstat-ref-defaults.txt @@ -0,0 +1,34 @@ +From git@z Thu Jan 1 00:00:00 1970 +Subject: [PATCH] Simple test +From: Test Test <test@example.com> +Date: Tue, 30 Aug 2022 11:19:07 -0400 +Message-Id: <orig-message@example.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 7bit + +Follow-up trailer collating test. + +Fixes: abcdef01234567890 +Reviewed-by: Original Reviewer <original-reviewer@example.com> +Link: https://msgid.link/some@msgid.here +Signed-off-by: Original Submitter <original-submitter@example.com> +Reviewed-by: Followup Reviewer1 <followup-reviewer1@example.com> +--- + b4/junk.py | 1 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/b4/junk.py b/b4/junk.py +index 12345678..23456789 100644 +--- a/b4/junk.py ++++ b/b4/junk.py +@@@ -1,1 +1,1 @@ def junk(): + + +-junk1 ++junk2 + + +-- +2.wong.fu + diff --git a/tests/samples/trailers-followup-with-diffstat.mbox b/tests/samples/trailers-followup-with-diffstat.mbox new file mode 100644 index 0000000..f1c0d31 --- /dev/null +++ b/tests/samples/trailers-followup-with-diffstat.mbox @@ -0,0 +1,47 @@ +From foo@z Thu Jan 1 00:00:00 1970 +From: Test Test <test@example.com> +Subject: [PATCH] Simple test +To: Some List <list-1@lists.example.com> +Cc: Dev Eloper1 <dev-eloper1@example.com>, + Dev Eloper2 <dev-eloper2@example.com> +Date: Tue, 30 Aug 2022 11:19:07 -0400 +Message-Id: <orig-message@example.com> + +Follow-up trailer collating test. + +Fixes: abcdef01234567890 +Reviewed-by: Original Reviewer <original-reviewer@example.com> +Link: https://msgid.link/some@msgid.here +Signed-off-by: Original Submitter <original-submitter@example.com> +--- + b4/junk.py | 1 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/b4/junk.py b/b4/junk.py +index 12345678..23456789 100644 +--- a/b4/junk.py ++++ b/b4/junk.py +@@@ -1,1 +1,1 @@ def junk(): + + +-junk1 ++junk2 + + +-- +2.wong.fu + +From foo@z Thu Jan 1 00:00:00 1970 +From: Followup Reviewer1 <followup-reviewer1@example.com> +Subject: Re: [PATCH] Simple test +Date: Tue, 30 Aug 2022 11:19:07 -0400 +Message-Id: <fwup-message-1@example.com> +In-Reply-To: <orig-message@example.com> +References: <orig-message@example.com> + +> This is a simple trailer parsing test. + +Reviewed-by: Followup Reviewer1 <followup-reviewer1@example.com> + +-- +My sig diff --git a/tests/samples/trailers-test-extinfo.txt b/tests/samples/trailers-test-extinfo.txt index d36abbb..aa61e8d 100644 --- a/tests/samples/trailers-test-extinfo.txt +++ b/tests/samples/trailers-test-extinfo.txt @@ -17,7 +17,7 @@ Signed-off-by: Wrapped Persontrailer diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py ---- b/b4/junk.py ++++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): diff --git a/tests/samples/trailers-test-simple.txt b/tests/samples/trailers-test-simple.txt index 693d781..da64caf 100644 --- a/tests/samples/trailers-test-simple.txt +++ b/tests/samples/trailers-test-simple.txt @@ -12,7 +12,7 @@ Link: https://msgid.link/some@msgid.here diff --git a/b4/junk.py b/b4/junk.py index 12345678..23456789 100644 --- a/b4/junk.py ---- b/b4/junk.py ++++ b/b4/junk.py @@@ -1,1 +1,1 @@ def junk(): diff --git a/tests/test___init__.py b/tests/test___init__.py index a38cd32..223b61e 100644 --- a/tests/test___init__.py +++ b/tests/test___init__.py @@ -101,6 +101,8 @@ def test_parse_trailers(sampledir, source, expected): {'trailers-ignore-from': 'followup-reviewer1@example.com'}), ('partial-reroll', {}, {'addmysob': True}, 'defaults', {}), ('nore', {}, {}, 'defaults', {}), + ('non-git-patch', {}, {}, 'defaults', {}), + ('with-diffstat', {}, {}, 'defaults', {}), ]) def test_followup_trailers(sampledir, source, serargs, amargs, reference, b4cfg): b4.MAIN_CONFIG.update(b4cfg) |