Skip to content

"Process failed to start" when many files are unstaged #2440

@idbrii

Description

@idbrii

I hit a git error while switching branches and git left many files from my destination branch unstaged (not fugitive's problem). I didn't realize that's what was wrong, but running :Git resulted in an error and no status buffer (in neovim):

E903: Process failed to start: name too long: "C:/Users/iiiiiiii/scoop/shims/git.EXE"

I think the command is too long and not the process name. I put some debug code in s:JobExecute() to store a:argv and it's git followed by some options and -- and then 12,000 filenames.

In the end, my solution was to git reset --hard HEAD to remove those files, but it'd be nice if fugitive failed more gracefully. I had to use the command line to get useful info.

My failure occurred in Win11, but I tried the same in Ubuntu (WSL) and vim hung.


According to the vim callstack, this line is the failing call to fugitive#Execute:

let stat.diff['Unstaged'] = fugitive#Execute(diff_cmd + ['--'] + map(copy(unstaged), 'stat.work_tree . "/" . v:val.relative[0]'), function('len'))

Should it have some kind of limit? I thought these diff patches were generated on-demand, so maybe that's an even better solution?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions