Giter Site home page Giter Site logo

Comments (8)

no-more-secrets avatar no-more-secrets commented on June 12, 2024 2

@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.

lewis6991 avatar lewis6991 commented on June 12, 2024

Can you edit the code and print the contents of obj?

from gitsigns.nvim.

no-more-secrets avatar no-more-secrets commented on June 12, 2024

@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.

lewis6991 avatar lewis6991 commented on June 12, 2024

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.

jedrzejboczar avatar jedrzejboczar commented on June 12, 2024

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.

bugabinga avatar bugabinga commented on June 12, 2024

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.

aarondill avatar aarondill commented on June 12, 2024

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.

Willem-J-an avatar Willem-J-an commented on June 12, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.