added a check for git root query (#145)

This commit is contained in:
MijikHna 2024-08-22 03:19:30 +02:00 committed by GitHub
parent a08a5b8dc1
commit 480e35720d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -864,8 +864,8 @@ end
local function get_project_root() local function get_project_root()
local current_file = fn.expand("%:p") local current_file = fn.expand("%:p")
local current_dir = fn.fnamemodify(current_file, ":h") local current_dir = fn.fnamemodify(current_file, ":h")
local git_root = fn.systemlist("git -C " .. fn.shellescape(current_dir) .. " rev-parse --show-toplevel")[1] local git_root = fn.systemlist("git -C " .. fn.shellescape(current_dir) .. " rev-parse --show-toplevel")
return git_root or current_dir return (#git_root == 1 and git_root[1]) or current_dir
end end
---@param sidebar avante.Sidebar ---@param sidebar avante.Sidebar