From a0d18469ed69fe0d55a0742901e697faf430e353 Mon Sep 17 00:00:00 2001 From: Rafael Gonzaga Date: Tue, 16 Jul 2024 15:57:21 -0300 Subject: [PATCH] feat: support PR-URL with trailing slash (#70) * feat: support PR-URL with trailing slash * fixup! 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..82cdf70 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 &&