fix: to check path exists. lazygit -g "notExistPath" will error: *fs.PathError stat /xxxxxx/.git/: no such file or directory

This commit is contained in:
f
2021-11-21 13:12:22 +08:00
parent 148d19ca7a
commit 940495546f

View File

@@ -165,6 +165,9 @@ local function lazygit(path)
if path == nil then
path = project_root_dir()
end
if path == nil or not fn.isdirectory(path .. '/.git/') then
print('Not in a git repository')
end
open_floating_window()
local cmd = 'lazygit'
if not vim.env.GIT_DIR then