Merge pull request #48 from UzimakiNaruto/fix-git-rev-not-in-a-git-repo
Fix git rev path check when execute not in a git repo
This commit is contained in:
@@ -27,7 +27,7 @@ local function project_root_dir()
|
||||
|
||||
-- try submodule first
|
||||
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
|
||||
return trim(gitdir)
|
||||
end
|
||||
@@ -165,6 +165,10 @@ local function lazygit(path)
|
||||
if path == nil then
|
||||
path = project_root_dir()
|
||||
end
|
||||
if path == nil or fn.isdirectory(path .. '/.git/') == 0 then
|
||||
print('Not in a git repository')
|
||||
return
|
||||
end
|
||||
open_floating_window()
|
||||
local cmd = 'lazygit'
|
||||
if not vim.env.GIT_DIR then
|
||||
|
||||
Reference in New Issue
Block a user