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

Hang at startup when $GIT_DIR is set #500

Closed
loiccoyle opened this issue Jul 9, 2021 · 9 comments
Closed

Hang at startup when $GIT_DIR is set #500

loiccoyle opened this issue Jul 9, 2021 · 9 comments

Comments

@loiccoyle
Copy link

When setting GIT_DIR to a .git folder, nvim hangs for ~10s at startup.

To reproduce:

GIT_DIR=/some/repo/.git nvim

It doesn't occur when I remove nvim-tree.

@loiccoyle
Copy link
Author

For more info about the plugins I use see: wbthomason/packer.nvim#465

@kyazdani42
Copy link
Member

could not reproduce the lag, can you give me a minimal sample config from which you can reproduce the error (like only a packer and nvim-tree with config options or not ?)

@loiccoyle
Copy link
Author

I can reproduce it with:
init.lua:

require('plugins')

lua/plugins.lua:

local execute = vim.api.nvim_command
local fn = vim.fn

local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'

if fn.empty(fn.glob(install_path)) > 0 then
  fn.system({'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path})
  execute 'packadd packer.nvim'
end

local packer = require('packer')
return packer.startup(function(use)
  -- Plugin Manager
  use {'wbthomason/packer.nvim'}
  -- File explorer
  use {'kyazdani42/nvim-tree.lua'}
end)

Make sure to clear your compiled packer file and such....

To trigger the hang:

cd 
git clone https://github.com/kyazdani42/nvim-tree.lua
GIT_DIR=nvim-tree.lua/.git nvim

nvim is unresponsive for 7-8s after startup, afterwards, it works as expected.

If I don't set GIT_DIR all is good.

@kyazdani42
Copy link
Member

very weird indeed, i think this might be caused by too many git changes and a lot of git commands issued actually. It's not really something that i can fix imo.

@kyazdani42
Copy link
Member

i managed to reproduce only running nvim from a big directory (Home in my case)

@loiccoyle
Copy link
Author

Ok thanks for looking into it !

@felixniemeyer
Copy link

I have exactly this issue.
Home is a git repo on my computer as well. (I use it to version control my .bashrc, .Xressources .config/*, and so on).
Whenever I open a file such as ~/test.txt I would get 1 to 2s of lag before I can type. I just disabled the tree plugin because of this.

@kyazdani42
Copy link
Member

i'm currently rewriting the git module by running git commands in jobs to avoid blocking nvim. It will probably help a lot.

@kyazdani42
Copy link
Member

I'm closing this in favor of #549 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants