Compare commits

..

2 Commits

Author SHA1 Message Date
Mostafa Zaher 32fd82f896
Merge 4dae3c9275 into f548e57e54 2026-09-05 13:49:20 +03:00
Mostafa Zaher 4dae3c9275 Add a quiet input to suppress git output
Adds a `quiet` input (default: false) that passes `--quiet` to the git
commands that fetch and check out the repository: `fetch`, `checkout`,
`checkout --detach`, and `submodule update`.

With `fetch-depth: 0` the refspec covers every branch and tag, so git
prints a `From <url>` line plus one `* [new branch]` / `* [new tag]` line
per ref. On a ref-heavy repository that summary is the bulk of the
checkout log, and `show-progress: false` does not remove it -- that input
only ever controlled `--progress`.

`--progress` overrides `--quiet` on both `fetch` and `checkout`, so the
two are mutually exclusive here and `--quiet` wins.

`git lfs fetch` has no `--quiet` flag, so LFS output is unchanged.

Fixes #2409
2026-09-05 13:45:32 +03:00
3 changed files with 16 additions and 31 deletions

View File

@ -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',

17
dist/index.js vendored
View File

@ -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) {

View File

@ -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')
} }