Compare commits

..

2 Commits

Author SHA1 Message Date
Mostafa Zaher 0a1ba3d6d0
Merge 81a936fd3c into f548e57e54 2026-09-07 20:55:38 +00:00
Mostafa Zaher 81a936fd3c 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`.

`--quiet` and `--progress` drive different output and compose rather than
conflict: `--progress` forces the transfer/update meter, while `--quiet`
drops the ref summary and other informational messages. `checkout` keeps
its `--progress` when quiet, so a slow checkout still reports progress.

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

Fixes #2409
2026-09-07 23:55:26 +03:00
3 changed files with 31 additions and 16 deletions

View File

@ -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)
await git.fetch(['refspec1'], {fetchDepth: 0, showProgress: true})
const args = mockExec.mock.calls.at(-1)?.[1] as string[]
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 () => {
@ -665,14 +667,14 @@ describe('Test quiet option', () => {
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)
await git.checkout('refs/heads/main', '')
expect(mockExec).toHaveBeenCalledWith(
expect.any(String),
['checkout', '--quiet', '--force', 'refs/heads/main'],
['checkout', '--quiet', '--progress', '--force', 'refs/heads/main'],
expect.any(Object)
)
})
@ -687,6 +689,7 @@ describe('Test quiet option', () => {
[
'checkout',
'--quiet',
'--progress',
'--force',
'-B',
'refs/heads/main',

17
dist/index.js vendored
View File

@ -35703,10 +35703,14 @@ class GitCommandManager {
await external_fs_namespaceObject.promises.appendFile(sparseCheckoutPath, `\n${sparseCheckout.join('\n')}\n`);
}
async checkout(ref, startPoint) {
// --progress overrides --quiet, so the two are mutually exclusive
const args = this.quiet
? ['checkout', '--quiet', '--force']
: ['checkout', '--progress', '--force'];
// --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');
if (startPoint) {
args.push('-B', ref, startPoint);
}
@ -35753,11 +35757,12 @@ 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');
}
else if (options.showProgress) {
if (options.showProgress) {
args.push('--progress');
}
if (options.filter) {

View File

@ -224,10 +224,14 @@ class GitCommandManager {
}
async checkout(ref: string, startPoint: string): Promise<void> {
// --progress overrides --quiet, so the two are mutually exclusive
const args = this.quiet
? ['checkout', '--quiet', '--force']
: ['checkout', '--progress', '--force']
// --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')
if (startPoint) {
args.push('-B', ref, startPoint)
} else {
@ -298,10 +302,13 @@ 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')
} else if (options.showProgress) {
}
if (options.showProgress) {
args.push('--progress')
}