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

Bug: Not detecting branch on files in subdirectories #1183

Open
Jlchong3 opened this issue Jan 17, 2024 · 4 comments
Open

Bug: Not detecting branch on files in subdirectories #1183

Jlchong3 opened this issue Jan 17, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@Jlchong3
Copy link

Jlchong3 commented Jan 17, 2024

The lualine detects the branch I am in when I use a file in the same directory as the .git, but when going to a file in a subdirectory lualine stops showing the branch I am in, is that supposed to happen?

Here it is with a file in the same directory as .git
image

When entering a file in a subdirectory
image

@Jlchong3 Jlchong3 added the bug Something isn't working label Jan 17, 2024
@Leeto1970
Copy link

Leeto1970 commented Jan 25, 2024

Use ":e path/to/your/file" or use telescope plugin to find file can solve this problem.

@bwpge
Copy link

bwpge commented Jan 31, 2024

Came across this today, To add a few more details:

  • Looks like the bug only triggers when opening a file from my file tree plugin (neo-tree.nvim) which is not in the same directory as .git
    • This appears to be the same plugin as in the screenshot
  • Opening a file in same directory as .git through file tree plugin shows the branch
  • Opening any file through telescope or :e foo shows the branch

My initial reaction is that this may be caused by how neo-tree opens files, since I don't get the same issue with telescope - but I don't have any evidence to back up that claim.

Edit: fixed wording

@bwpge
Copy link

bwpge commented Feb 11, 2024

I just stumbled across a Neo-tree issue that seems to be the cause of this issue. Linking to it here so both issues have visibility on each other: nvim-neo-tree/neo-tree.nvim#1264

This looks like it would be a Windows-specific problem from Neo-tree, and @Jlchong3 from your path separator it seems you are on Windows as well. I also verified, I'm not getting this git branch problem on WSL with the exact same config when opening from Neo-tree.

@bwpge
Copy link

bwpge commented Feb 16, 2024

I believe this issue is fixed by the latest PR mentioned above in neo-tree.nvim. If you want to double check you can pull the plugin with lazy using:

{
    "nvim-neo-tree/neo-tree.nvim",
    branch = "main".
    -- ...
}

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

No branches or pull requests

3 participants