Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions branch-diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const pkgData = fs.existsSync(pkgFile) ? require(pkgFile) : {}
const pkgId = pkgtoId(pkgData)
const refcmd = 'git rev-list --max-count=1 {{ref}}'
const commitdatecmd = '$(git show -s --format=%cd `{{refcmd}}`)'
const gitcmd = 'git log {{startCommit}}..{{branch}} --until="{{untilcmd}}"'
const gitcmd = 'git log {{startCommit}}..{{branch}} --until="{{untilcmd}}"{{gitLogFlags}}'
const ghId = {
user: pkgId.user || 'nodejs',
repo: pkgId.name || 'node'
Expand All @@ -41,7 +41,7 @@ export async function branchDiff (branch1, branch2, options) {
const repoPath = options.repoPath || process.cwd()
const commit = await findMergeBase(repoPath, branch1, branch2)
const branchCommits = await Promise.all([branch1, branch2].map(async (branch) => {
return collect(repoPath, branch, commit, branch === branch2 && options.endRef)
return collect(repoPath, branch, commit, branch === branch2 && options.endRef, options.gitLogFlags)
}))
return await diffCollected(options, branchCommits)
}
Expand Down Expand Up @@ -102,10 +102,10 @@ async function diffCollected (options, branchCommits) {
return list
}

async function collect (repoPath, branch, startCommit, endRef) {
async function collect (repoPath, branch, startCommit, endRef, gitLogFlags = '') {
const endrefcmd = endRef && replace(refcmd, { ref: endRef })
const untilcmd = endRef ? replace(commitdatecmd, { refcmd: endrefcmd }) : ''
const _gitcmd = replace(gitcmd, { branch, startCommit, untilcmd })
const _gitcmd = replace(gitcmd, { branch, startCommit, untilcmd, gitLogFlags })

const commitList = []
await pipeline(
Expand All @@ -127,6 +127,7 @@ async function main () {
'commit-url': { type: 'string' },
'end-ref': { type: 'string' },
'exclude-label': { type: 'string', multiple: true },
'extra-git-log-flags': { type: 'string' },
'filter-release': { type: 'boolean' },
'find-matching-prs': { type: 'boolean' },
format: { type: 'string' },
Expand Down Expand Up @@ -162,6 +163,7 @@ async function main () {
}

const options = {
gitLogFlags: argv['extra-git-log-flags'],
group: argv.group,
excludeLabels,
requireLabels,
Expand Down
Loading