alpha2phi / modern-neovim

Crafting a modernized development environment with Neovim.
MIT License
139 stars 41 forks source link

fugitive.vim not working #23

Closed reet- closed 1 year ago

reet- commented 1 year ago

Hi,

First of all, thanks for this great neovim config! I'm currently trying to adapt it to my workflows and found that fugitive.vim is not working reliably.

How to reproduce:

  1. Open a project, make some changes to it
  2. :git
  3. Stage hunk and then
  4. Write commit message and :wq
  5. fugitive status still shows staged hunk, no commit is made

No suspicious log messages are in the log with -V10nvim.log.

But I get the following messages if I try e.g. to unstage a hunk:

Error detected while processing FocusGained Autocommands for "*"..function fugitive#DidChange[10]..<SNR>189_ReloadWinStatus[11]..<SNR>189_ReloadStatusBuffer[6]..fugitive#BufReadStatus[345]..FocusGained Autocommands for "*"..function fugitive#DidChange[10]..<SNR>189_ReloadWinStatus[11]..<SNR>189_ReloadStatusBuffer[6]..fugitive#BufReadStatus[26]..<SNR>189_NullError[1]..fugitive#Execute[19]..<SNR>189_JobExecute:
line    9:
E903: Process failed to start: too many open files: "/usr/bin/git"

Can you reproduce these findings? I'm using NVIM v0.10.0-dev-340+g33687f5e8 on Debian Buster. fugitive.vim is working with your neovim-for-beginner config on the same system.

Thanks!

mengwangk commented 1 year ago

It is fixed now in this commit - https://github.com/alpha2phi/modern-neovim/commit/268234975df52ef79237d248ad52a69590660e11

reet- commented 1 year ago

Thanks, I tested the commit and the status windows is updated after the commit :wq

However, when working with fugitive I still get:

Error detected while processing BufReadCmd Autocommands for "fugitive://*"..function fugitive#BufReadCmd[128]..BufReadCmd Autocommands for "fugitive://*"..function fugitive#BufReadCmd[13]..fugitive#Execute[19]..<SNR>78_JobExecute:
line    9:
E903: Process failed to start: too many open files: "/usr/bin/git"

I have no simple reproducer yet, it happens after a while it seems.

reet- commented 1 year ago

Ok, I got a reproducer now:

  1. Start the following in a terminal:
    $ while true; do for i in $(pidof nvim); do ls /proc/$i/fd/; done | wc -l && sleep 5; done
  2. Start nvim in another terminal, alpha screen. Open fds remain constant
  3. Open some file from a project managed with git, slight increase in open fds but constant
  4. :Git and do nothing, observe the increasing open fds
  5. count of open fds > ulimit -n (1024) -> EMFILE
0
41
44
44
49
48
48
90
120
150
180
210
240
282
312
342
390
438
468
498
540
570
600
630
660
690
720
750
780
810
840
870
900
936
966
996
1026 <-- EMFILE starts here
1044
1044
1044
1044
1044
1044
1044
1044
1044
mengwangk commented 1 year ago

It seems to be an issue between fugitive and lualine. In the lua/plugins/statusline/init.lua, you can add the fugitive type to be ignored

          disabled_filetypes = {
            statusline = { "alpha", "lazy", "fugitive", "" },
reet- commented 1 year ago

This fixes the issue, thanks!