Skip to content

fs_event watcher not started for .git folder on Windows #2243

Closed
@akriese

Description

@akriese

Description

The problem

While starting the plugin for a git repo, it tells me that no fs_event watcher could be started for the .git folder.

The error states the path as C:\Users\anton\Documents\ActivityRadar\backend\.git, where the weird character before the last backslash seems to be the problem.

Tracking it down

I tracked the creation of the path back and found out, that the git command to retrieve the project root returns a newline.

This is of course handled at the end of that function by removing the trainling newline. But my problem lies in having msys2 installed and so the plugin thinks I am a cygwin user (which I am not). In this call the cygpath program does something weird with the trailing whitespace which is not yet removed (namely, producing the weird trailing character).

My thoughts on solutions

One easy thing that would fix the issue (at least as far as I see it), would be to remove the trailing newline directly after the vim.fn.system call. Like so:

-local toplevel = vim.fn.system(cmd)
+local toplevel = vim.fn.system(cmd):gsub("\n", "")

That way it doesnt get screwed up by cygpath.

Another approach would be to try fixing it on the cygpath side. As that use case is very niche, I'd prefer to opt for the first approach. As the one requesting the msys2-support (#1290), @bstaint, could you tell us if you have the same issue currently? :)

Neovim version

NVIM v0.9.0
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

Operating system and version

Win 11

nvim-tree version

9ef6c3c

Minimal config

-- I'll provide this if necessary

Steps to reproduce

...

Expected behavior

No response

Actual behavior

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS Windows PowerShellspecific to windows powershellPR pleasenvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciatedbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions