From 148d19ca7a2e86088ef1f13d4b69e0dae3901e3e Mon Sep 17 00:00:00 2001 From: f Date: Sun, 21 Nov 2021 10:51:23 +0800 Subject: [PATCH] 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 --- lua/lazygit.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazygit.lua b/lua/lazygit.lua index ec2001b..dca0d38 100644 --- a/lua/lazygit.lua +++ b/lua/lazygit.lua @@ -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