Giter Club home page Giter Club logo

Comments (24)

kyazdani42 avatar kyazdani42 commented on April 27, 2024 1

i'll push a fix when i have some time. I've never used such git feature but will likely do :)

from nvim-tree.lua.

akinsho avatar akinsho commented on April 27, 2024 1

🤔 Just tried to reproduce it in a completely new project that I then turned into a repo but it didn't seem to happen again 😕 not sure how this is happening tbh

from nvim-tree.lua.

b0o avatar b0o commented on April 27, 2024 1

Ok, I just looked through my home directory. I unknowingly had a directory literally named $HOME due to a typo in a configuration causing that variable not to be expanded before creating a directory. Removing that directory resolved the error.

from nvim-tree.lua.

kyazdani42 avatar kyazdani42 commented on April 27, 2024 1

I'll keep this open in the meanwhile :) i could not reproduce de git root error but i had other kind of errors popping in.

from nvim-tree.lua.

kyazdani42 avatar kyazdani42 commented on April 27, 2024

i did not manage to reproduce, even with your nvim configuration.
Could you give me the name of the folder in which you try to open neovim so i can see why this is happening ?

from nvim-tree.lua.

juanramirezc2 avatar juanramirezc2 commented on April 27, 2024

Hi @theHamsta @chmln @rickysaurav @Akin909 @marekkon @kyazdani42
i'm running nvim v0.5.0-590-gb39edb5b6 and nvim-tree.lua in the latest version, i'm able to replicate this issue in long nested path git repositories, below the confusion directory inside a long nested path throw the error
i
2020-07-09 18 26 51
unlike the same confusion directory inside the home ~ directory
2020-07-09 18 27 38

from nvim-tree.lua.

akinsho avatar akinsho commented on April 27, 2024

Yep this one is definitely happening I've seen it loads, It seems to happen when you switch directories i.e. project1/buffer1 to project2/bufffer1 if they are in different parts of the file system that seems to cause a big issue

from nvim-tree.lua.

kyazdani42 avatar kyazdani42 commented on April 27, 2024

is this still relevant ?

from nvim-tree.lua.

akinsho avatar akinsho commented on April 27, 2024

@kyazdani42 I haven't personally seen it since but I also haven't been trying to reproduce it nor have I used the steps @juangabrielr4 mentioned above, but I work in a fairly nested and enormous monorepo and I haven't seen this for at least a day now

from nvim-tree.lua.

kyazdani42 avatar kyazdani42 commented on April 27, 2024

allright, we'll leave this open in case it appears again.

from nvim-tree.lua.

gbrlsnchs avatar gbrlsnchs commented on April 27, 2024

@kyazdani42, this error pops up when I'm working in a Git worktree. Saving any files without any changes in a worktree directory is enough to trigger the error.

from nvim-tree.lua.

kyazdani42 avatar kyazdani42 commented on April 27, 2024

@gbrlsnchs i did not manage to reproduce the error with a git worktree.
Could you try to make a more detailed step by step way to trigger the error ?
Also which neovim version are you using, and which version of the plugin ?

from nvim-tree.lua.

akinsho avatar akinsho commented on April 27, 2024

Got this one again today, the context was I made a new project then initialised it as a git repo from the nvim terminal after having opened lua tree. I saved the session, then whenever I open it again now it errors
git-root-bug

Seems to happen specifically BufEnter when switching buffers, or if I try and interact with the tree at all once the first error appears

from nvim-tree.lua.

b0o avatar b0o commented on April 27, 2024

Hi! I seem to be experiencing this issue as well:

If I start Neovim from my home directory and try to edit a file anywhere on my system, I get this error each time I try to write the file:

"/tmp/test" [New] 0L, 0C written
Error detected while processing BufWritePost Autocommands for "*":
E5108: Error executing lua .../.config/nvim/dein/.cache/init.vim/.dein/lua/lib/git.lua:67: attempt to concatenate local 'git_root' (a nil value)
Press ENTER or type command to continue

It doesn't matter where the file I'm editing is, whether it's within a git repository or not, or whether it exists or not. The only thing that seems to matter is whether I start vim while my $PWD is $HOME. My home directory is not a git repository, nor is it contained within one.

Oddly, if I launch vim from my home directory and :cd to /tmp/, the error still occurs upon saving a file. However, if I launch vim from /tmp/ and :cd to my home directory, the error does not occur.

So far I am not aware of any directory other than my home directory which exhibits this behavior.

Also, it does not matter if LuaTree has been opened or not.

Versions:

  • nvim: v0.5.0-763-geaee3d929

  • nvim-tree.lua: 87a4d60

from nvim-tree.lua.

kyazdani42 avatar kyazdani42 commented on April 27, 2024

ill take a look when if have some time :) thanks for the repro

from nvim-tree.lua.

kyazdani42 avatar kyazdani42 commented on April 27, 2024

I cannot reproduce. I thought this issue was fixed long ago, maybe there are some files with characters i don't properly match. I'm not sure wich those are.

from nvim-tree.lua.

b0o avatar b0o commented on April 27, 2024

Odd. Maybe a workaround would be to check if git_root is nil before trying to concatenate it inside M.updateStatus?

https://github.com/kyazdani42/nvim-tree.lua/blob/6c2ee962079b51a868770560fde3e734eadcf91c/lua/lib/git.lua#L67

from nvim-tree.lua.

b0o avatar b0o commented on April 27, 2024

It seems that you're checking git_root once, then if it's nil you try to create_root, but you don't check if it's nil again after doing so.

https://github.com/kyazdani42/nvim-tree.lua/blob/6c2ee962079b51a868770560fde3e734eadcf91c/lua/lib/git.lua#L57-L65

So maybe this would work?

  local git_root, git_status = get_git_root(cwd)
  if not git_root then
    if not create_root(cwd) then
      return
    end
    git_root, git_status = get_git_root(cwd)
    if not git_root then
      return
    end
  elseif git_status == not_git then
    return
  end

I haven't looked much into the code, this is just a guess.

Edit: I tested this locally and it seems to have fixed the error.

from nvim-tree.lua.

kyazdani42 avatar kyazdani42 commented on April 27, 2024

i know about that, but i like keeping this kind of errors so i can fix the underlying issue. I know this might be caused by a matching gone wrong, but i cannot fix it if i don't have more informations about the filesystem (specially file names that might have weird characters which would cause the lua matching to break).
But i'm working on a big rewrite, and i'll probably use libgit2 which has bindings for lua.

from nvim-tree.lua.

hamsterBiscuit avatar hamsterBiscuit commented on April 27, 2024

hi, I have some error:

attempt to concatenate local 'git_root' (a nil value)

I test path.
I find my path include '_',this error is happen!
I'm sorry I will not lua to fix this bug,
if you Want more information, tell me ,
oh, I use mac.

from nvim-tree.lua.

kyazdani42 avatar kyazdani42 commented on April 27, 2024

nvim/luatree version (commit) ?
underscore is handled, it never was an issue, the problem might come from somewhere else.
Anyway in the next version, it will be handled in a different way that will not require escaping strings, because it won't rely on matching anymore. please check #123 which will normally fix most issues.

from nvim-tree.lua.

hamsterBiscuit avatar hamsterBiscuit commented on April 27, 2024

yes, not underscore,
I have this error is in web program,
they has node_modules folder,
I delete node_modules folder, It's not error.
and I checkout rewrite branch, and error too.

from nvim-tree.lua.

kyazdani42 avatar kyazdani42 commented on April 27, 2024

please see #123, when it's done, everything will be fixed, i wont spend time on these issues anymore sorry.

from nvim-tree.lua.

iamcco avatar iamcco commented on April 27, 2024

Same issue when open nvim.
image

from nvim-tree.lua.

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.