X Tutup
Skip to content

fix(git_status): Fix worktree not found when use_file_path=true#3417

Open
P4Cu wants to merge 1 commit intonvim-telescope:masterfrom
P4Cu:fix/git_status_for_worktree_nvim9.0_use_file_path_true
Open

fix(git_status): Fix worktree not found when use_file_path=true#3417
P4Cu wants to merge 1 commit intonvim-telescope:masterfrom
P4Cu:fix/git_status_for_worktree_nvim9.0_use_file_path_true

Conversation

@P4Cu
Copy link

@P4Cu P4Cu commented Feb 16, 2025

Description

:lua require("telescope.builtin").git_status { use_file_path = true } fails when called from worktree.
This happens because we're looking for .git directory while for worktrees it's a .git file.
I propose a better solution which use git rev-parse --show-toplevel that will work regardless of git internals (similar approach already used in another part of code).

Fixes #3409

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

See #3409 for minimal config that reproduces the issue.

I've tested it on non-worktree/worktree/non-git my full config.

Configuration:

NVIM v0.10.2
Build type: Release
LuaJIT 2.1.1713484068
Run "nvim -V1 -v" for more info
  • windows 11 + fedora 47

Checklist:

  • My code follows the style guidelines of this project (stylua)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (lua annotations)

@amplexus
Copy link

amplexus commented Apr 5, 2025

Any reason this PR can't be merged? I'm impacted by this for the same reason as OP in #3409. Thanks!

@P4Cu
Copy link
Author

P4Cu commented Apr 5, 2025

IMHO no reason.

@P4Cu
Copy link
Author

P4Cu commented Jun 28, 2025

@jamestrew Could you merge?

@clason clason force-pushed the fix/git_status_for_worktree_nvim9.0_use_file_path_true branch from 29d9d52 to 5b261c1 Compare December 30, 2025 12:20
@clason
Copy link
Contributor

clason commented Dec 30, 2025

It couldn't be merged since vim.fs.root was only added in Nvim 0.10, and support for Nvim 0.9 hadn't been dropped yet.

It also requires more testing to make sure it doesn't break other valid use cases. (So far people have only complained that this isn't merged but not confirmed that they have successfully tested the fix.)

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

Successfully merging this pull request may close these issues.

git_status { use_file_path = true } on worktree

3 participants

X Tutup