Comments (8)
@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.
from gitsigns.nvim.
Can you edit the code and print the contents of obj
?
from gitsigns.nvim.
@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 [
and ]
in there so that you could see the exact spacing content of the printed values. Then I open my editor with a couple of files in separate tabs (as usual). For most of the buffers git --version
succeeds; in those cases it prints the following:
----------------------------------------------------
obj.stderr:
[]
obj.stdout:
[git version 2.25.1
]
obj keys/values:
k=[stdout], v=[git version 2.25.1
]
k=[stderr], v=[]
k=[code], v=[0]
k=[signal], v=[0]
----------------------------------------------------
But then for at least one buffer it fails, and in those cases prints the following:
----------------------------------------------------
obj.stderr:
[]
obj.stdout:
[]
obj keys/values:
k=[stdout], v=[]
k=[stderr], v=[]
k=[code], v=[0]
k=[signal], v=[0]
----------------------------------------------------
let me know if you need any more info.
from gitsigns.nvim.
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.
from gitsigns.nvim.
I have the same issue, it fails when git --version
returns empty output and retrying fixes the problem. It seems to happen a most often when I open big fugitive.vim diffs (dd
in git status window on big files). And sometimes when I start nvim with a file and immediately start moving cursor, though this seems strange.
from gitsigns.nvim.
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 asystem
delegates to vim.system
on nightly, there is some race condition in it?
NVIM v0.10.0-dev-2660+g7549845e8 on WSL2
from gitsigns.nvim.
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.
from gitsigns.nvim.
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
from gitsigns.nvim.
Related Issues (20)
- How to make git signs appear after line numbers
- Problem with colour of signs HOT 2
- Remove the vimfn sign backend with Nvim 0.10
- Feature request: get commit hash for the current line HOT 1
- Error when switching between index and worktree version of file (using vim-fugitive) HOT 6
- Error when deleting a buffer before `blame_line` loads
- Having problems with `gitsigns` and `nvim-colorizer` HOT 2
- `gitsigns_head` shows `nil` instead of revision
- Feature Request: Allow changing blame base. HOT 1
- gitsign cannot attach if nvim starts from "run" window HOT 2
- Attempt to index a nil value after executing "GDelete" HOT 2
- Syntax highlighting fails after opening linehl HOT 1
- Configuring git blame HOT 2
- Error after update – gitsigns: Ignoring invalid configuration field 'on_attach_pre' HOT 8
- Git current line blame overlap with text when split windows HOT 1
- git blame fails -- looks like the git command is incorrect HOT 3
- error in executing `:Gitsigns preview_hunk_inline ` HOT 2
- null-ls format panic when apply path PR#983 HOT 3
- Gitsigns assertion error in folder not using git HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gitsigns.nvim.