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 () => {
|
||||
// The two flags drive different output and compose: --progress forces the
|
||||
// transfer meter, --quiet drops the per-ref summary.
|
||||
it('should prefer --quiet over --progress when both are requested', async () => {
|
||||
git = await createManager(true)
|
||||
|
||||
await git.fetch(['refspec1'], {fetchDepth: 0, showProgress: true})
|
||||
|
||||
const args = mockExec.mock.calls.at(-1)?.[1] as string[]
|
||||
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 () => {
|
||||
|
|
@ -667,14 +665,14 @@ describe('Test quiet option', () => {
|
|||
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)
|
||||
|
||||
await git.checkout('refs/heads/main', '')
|
||||
|
||||
expect(mockExec).toHaveBeenCalledWith(
|
||||
expect.any(String),
|
||||
['checkout', '--quiet', '--progress', '--force', 'refs/heads/main'],
|
||||
['checkout', '--quiet', '--force', 'refs/heads/main'],
|
||||
expect.any(Object)
|
||||
)
|
||||
})
|
||||
|
|
@ -689,7 +687,6 @@ describe('Test quiet option', () => {
|
|||
[
|
||||
'checkout',
|
||||
'--quiet',
|
||||
'--progress',
|
||||
'--force',
|
||||
'-B',
|
||||
'refs/heads/main',
|
||||
|
|
|
|||
|
|
@ -35703,14 +35703,10 @@ class GitCommandManager {
|
|||
await external_fs_namespaceObject.promises.appendFile(sparseCheckoutPath, `\n${sparseCheckout.join('\n')}\n`);
|
||||
}
|
||||
async checkout(ref, startPoint) {
|
||||
// --quiet and --progress drive different output and compose: --progress
|
||||
// controls the "Updating files" meter, --quiet silences the rest. Keeping
|
||||
// both means a slow checkout still reports progress while going quiet.
|
||||
const args = ['checkout'];
|
||||
if (this.quiet) {
|
||||
args.push('--quiet');
|
||||
}
|
||||
args.push('--progress', '--force');
|
||||
// --progress overrides --quiet, so the two are mutually exclusive
|
||||
const args = this.quiet
|
||||
? ['checkout', '--quiet', '--force']
|
||||
: ['checkout', '--progress', '--force'];
|
||||
if (startPoint) {
|
||||
args.push('-B', ref, startPoint);
|
||||
}
|
||||
|
|
@ -35757,12 +35753,11 @@ class GitCommandManager {
|
|||
// Tags are fetched explicitly via refspec when needed
|
||||
args.push('--no-tags');
|
||||
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) {
|
||||
// --progress overrides --quiet, so the two are mutually exclusive
|
||||
args.push('--quiet');
|
||||
}
|
||||
if (options.showProgress) {
|
||||
else if (options.showProgress) {
|
||||
args.push('--progress');
|
||||
}
|
||||
if (options.filter) {
|
||||
|
|
|
|||
|
|
@ -224,14 +224,10 @@ class GitCommandManager {
|
|||
}
|
||||
|
||||
async checkout(ref: string, startPoint: string): Promise<void> {
|
||||
// --quiet and --progress drive different output and compose: --progress
|
||||
// controls the "Updating files" meter, --quiet silences the rest. Keeping
|
||||
// both means a slow checkout still reports progress while going quiet.
|
||||
const args = ['checkout']
|
||||
if (this.quiet) {
|
||||
args.push('--quiet')
|
||||
}
|
||||
args.push('--progress', '--force')
|
||||
// --progress overrides --quiet, so the two are mutually exclusive
|
||||
const args = this.quiet
|
||||
? ['checkout', '--quiet', '--force']
|
||||
: ['checkout', '--progress', '--force']
|
||||
if (startPoint) {
|
||||
args.push('-B', ref, startPoint)
|
||||
} else {
|
||||
|
|
@ -302,13 +298,10 @@ class GitCommandManager {
|
|||
args.push('--no-tags')
|
||||
|
||||
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) {
|
||||
// --progress overrides --quiet, so the two are mutually exclusive
|
||||
args.push('--quiet')
|
||||
}
|
||||
|
||||
if (options.showProgress) {
|
||||
} else if (options.showProgress) {
|
||||
args.push('--progress')
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue