This commit is contained in:
João Moreno
2020-05-27 15:27:13 +02:00
parent 9fcc5e8195
commit 8cce062aaf

View File

@@ -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<any>[] = [];
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<void> {
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]);
}
}