mirror of
https://github.com/dorny/paths-filter.git
synced 2025-06-08 00:59:04 +00:00
Use combination of --depth and --deepen
This commit is contained in:
parent
8801c887e9
commit
49abb091ed
2 changed files with 15 additions and 2 deletions
|
@ -66,10 +66,16 @@ export async function getChangesSinceMergeBase(
|
|||
let noMergeBase = false
|
||||
core.startGroup(`Searching for merge-base ${baseRef}...${ref}`)
|
||||
try {
|
||||
let init = true
|
||||
let lastCommitCount = await getCommitCount()
|
||||
let depth = Math.max(lastCommitCount * 2, initialFetchDepth)
|
||||
while (!(await hasMergeBase())) {
|
||||
await exec('git', ['fetch', `--depth=${depth}`, 'origin', `${baseRef}:${baseRef}`, `${ref}`])
|
||||
if (init) {
|
||||
await exec('git', ['fetch', `--depth=${depth}`, 'origin', `${baseRef}:${baseRef}`, `${ref}`])
|
||||
init = false
|
||||
} else {
|
||||
await exec('git', ['fetch', `--deepen=${depth}`, 'origin', baseRef, ref])
|
||||
}
|
||||
const commitCount = await getCommitCount()
|
||||
if (commitCount === lastCommitCount) {
|
||||
core.info('No more commits were fetched')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue