Skip to content

Commit 60d906f

Browse files
rzj17jzyrobert
authored andcommitted
Modify git add/revert to use splitInChunks
1 parent a1ed386 commit 60d906f

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

extensions/git/src/git.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,12 +1226,13 @@ export class Repository {
12261226
args.push('--');
12271227

12281228
if (paths && paths.length) {
1229-
args.push.apply(args, paths.map(sanitizePath));
1229+
for (const chunk of splitInChunks(paths, MAX_CLI_LENGTH)) {
1230+
await this.run([...args, ...chunk]);
1231+
}
12301232
} else {
12311233
args.push('.');
1234+
await this.run(args);
12321235
}
1233-
1234-
await this.run(args);
12351236
}
12361237

12371238
async rm(paths: string[]): Promise<void> {
@@ -1480,14 +1481,15 @@ export class Repository {
14801481
args = ['reset', '-q', treeish, '--'];
14811482
}
14821483

1483-
if (paths && paths.length) {
1484-
args.push.apply(args, paths.map(sanitizePath));
1485-
} else {
1486-
args.push('.');
1487-
}
1488-
14891484
try {
1490-
await this.run(args);
1485+
if (paths && paths.length > 0) {
1486+
for (const chunk of splitInChunks(paths, MAX_CLI_LENGTH)) {
1487+
await this.run([...args, ...chunk]);
1488+
}
1489+
} else {
1490+
args.push('.');
1491+
await this.run(args);
1492+
}
14911493
} catch (err) {
14921494
// In case there are merge conflicts to be resolved, git reset will output
14931495
// some "needs merge" data. We try to get around that.

0 commit comments

Comments
 (0)