mirror of https://github.com/actions/checkout
Compare commits
2 Commits
32fd82f896
...
0a1ba3d6d0
| Author | SHA1 | Date |
|---|---|---|
|
|
0a1ba3d6d0 | |
|
|
81a936fd3c |
|
|
@ -624,14 +624,16 @@ describe('Test quiet option', () => {
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should prefer --quiet over --progress when both are requested', async () => {
|
it('should pass both --quiet and --progress to fetch when both are requested', async () => {
|
||||||
|
// The two flags drive different output and compose: --progress forces the
|
||||||
|
// transfer meter, --quiet drops the per-ref summary.
|
||||||
git = await createManager(true)
|
git = await createManager(true)
|
||||||
|
|
||||||
await git.fetch(['refspec1'], {fetchDepth: 0, showProgress: true})
|
await git.fetch(['refspec1'], {fetchDepth: 0, showProgress: true})
|
||||||
|
|
||||||
const args = mockExec.mock.calls.at(-1)?.[1] as string[]
|
const args = mockExec.mock.calls.at(-1)?.[1] as string[]
|
||||||
expect(args).toContain('--quiet')
|
expect(args).toContain('--quiet')
|
||||||
expect(args).not.toContain('--progress')
|
expect(args).toContain('--progress')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should not pass --quiet to fetch when quiet is false', async () => {
|
it('should not pass --quiet to fetch when quiet is false', async () => {
|
||||||
|
|
@ -665,14 +667,14 @@ describe('Test quiet option', () => {
|
||||||
expect(args).not.toContain('--quiet')
|
expect(args).not.toContain('--quiet')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should checkout with --quiet instead of --progress when quiet is true', async () => {
|
it('should checkout with --quiet alongside --progress when quiet is true', async () => {
|
||||||
git = await createManager(true)
|
git = await createManager(true)
|
||||||
|
|
||||||
await git.checkout('refs/heads/main', '')
|
await git.checkout('refs/heads/main', '')
|
||||||
|
|
||||||
expect(mockExec).toHaveBeenCalledWith(
|
expect(mockExec).toHaveBeenCalledWith(
|
||||||
expect.any(String),
|
expect.any(String),
|
||||||
['checkout', '--quiet', '--force', 'refs/heads/main'],
|
['checkout', '--quiet', '--progress', '--force', 'refs/heads/main'],
|
||||||
expect.any(Object)
|
expect.any(Object)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
@ -687,6 +689,7 @@ describe('Test quiet option', () => {
|
||||||
[
|
[
|
||||||
'checkout',
|
'checkout',
|
||||||
'--quiet',
|
'--quiet',
|
||||||
|
'--progress',
|
||||||
'--force',
|
'--force',
|
||||||
'-B',
|
'-B',
|
||||||
'refs/heads/main',
|
'refs/heads/main',
|
||||||
|
|
|
||||||
|
|
@ -35703,10 +35703,14 @@ class GitCommandManager {
|
||||||
await external_fs_namespaceObject.promises.appendFile(sparseCheckoutPath, `\n${sparseCheckout.join('\n')}\n`);
|
await external_fs_namespaceObject.promises.appendFile(sparseCheckoutPath, `\n${sparseCheckout.join('\n')}\n`);
|
||||||
}
|
}
|
||||||
async checkout(ref, startPoint) {
|
async checkout(ref, startPoint) {
|
||||||
// --progress overrides --quiet, so the two are mutually exclusive
|
// --quiet and --progress drive different output and compose: --progress
|
||||||
const args = this.quiet
|
// controls the "Updating files" meter, --quiet silences the rest. Keeping
|
||||||
? ['checkout', '--quiet', '--force']
|
// both means a slow checkout still reports progress while going quiet.
|
||||||
: ['checkout', '--progress', '--force'];
|
const args = ['checkout'];
|
||||||
|
if (this.quiet) {
|
||||||
|
args.push('--quiet');
|
||||||
|
}
|
||||||
|
args.push('--progress', '--force');
|
||||||
if (startPoint) {
|
if (startPoint) {
|
||||||
args.push('-B', ref, startPoint);
|
args.push('-B', ref, startPoint);
|
||||||
}
|
}
|
||||||
|
|
@ -35753,11 +35757,12 @@ class GitCommandManager {
|
||||||
// Tags are fetched explicitly via refspec when needed
|
// Tags are fetched explicitly via refspec when needed
|
||||||
args.push('--no-tags');
|
args.push('--no-tags');
|
||||||
args.push('--prune', '--no-recurse-submodules');
|
args.push('--prune', '--no-recurse-submodules');
|
||||||
|
// Independent switches: --quiet drops the ref summary, --progress forces
|
||||||
|
// the transfer meter. Either, both, or neither is meaningful.
|
||||||
if (this.quiet) {
|
if (this.quiet) {
|
||||||
// --progress overrides --quiet, so the two are mutually exclusive
|
|
||||||
args.push('--quiet');
|
args.push('--quiet');
|
||||||
}
|
}
|
||||||
else if (options.showProgress) {
|
if (options.showProgress) {
|
||||||
args.push('--progress');
|
args.push('--progress');
|
||||||
}
|
}
|
||||||
if (options.filter) {
|
if (options.filter) {
|
||||||
|
|
|
||||||
|
|
@ -224,10 +224,14 @@ class GitCommandManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkout(ref: string, startPoint: string): Promise<void> {
|
async checkout(ref: string, startPoint: string): Promise<void> {
|
||||||
// --progress overrides --quiet, so the two are mutually exclusive
|
// --quiet and --progress drive different output and compose: --progress
|
||||||
const args = this.quiet
|
// controls the "Updating files" meter, --quiet silences the rest. Keeping
|
||||||
? ['checkout', '--quiet', '--force']
|
// both means a slow checkout still reports progress while going quiet.
|
||||||
: ['checkout', '--progress', '--force']
|
const args = ['checkout']
|
||||||
|
if (this.quiet) {
|
||||||
|
args.push('--quiet')
|
||||||
|
}
|
||||||
|
args.push('--progress', '--force')
|
||||||
if (startPoint) {
|
if (startPoint) {
|
||||||
args.push('-B', ref, startPoint)
|
args.push('-B', ref, startPoint)
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -298,10 +302,13 @@ class GitCommandManager {
|
||||||
args.push('--no-tags')
|
args.push('--no-tags')
|
||||||
|
|
||||||
args.push('--prune', '--no-recurse-submodules')
|
args.push('--prune', '--no-recurse-submodules')
|
||||||
|
// Independent switches: --quiet drops the ref summary, --progress forces
|
||||||
|
// the transfer meter. Either, both, or neither is meaningful.
|
||||||
if (this.quiet) {
|
if (this.quiet) {
|
||||||
// --progress overrides --quiet, so the two are mutually exclusive
|
|
||||||
args.push('--quiet')
|
args.push('--quiet')
|
||||||
} else if (options.showProgress) {
|
}
|
||||||
|
|
||||||
|
if (options.showProgress) {
|
||||||
args.push('--progress')
|
args.push('--progress')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue