From f5396e26d81abb98ad74aaa8abd0728abf6940e0 Mon Sep 17 00:00:00 2001 From: RafaelGSS Date: Tue, 16 Jul 2024 14:50:13 -0300 Subject: [PATCH 1/2] feat: support PR-URL with trailing slash --- branch-diff.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/branch-diff.js b/branch-diff.js index 8e6ded0..e922f12 100755 --- a/branch-diff.js +++ b/branch-diff.js @@ -53,11 +53,19 @@ async function findMergeBase (repoPath, branch1, branch2) { return data.substr(0, 10) } +function normalizeIfTrailingSlash (commit) { + if (commit.prUrl.at(-1) === '/') { + commit.prUrl = commit.prUrl.slice(0, -1); + } +} + async function diffCollected (options, branchCommits) { function isInList (commit) { + normalizeIfTrailingSlash(commit) return branchCommits[0].some((c) => { if (commit.sha === c.sha) { return true } if (commit.summary === c.summary) { + normalizeIfTrailingSlash(c) if (commit.prUrl && c.prUrl) { return commit.prUrl === c.prUrl } else if (commit.author.name === c.author.name && From 29ecfe538a24304995cfb4d5088456736a291c2d Mon Sep 17 00:00:00 2001 From: RafaelGSS Date: Tue, 16 Jul 2024 15:17:42 -0300 Subject: [PATCH 2/2] fixup! feat: support PR-URL with trailing slash --- branch-diff.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/branch-diff.js b/branch-diff.js index e922f12..82cdf70 100755 --- a/branch-diff.js +++ b/branch-diff.js @@ -55,7 +55,7 @@ async function findMergeBase (repoPath, branch1, branch2) { function normalizeIfTrailingSlash (commit) { if (commit.prUrl.at(-1) === '/') { - commit.prUrl = commit.prUrl.slice(0, -1); + commit.prUrl = commit.prUrl.slice(0, -1) } }