pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/gitgitgadget/gitgitgadget/commit/5d5272ecf76920d793fa8489ecdaee974dc02d2e

fix: handle PR with empty body except for cc: · gitgitgadget/gitgitgadget@5d5272e · GitHub
Skip to content

Commit 5d5272e

Browse files
committed
fix: handle PR with empty body except for cc:
If the body of the PR description is deleted and gitgitgadget adds `cc` entries, it will add a couple of empty lines before the `cc`. This was not picked up and the `cc(s)` were sent as the description. Contributors manually adding a `cc` did not add the empty lines. The fix is to allow the description to have no content before the empty lines. Signed-off-by: Chris. Webster <chris@webstech.net>
1 parent 92f3662 commit 5d5272e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/patch-series.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export class PatchSeries {
208208
let rangeDiff: string | undefined;
209209

210210
// parse the footers of the pullRequestDescription
211-
let match = prBody.match(/^([^]+)\n\n([^]+)$/);
211+
let match = prBody.match(/^([^]*)\n\n([^]+)$/);
212212

213213
if (!match && !prBody.match(/\n\n/)) {
214214
// handle PR descriptions that have no body, just footers

tests/patch-series.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,15 @@ Fetch-It-Via: git fetch ${repoUrl} my-series-v1
496496

497497
expect(parsed.coverLetter).toEqual(expectedCover1);
498498

499+
// test with empty body and gitgitgadget added cc's
500+
const cc = "Some Person <shout@out.loud>";
501+
prBody = ["", "", `Cc: ${cc}`].join("\r\n");
502+
503+
parsed = await PatchSeries.parsePullRequest(repo.workDir, prTitle, prBody, 76, "");
504+
505+
expect(parsed.coverLetter.length).toEqual(prTitle.length);
506+
expect(parsed.cc).toEqual([cc]);
507+
499508
// Markdown-formatted Cc test (copy/pasted from GitHub)
500509
prBody = [
501510
"some description",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy