diff options
| author | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-11-19 09:37:37 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-19 09:37:37 -0500 |
| commit | 254eb4d78d583363c44fc029c51a52e78c177367 (patch) | |
| tree | 3c889bfc1e15cb8393292d6c8a157c47129932ca /lua/lspconfig/util.lua | |
| parent | docs(readme): stress that configs are community-maintained (#1440) (diff) | |
| download | nvim-lspconfig-254eb4d78d583363c44fc029c51a52e78c177367.tar nvim-lspconfig-254eb4d78d583363c44fc029c51a52e78c177367.tar.gz nvim-lspconfig-254eb4d78d583363c44fc029c51a52e78c177367.tar.bz2 nvim-lspconfig-254eb4d78d583363c44fc029c51a52e78c177367.tar.lz nvim-lspconfig-254eb4d78d583363c44fc029c51a52e78c177367.tar.xz nvim-lspconfig-254eb4d78d583363c44fc029c51a52e78c177367.tar.zst nvim-lspconfig-254eb4d78d583363c44fc029c51a52e78c177367.zip | |
feat: add worktree support to find_git_ancestor (#1450)
* find_git_ancestor previously only checked for `.git ` directories
* git worktrees use a `.git` file with reference to the original git
directory
Diffstat (limited to 'lua/lspconfig/util.lua')
| -rw-r--r-- | lua/lspconfig/util.lua | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua index 8ae8d597..97a506fd 100644 --- a/lua/lspconfig/util.lua +++ b/lua/lspconfig/util.lua @@ -343,7 +343,8 @@ function M.root_pattern(...) end function M.find_git_ancestor(startpath) return M.search_ancestors(startpath, function(path) - if M.path.is_dir(M.path.join(path, '.git')) then + -- Support git directories and git files (worktrees) + if M.path.is_dir(M.path.join(path, '.git')) or M.path.is_file(M.path.join(path, '.git')) then return path end end) |
