fix: git rev-parse --show-superproject-working-tree return fatal: not a git repository (or any of the parent directories): .git when execute not in a git repo
This commit is contained in:
@@ -27,7 +27,7 @@ local function project_root_dir()
|
|||||||
|
|
||||||
-- try submodule first
|
-- try submodule first
|
||||||
local gitdir = fn.system('cd "' .. fn.expand('%:p:h') .. '" && git rev-parse --show-superproject-working-tree')
|
local gitdir = fn.system('cd "' .. fn.expand('%:p:h') .. '" && git rev-parse --show-superproject-working-tree')
|
||||||
if gitdir ~= '' then
|
if gitdir ~= '' and fn.matchstr(gitdir, '^fatal:.*') == '' then
|
||||||
vim.o.shell = oldshell
|
vim.o.shell = oldshell
|
||||||
return trim(gitdir)
|
return trim(gitdir)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user