Skip to content

Commit 060b821

Browse files
committed
fix: maxFileAdd env var
1 parent 3032066 commit 060b821

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/shared/localShadowRepo.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import * as path from 'path';
99
import * as os from 'os';
1010
import * as fs from 'graceful-fs';
1111
import { NamedPackageDir, Logger, SfError } from '@salesforce/core';
12+
import { env } from '@salesforce/kit';
1213
import * as git from 'isomorphic-git';
1314
import { chunkArray, isLwcLocalOnlyTest, pathIsInFolder } from './functions';
1415

@@ -60,7 +61,9 @@ export class ShadowRepo {
6061
this.projectPath = options.projectPath;
6162
this.packageDirs = options.packageDirs;
6263
this.isWindows = os.type() === 'Windows_NT';
63-
this.maxFileAdd = 8000;
64+
65+
const batchSize = env.getNumber('SFDX_SOURCE_TRACKING_BATCH_SIZE');
66+
this.maxFileAdd = batchSize ? batchSize : this.isWindows ? 8000 : 15000;
6467
}
6568

6669
// think of singleton behavior but unique to the projectPath
@@ -244,7 +247,14 @@ export class ShadowRepo {
244247
} catch (e) {
245248
if (e instanceof git.Errors.MultipleGitError) {
246249
this.logger.error('multiple errors on git.add', e.errors.slice(0, 5));
247-
const error = new SfError(e.message, e.name, [], 1);
250+
const error = new SfError(
251+
e.message,
252+
e.name,
253+
[
254+
`This error may be thrown because the number of files that source tracking is batching is exceeding your user specific file limits. Either increase your hard file limit in the same session with 'ulimit -Hn ${this.maxFileAdd}', or set the 'SFDX_SOURCE_TRACKING_BATCH_SIZE' environment variable to a value lower than the output of 'ulimit -Hn'`,
255+
],
256+
1
257+
);
248258
error.setData(e.errors);
249259
throw error;
250260
}

0 commit comments

Comments
 (0)