Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail on adding more then 384 files in a single commit - ENAMETOOLONG error. #461

Closed
GalHalupSeaLights opened this issue Jun 2, 2020 · 2 comments

Comments

@GalHalupSeaLights
Copy link

I have tried to add a large number of files in a single commit and keep getting ENAMETOOLONG error.
I checked and validated that any number of files above 384 files in a single command (add, commit) keep failing with this error.

code:"ENAMETOOLONG"
errno:"ENAMETOOLONG"
message:"spawn ENAMETOOLONG"
stack:"Error: spawn ENAMETOOLONG
at _errnoException (util.js:992:11)
at ChildProcess.spawn (internal/child_process.js:323:11)
at Object.exports.spawn (child_process.js:502:9)
at gitResponse.Promise (C:\Users\Gal\tmp\create-git-files\node_modules\simple-git\src\lib\git-executor.js:82:49)
at new Promise ()
at GitExecutor. (C:\Users\Gal\tmp\create-git-files\node_modules\simple-git\src\lib\git-executor.js:62:20)
at Generator.next ()
at __awaiter (C:\Users\Gal\tmp\create-git-files\node_modules\simple-git\src\lib\git-executor.js:8:71)
at new Promise ()
at __awaiter (C:\Users\Gal\tmp\create-git-files\node_modules\simple-git\src\lib\git-executor.js:4:12)"
syscall:"spawn"

@Kikkomann
Copy link

Has this been looked into? I have the same issue.

@steveukx
Copy link
Owner

Hi, this error is system dependent and caused by referencing a file that has a file name that is too long, or where the overall character length of arguments sent to a spawned process exceed a maximum threshold.

See this stack overflow post for more details on what constitutes a name that is too long. Or this issue for details on argument length.

In either case, when you're attempting to add a large number of files at once, batching the files or adding them individually would improve the ability to decipher the problem from the error messages.

For example:

const fileList = readDir(somePath);
for (const path of fileList) {
  (await git.add(path)).catch(err => console.error(`Could not add "${path}"`, err);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants