-
-
Notifications
You must be signed in to change notification settings - Fork 192
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
Gitsigns fails to run git --version
#948
Comments
Can you edit the code and print the contents of |
@lewis6991 Here is the code I inserted: local obj = asystem({ 'git', '--version' })
-- new code below.
local f = assert( io.open( 'gitversion.txt', 'a+' ) )
f:write( 'obj.stderr:\n[' .. tostring( obj.stderr ) .. ']\n' )
f:write( 'obj.stdout:\n[' .. tostring( obj.stdout ) .. ']\n' )
f:write( 'obj keys/values:\n' )
for k, v in pairs( obj ) do
f:write( 'k=[' .. tostring( k ) .. '], v=[' .. tostring( v ) .. ']\n' )
end
f:write( '----------------------------------------------------\n' ) As you can see I added
But then for at least one buffer it fails, and in those cases prints the following:
let me know if you need any more info. |
Looks like it's erroring on the call that's returning empty. Honestly I don't really know how to proceed. I can't reproduce this so there's no way I can debug it. |
@lewis6991 As a hint, I think it only happens when I open a large number of files at once. I have an editor session that opens around 60 buffers (spread throughout 15 tabs). Perhaps gitsigns is trying to spawn subprocesses for each of those all at the same time, and something in the async/subprocess pipe mechanism is flaking out because there are too many. In fact, if I simply have the code retry the command, that fixes it as well: local obj = (function()
local o
repeat
o = asystem({ 'git', '--version' })
until (#o.stdout > 0) or (#o.stderr > 0)
return o
end)() Further evidence for this is that the failure doesn't tend to happen until one of the last few buffers is processed (e.g. the 58th one). Maybe this can help you to either reproduce it or determine what the issue is. |
I have the same issue, it fails when |
This is really hard to reproduce. I also have had this issue, but ever since deleting and re-creating my session, it does not repro. My only guess would be, that, since NVIM v0.10.0-dev-2660+g7549845e8 on WSL2 |
I've experienced this as well on nightly, but without opening large files. It seems to be random, but occasionally when opening recently edited files, I receive the above error. |
I have a project where it happens consistently. If I check if line is an empty string and let it silently error out the error does not bother me anymore; the code will still run successfully the next time it tries to set the version so I prefer this as workaround over getting the error consistently on startup. local line = vim.split(obj.stdout or '', '\n', { plain = true })[1]
if not line or line == "" then
err("Unable to detect git version as 'git --version' failed to return anything")
-- eprint(obj.stderr)
return
end |
Description
I'm seeing this consistently now when I load my editor session (I'm running the latest nvim 0.9.5 and the latest gitsigns):
It happens every time I open my editor session. It's been happening for a while now, hope that we can fix this.
When I run
git --version
on my system I get the expected output:and when I go into git.lua into the
_set_version
function where it is failing and I hard code that, then the issue goes away.Seems this command is flaky:
seems hard to imagine that it is anything in my environment that could be causing that, given how simple the command is.
Neovim version
0.9.5
Operating system and version
Linux64 Pop!_OS 20.04
Expected behavior
no exception
Actual behavior
exception given above
Minimal config
Steps to reproduce
I'm hoping someone can look at the error/code and determine what is going on without needing detailed steps. But if you need detailed steps I can try to provide them when I have time.
Gitsigns debug messages
No response
The text was updated successfully, but these errors were encountered: