diff --git a/extensions/git/src/git.ts b/extensions/git/src/git.ts index c38fdea0718..66d91da4d7a 100644 --- a/extensions/git/src/git.ts +++ b/extensions/git/src/git.ts @@ -1223,15 +1223,12 @@ export class Repository { args.push('-A'); } - args.push('--'); - if (paths && paths.length) { for (const chunk of splitInChunks(paths, MAX_CLI_LENGTH)) { - await this.run([...args, ...chunk]); + await this.run([...args, '--', ...chunk]); } } else { - args.push('.'); - await this.run(args); + await this.run([...args, '--', '.']); } } @@ -1441,10 +1438,11 @@ export class Repository { const limiter = new Limiter(5); const promises: Promise[] = []; + const args = ['clean', '-f', '-q']; for (const paths of groups) { for (const chunk of splitInChunks(paths, MAX_CLI_LENGTH)) { - promises.push(limiter.queue(() => this.run(['clean', '-f', '-q', '--', ...chunk]))); + promises.push(limiter.queue(() => this.run([...args, '--', ...chunk]))); } } @@ -1476,19 +1474,18 @@ export class Repository { // In case there are no branches, we must use rm --cached if (!result.stdout) { - args = ['rm', '--cached', '-r', '--']; + args = ['rm', '--cached', '-r']; } else { - args = ['reset', '-q', treeish, '--']; + args = ['reset', '-q', treeish]; } try { if (paths && paths.length > 0) { for (const chunk of splitInChunks(paths, MAX_CLI_LENGTH)) { - await this.run([...args, ...chunk]); + await this.run([...args, '--', ...chunk]); } } else { - args.push('.'); - await this.run(args); + await this.run([...args, '--', '.']); } } catch (err) { // In case there are merge conflicts to be resolved, git reset will output @@ -1977,10 +1974,10 @@ export class Repository { } async updateSubmodules(paths: string[]): Promise { - const args = ['submodule', 'update', '--']; + const args = ['submodule', 'update']; for (const chunk of splitInChunks(paths.map(sanitizePath), MAX_CLI_LENGTH)) { - await this.run([...args, ...chunk]); + await this.run([...args, '--', ...chunk]); } }