mirror of
https://code.forgejo.org/actions/checkout.git
synced 2024-11-23 18:04:51 +01:00
Support fetch-jobs: 0 to use as many jobs as there are processors
The default is now fetch-jobs: -1, which is the new value for reverting to normal git behavior (provide no --jobs argument).
This commit is contained in:
parent
ad5dc19390
commit
a5c1ce924a
7 changed files with 19 additions and 15 deletions
|
@ -93,9 +93,10 @@ Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous
|
||||||
# Default: 1
|
# Default: 1
|
||||||
fetch-depth: ''
|
fetch-depth: ''
|
||||||
|
|
||||||
# Number of fetches to perform simultaneously when updating submodules. 0
|
# Number of fetches to perform simultaneously when updating submodules: -1
|
||||||
# indicates default (serial updates).
|
# indicates to use git default (serial updates). 0 uses as many jobs as there are
|
||||||
# Default: 0
|
# processors.
|
||||||
|
# Default: -1
|
||||||
fetch-jobs: ''
|
fetch-jobs: ''
|
||||||
|
|
||||||
# Whether to download Git-LFS files
|
# Whether to download Git-LFS files
|
||||||
|
|
|
@ -760,7 +760,7 @@ async function setup(testName: string): Promise<void> {
|
||||||
clean: true,
|
clean: true,
|
||||||
commit: '',
|
commit: '',
|
||||||
fetchDepth: 1,
|
fetchDepth: 1,
|
||||||
fetchJobs: 0,
|
fetchJobs: -1,
|
||||||
lfs: false,
|
lfs: false,
|
||||||
submodules: false,
|
submodules: false,
|
||||||
nestedSubmodules: false,
|
nestedSubmodules: false,
|
||||||
|
|
|
@ -75,7 +75,7 @@ describe('input-helper tests', () => {
|
||||||
expect(settings.commit).toBeTruthy()
|
expect(settings.commit).toBeTruthy()
|
||||||
expect(settings.commit).toBe('1234567890123456789012345678901234567890')
|
expect(settings.commit).toBe('1234567890123456789012345678901234567890')
|
||||||
expect(settings.fetchDepth).toBe(1)
|
expect(settings.fetchDepth).toBe(1)
|
||||||
expect(settings.fetchJobs).toBe(0)
|
expect(settings.fetchJobs).toBe(-1)
|
||||||
expect(settings.lfs).toBe(false)
|
expect(settings.lfs).toBe(false)
|
||||||
expect(settings.ref).toBe('refs/heads/some-ref')
|
expect(settings.ref).toBe('refs/heads/some-ref')
|
||||||
expect(settings.repositoryName).toBe('some-repo')
|
expect(settings.repositoryName).toBe('some-repo')
|
||||||
|
|
|
@ -57,8 +57,11 @@ inputs:
|
||||||
description: 'Number of commits to fetch. 0 indicates all history for all branches and tags.'
|
description: 'Number of commits to fetch. 0 indicates all history for all branches and tags.'
|
||||||
default: 1
|
default: 1
|
||||||
fetch-jobs:
|
fetch-jobs:
|
||||||
description: 'Number of fetches to perform simultaneously when updating submodules. 0 indicates default (serial updates).'
|
description: >
|
||||||
default: 0
|
Number of fetches to perform simultaneously when updating submodules:
|
||||||
|
-1 indicates to use git default (serial updates). 0 uses as many jobs as
|
||||||
|
there are processors.
|
||||||
|
default: -1
|
||||||
lfs:
|
lfs:
|
||||||
description: 'Whether to download Git-LFS files'
|
description: 'Whether to download Git-LFS files'
|
||||||
default: false
|
default: false
|
||||||
|
|
8
dist/index.js
vendored
8
dist/index.js
vendored
|
@ -5949,7 +5949,7 @@ class GitCommandManager {
|
||||||
if (recursive) {
|
if (recursive) {
|
||||||
args.push('--recursive');
|
args.push('--recursive');
|
||||||
}
|
}
|
||||||
if (fetchJobs > 0) {
|
if (fetchJobs > -1) {
|
||||||
args.push(`--jobs=${fetchJobs}`);
|
args.push(`--jobs=${fetchJobs}`);
|
||||||
}
|
}
|
||||||
yield this.execGit(args);
|
yield this.execGit(args);
|
||||||
|
@ -14571,9 +14571,9 @@ function getInputs() {
|
||||||
}
|
}
|
||||||
core.debug(`fetch depth = ${result.fetchDepth}`);
|
core.debug(`fetch depth = ${result.fetchDepth}`);
|
||||||
// Fetch jobs
|
// Fetch jobs
|
||||||
result.fetchJobs = Math.floor(Number(core.getInput('fetch-jobs') || '0'));
|
result.fetchJobs = Math.floor(Number(core.getInput('fetch-jobs') || '-1'));
|
||||||
if (isNaN(result.fetchJobs) || result.fetchJobs < 0) {
|
if (isNaN(result.fetchJobs) || result.fetchJobs < -1) {
|
||||||
result.fetchJobs = 0;
|
result.fetchJobs = -1;
|
||||||
}
|
}
|
||||||
core.debug(`fetch jobs = ${result.fetchJobs}`);
|
core.debug(`fetch jobs = ${result.fetchJobs}`);
|
||||||
// LFS
|
// LFS
|
||||||
|
|
|
@ -327,7 +327,7 @@ class GitCommandManager {
|
||||||
args.push('--recursive')
|
args.push('--recursive')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fetchJobs > 0) {
|
if (fetchJobs > -1) {
|
||||||
args.push(`--jobs=${fetchJobs}`)
|
args.push(`--jobs=${fetchJobs}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,9 +89,9 @@ export function getInputs(): IGitSourceSettings {
|
||||||
core.debug(`fetch depth = ${result.fetchDepth}`)
|
core.debug(`fetch depth = ${result.fetchDepth}`)
|
||||||
|
|
||||||
// Fetch jobs
|
// Fetch jobs
|
||||||
result.fetchJobs = Math.floor(Number(core.getInput('fetch-jobs') || '0'))
|
result.fetchJobs = Math.floor(Number(core.getInput('fetch-jobs') || '-1'))
|
||||||
if (isNaN(result.fetchJobs) || result.fetchJobs < 0) {
|
if (isNaN(result.fetchJobs) || result.fetchJobs < -1) {
|
||||||
result.fetchJobs = 0
|
result.fetchJobs = -1
|
||||||
}
|
}
|
||||||
core.debug(`fetch jobs = ${result.fetchJobs}`)
|
core.debug(`fetch jobs = ${result.fetchJobs}`)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue