added a check for git root query (#145)
This commit is contained in:
parent
a08a5b8dc1
commit
480e35720d
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user