Skip to content

Commit

Permalink
feat: support PR-URL with trailing slash (#70)
Browse files Browse the repository at this point in the history
* feat: support PR-URL with trailing slash

* fixup! feat: support PR-URL with trailing slash
  • Loading branch information
RafaelGSS committed Jul 16, 2024
1 parent 6ce03a0 commit a0d1846
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions branch-diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down

0 comments on commit a0d1846

Please sign in to comment.