Skip to content
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

git integration not working in Windows. #2466

Closed
peter-lyr opened this issue Oct 13, 2023 · 14 comments
Closed

git integration not working in Windows. #2466

peter-lyr opened this issue Oct 13, 2023 · 14 comments
Labels
awaiting feedback bug Something isn't working OS Windows specific to windows

Comments

@peter-lyr
Copy link

Description

5 git jobs have timed out after git.timeout 400ms, disabling git integration.

Neovim version

NVIM v0.9.2
Build type: RelWithDebInfo
LuaJIT 2.1.1694082368

Operating system and version

Windows 10

nvim-tree version

53b0bca

Clean room replication

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvt-min/site]]
local package_root = "/tmp/nvt-min/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
  require("packer").startup {
    {
      "wbthomason/packer.nvim",
      "nvim-tree/nvim-tree.lua",
      "nvim-tree/nvim-web-devicons",
      -- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. "/plugin/packer_compiled.lua",
      display = { non_interactive = true },
    },
  }
end
if vim.fn.isdirectory(install_path) == 0 then
  print "Installing nvim-tree and dependencies."
  vim.fn.system { "git", "clone", "--depth=1", "https://github.com/wbthomason/packer.nvim", install_path }
end
load_plugins()
require("packer").sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua setup()]]
vim.opt.termguicolors = true
vim.opt.cursorline = true

-- MODIFY NVIM-TREE SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
_G.setup = function()
  require("nvim-tree").setup {
	git = {
		enable = true,
		ignore = false,
	},
	filesystem_watchers = {
		enable = false,
		debounce_delay = 50,
	},
	log = {
		enable = true,
		types = {
			all = false,
			config = false,
			copy_paste = false,
			dev = false,
			diagnostics = false,
			git = true,
			profile = false,
			watcher = true,
        },
	},
	diagnostics = {
		enable = true,
		show_on_dirs = false,
	},
	update_focused_file = {
		enable = true
	},
	renderer = {
		group_empty = true,
	},
	filters = {
		dotfiles = false,
	},
  }
end

Steps to reproduce

  1. nvim -nu C:\Users\l\Desktop\nvt-min.lua
  2. :NvimTreeOpen

Expected behavior

git highlight status

Actual behavior

5 git jobs have timed out after git.timeout 400ms, disabling git integration.

nvim-tree.log:

[2023-10-14 00:43:18] [git] git -C C:\nv\nvim-win64-092\share\nvim\runtime\pack\nvim_config rev-parse --show-toplevel --absolute-git-dir
C:/nv/nvim-win64-092/share/nvim/runtime/pack/nvim_config
C:/nv/nvim-win64-092/share/nvim/runtime/pack/nvim_config/.git
[2023-10-14 00:43:19] [git] git -C C:\nv\nvim-win64-092\share\nvim\runtime\pack\nvim_config
config status.showUntrackedFiles
fatal: cannot change to 'C:\nv\nvim-win64-092\share\nvim\runtime\pack\nvim_config
': Invalid argument
[2023-10-14 00:43:19] [git] running job with timeout 400ms
[2023-10-14 00:43:19] [git] git --no-optional-locks status --porcelain=v1 -z --ignored=matching -u
[2023-10-14 00:43:19] [git] job timed out C:\nv\nvim-win64-092\share\nvim\runtime\pack\nvim_config
nil
[2023-10-14 00:43:25] [git] running job with timeout 400ms
[2023-10-14 00:43:25] [git] git --no-optional-locks status --porcelain=v1 -z --ignored=matching -u
[2023-10-14 00:43:26] [git] job timed out C:\nv\nvim-win64-092\share\nvim\runtime\pack\nvim_config
nil
[2023-10-14 00:43:27] [git] running job with timeout 400ms
[2023-10-14 00:43:27] [git] git --no-optional-locks status --porcelain=v1 -z --ignored=matching -u
[2023-10-14 00:43:28] [git] job timed out C:\nv\nvim-win64-092\share\nvim\runtime\pack\nvim_config
nil
[2023-10-14 00:43:28] [git] running job with timeout 400ms
[2023-10-14 00:43:28] [git] git --no-optional-locks status --porcelain=v1 -z --ignored=matching -u
[2023-10-14 00:43:28] [git] job timed out C:\nv\nvim-win64-092\share\nvim\runtime\pack\nvim_config
nil
[2023-10-14 00:43:28] [git] running job with timeout 400ms
[2023-10-14 00:43:28] [git] git --no-optional-locks status --porcelain=v1 -z --ignored=matching -u
[2023-10-14 00:43:29] [git] job timed out C:\nv\nvim-win64-092\share\nvim\runtime\pack\nvim_config
nil
[2023-10-14 00:43:29] [git] disabling git integration
[2023-10-14 00:43:29] [git] purge_state

@peter-lyr peter-lyr added the bug Something isn't working label Oct 13, 2023
@gegoune
Copy link
Collaborator

gegoune commented Oct 14, 2023

You could try increasing timeout, it might be genuine slowness of your system. Please bump :h nvim-tree.git.timeout to some higher value.

@peter-lyr
Copy link
Author

I have tried. It's not working and it stucked for a long time.

@peter-lyr
Copy link
Author

It is 28c3980 and later commits that make git status highlight not working.
Thx.

@alex-courtis
Copy link
Member

[2023-10-14 00:43:19] [git] git -C C:\nv\nvim-win64-092\share\nvim\runtime\pack\nvim_config
config status.showUntrackedFiles
fatal: cannot change to 'C:\nv\nvim-win64-092\share\nvim\runtime\pack\nvim_config
': Invalid argument

This looks like it might be a path escaping issue. 28c3980 did make a change to always use absolute paths, to allow for worktrees etc.

Please revert to 0074120 , repeat the test and report the logs.

@alex-courtis
Copy link
Member

You could try increasing timeout, it might be genuine slowness of your system.

That sounds likely.

How long does git --no-optional-locks status --porcelain=v1 -z --ignored=matching -u actually take?

On UNIX we'd do something like:

: ; time git --no-optional-locks status --porcelain=v1 -z --ignored=matching -u
!! doc/tagsgit --no-optional-locks status --porcelain=v1 -z --ignored=matching -u  0.00s user 0.01s system 89% cpu 0.006 total

I do not know what the windows equivalent of time is.

@peter-lyr
Copy link
Author

I reverted to 0074120.

in git bash:

l@DESKTOP-STCN8A0 MINGW64 /c/nv/nvim-win64-092/share/nvim/runtime/pack/nvim_config (lsp_cmp)
$ time git --no-optional-locks status --porcelain=v1 -z --ignored=matching -u
!! cli/neovim.ico.o !! nvim_qt_here.exe !! nvim_qt_here.reg !! open-with-cmd.exe !! open-with-ps1.exe !! rm_nvim_qt_here.reg !! start-nvim-qt.exe !! start/lazy/lua/plugins/nvimtree_oftendirs.exe
real    0m0.040s
user    0m0.000s
sys     0m0.015s

nvim-tree.log

[2023-10-15 11:42:28] [git] { "git", "-C", "C:\\nv\\nvim-win64-092\\share\\nvim\\runtime\\pack\\nvim_config", "rev-parse", "--show-toplevel" }
C:/nv/nvim-win64-092/share/nvim/runtime/pack/nvim_config
[2023-10-15 11:42:28] [git] { "git", "-C", "C:\\nv\\nvim-win64-092\\share\\nvim\\runtime\\pack\\nvim_config", "config", "status.showUntrackedFiles" }
[2023-10-15 11:42:28] [git] running job with timeout 400ms
[2023-10-15 11:42:28] [git] git --no-optional-locks status --porcelain=v1 -z --ignored=matching -u
!! cli/neovim.ico.o
!! nvim_qt_here.exe
!! nvim_qt_here.reg
!! open-with-cmd.exe
!! open-with-ps1.exe
!! rm_nvim_qt_here.reg
!! start-nvim-qt.exe
!! start/lazy/lua/plugins/nvimtree_oftendirs.exe
[2023-10-15 11:42:28] [git] done
[2023-10-15 11:42:28] [git] job success    C:\nv\nvim-win64-092\share\nvim\runtime\pack\nvim_config nil
[2023-10-15 11:42:59] [watcher] purge_watchers
[2023-10-15 11:42:59] [git] purge_state
[2023-10-15 11:42:59] [watcher] purge_watchers
[2023-10-15 11:42:59] [watcher] purge_watchers
[2023-10-15 11:43:10] [git] { "git", "-C", "C:\\nv\\nvim-win64-092\\share\\nvim\\runtime\\pack\\nvim_config", "rev-parse", "--show-toplevel" }
C:/nv/nvim-win64-092/share/nvim/runtime/pack/nvim_config
[2023-10-15 11:43:10] [git] running job with timeout 400ms
[2023-10-15 11:43:10] [git] git --no-optional-locks status --porcelain=v1 -z --ignored=matching -u
!! cli/neovim.ico.o
!! nvim_qt_here.exe
!! nvim_qt_here.reg
!! open-with-cmd.exe
!! open-with-ps1.exe
!! rm_nvim_qt_here.reg
!! start-nvim-qt.exe
!! start/lazy/lua/plugins/nvimtree_oftendirs.exe
[2023-10-15 11:43:10] [git] done
[2023-10-15 11:43:10] [git] job success    C:\nv\nvim-win64-092\share\nvim\runtime\pack\nvim_config nil

@alex-courtis
Copy link
Member

Issue could be related to #2467 Normalising paths may resolve this.

Which variant of windows are you using @peter-lyr ? Powershell, WLS, msys, cygwin, something else?

I'd be most grateful if you ran a feature flag audit for your windows variant, to assist us in dealing with future issues.

Please open and :source this feature flag enumerator:
has.lua.gz

@alex-courtis alex-courtis added the OS Windows specific to windows label Oct 15, 2023
@peter-lyr
Copy link
Author

Thank you @alex-courtis.

I didn't use any CLI. I just open nvim-qt.exe.

has_list.log

bsd=0
linux=0
sun=0
unix=0
win32=1
win64=1
fname_case=0
acl=0
autochdir=1
arabic=1
autocmd=1
browsefilter=1
byte_offset=1
cindent=1
cmdline_compl=1
cmdline_hist=1
cmdwin=1
comments=1
conceal=1
cursorbind=1
cursorshape=1
dialog_con=1
diff=1
digraphs=1
eval=1
ex_extra=1
extra_search=1
file_in_path=1
filterpipe=1
find_in_path=1
float=1
folding=1
fork=0
gettext=1
iconv=1
insert_expand=1
jumplist=1
keymap=1
lambda=1
langmap=1
libcall=1
linebreak=1
lispindent=1
listcmds=1
localmap=1
mac=0
macunix=0
osx=0
osxdarwin=0
menu=1
mksession=1
modify_fname=1
mouse=1
multi_byte=1
multi_lang=1
nanotime=1
num64=1
packages=1
path_extra=1
persistent_undo=1
profile=1
pythonx=1
reltime=1
quickfix=1
rightleft=1
scrollbind=1
showcmd=1
cmdline_info=1
shada=1
signs=1
smartindent=1
startuptime=1
statusline=1
spell=1
syntax=1
system=1
tablineat=1
tag_binary=1
termguicolors=1
termresponse=1
textobjects=1
timers=1
title=1
user_commands=1
vartabs=1
vertsplit=1
virtualedit=1
visual=1
visualextra=1
vreplace=1
wildignore=1
wildmenu=1
windows=1
winaltkeys=1
writebackup=1
nvim=1
gui_running=1
patch=0
ttyin=0
ttyout=0
multi_byte_encoding=1
syntax_items=0
clipboard_working=1
clipboard=1
wsl=0
vim_starting=0

@alex-courtis
Copy link
Member

Many thanks for the feature flags @peter-lyr , it was very enlightening: https://github.com/nvim-tree/nvim-tree.lua/wiki/Development#os-feature-flags

@alex-courtis
Copy link
Member

@peter-lyr I'd be most grateful if you tested an attempted fix:

I'm flying pretty blind here so we might need a few rounds of testing.

cd /path/to/nvim-tree.lua
git pull
git checkout 2466-windows-git-failures

My hypothesis is that git -C ... rev-parse --show-toplevel --absolute-git-dir is returning \r instead of or in addition to `\n'.

@alex-courtis
Copy link
Member

A more comprehensive fix has been applied and has been released on master: #2478

@peter-lyr please update nvim-tree to current master or later and re-test.

@alex-courtis
Copy link
Member

The fix seems stable for other cases / users, as no news is good news.

Please reopen if you experience further issues.

@jinzhongjia
Copy link

em.. This problem still seems to be triggered (I can't stably surface it yet), I have adjusted the timeout to 1000

@jinzhongjia
Copy link

I have now enabled the log of nvim-tree. I will report when it occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback bug Something isn't working OS Windows specific to windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants