mirror of https://github.com/actions/checkout
Compare commits
2 Commits
0a1ba3d6d0
...
32fd82f896
| Author | SHA1 | Date |
|---|---|---|
|
|
32fd82f896 | |
|
|
4dae3c9275 |
|
|
@ -624,16 +624,14 @@ describe('Test quiet option', () => {
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should pass both --quiet and --progress to fetch when both are requested', async () => {
|
it('should prefer --quiet over --progress 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).toContain('--progress')
|
expect(args).not.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 () => {
|
||||||
|
|
@ -667,14 +665,14 @@ describe('Test quiet option', () => {
|
||||||
expect(args).not.toContain('--quiet')
|
expect(args).not.toContain('--quiet')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should checkout with --quiet alongside --progress when quiet is true', async () => {
|
it('should checkout with --quiet instead of --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', '--progress', '--force', 'refs/heads/main'],
|
['checkout', '--quiet', '--force', 'refs/heads/main'],
|
||||||
expect.any(Object)
|
expect.any(Object)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
@ -689,7 +687,6 @@ describe('Test quiet option', () => {
|
||||||
[
|
[
|
||||||
'checkout',
|
'checkout',
|
||||||
'--quiet',
|
'--quiet',
|
||||||
'--progress',
|
|
||||||
'--force',
|
'--force',
|
||||||
'-B',
|
'-B',
|
||||||
'refs/heads/main',
|
'refs/heads/main',
|
||||||
|
|
|
||||||
|
|
@ -35703,14 +35703,10 @@ 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) {
|
||||||
// --quiet and --progress drive different output and compose: --progress
|
// --progress overrides --quiet, so the two are mutually exclusive
|
||||||
// controls the "Updating files" meter, --quiet silences the rest. Keeping
|
const args = this.quiet
|
||||||
// both means a slow checkout still reports progress while going quiet.
|
? ['checkout', '--quiet', '--force']
|
||||||
const args = ['checkout'];
|
: ['checkout', '--progress', '--force'];
|
||||||
if (this.quiet) {
|
|
||||||
args.push('--quiet');
|
|
||||||
}
|
|
||||||
args.push('--progress', '--force');
|
|
||||||
if (startPoint) {
|
if (startPoint) {
|
||||||
args.push('-B', ref, startPoint);
|
args.push('-B', ref, startPoint);
|
||||||
}
|
}
|
||||||
|
|
@ -35757,12 +35753,11 @@ 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');
|
||||||
}
|
}
|
||||||
if (options.showProgress) {
|
else if (options.showProgress) {
|
||||||
args.push('--progress');
|
args.push('--progress');
|
||||||
}
|
}
|
||||||
if (options.filter) {
|
if (options.filter) {
|
||||||
|
|
|
||||||
|
|
@ -224,14 +224,10 @@ class GitCommandManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkout(ref: string, startPoint: string): Promise<void> {
|
async checkout(ref: string, startPoint: string): Promise<void> {
|
||||||
// --quiet and --progress drive different output and compose: --progress
|
// --progress overrides --quiet, so the two are mutually exclusive
|
||||||
// controls the "Updating files" meter, --quiet silences the rest. Keeping
|
const args = this.quiet
|
||||||
// both means a slow checkout still reports progress while going quiet.
|
? ['checkout', '--quiet', '--force']
|
||||||
const args = ['checkout']
|
: ['checkout', '--progress', '--force']
|
||||||
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 {
|
||||||
|
|
@ -302,13 +298,10 @@ 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