From a0d18469ed69fe0d55a0742901e697faf430e353 Mon Sep 17 00:00:00 2001 From: Rafael Gonzaga Date: Tue, 16 Jul 2024 15:57:21 -0300 Subject: [PATCH 1/2] 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 && From 85790dc20ae63761b6862a500803bf79a09595f3 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 16 Jul 2024 18:59:14 +0000 Subject: [PATCH 2/2] chore(release): 3.1.0 [skip ci] ## [3.1.0](https://github.com/nodejs/branch-diff/compare/v3.0.5...v3.1.0) (2024-07-16) ### Features * support PR-URL with trailing slash ([#70](https://github.com/nodejs/branch-diff/issues/70)) ([a0d1846](https://github.com/nodejs/branch-diff/commit/a0d18469ed69fe0d55a0742901e697faf430e353)) --- CHANGELOG.md | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6538422..7b21540 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [3.1.0](https://github.com/nodejs/branch-diff/compare/v3.0.5...v3.1.0) (2024-07-16) + +### Features + +* support PR-URL with trailing slash ([#70](https://github.com/nodejs/branch-diff/issues/70)) ([a0d1846](https://github.com/nodejs/branch-diff/commit/a0d18469ed69fe0d55a0742901e697faf430e353)) + ## [3.0.5](https://github.com/nodejs/branch-diff/compare/v3.0.4...v3.0.5) (2024-07-10) ### Trivial Changes diff --git a/package.json b/package.json index a6ec26b..0fb75e9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "branch-diff", - "version": "3.0.5", + "version": "3.1.0", "description": "A tool to list print the commits on one git branch that are not on another using loose comparison", "main": "branch-diff.js", "type": "module",