feat: use git-dir and work-tree from environment (#142)
Passes `work-tree` and `git-dir` arguments for Lazygit. This is very useful when using a bare git repo, so that Lazygit can still be used to manage the repo.
This commit is contained in:
@@ -101,7 +101,9 @@ local function lazygit(path)
|
|||||||
cmd = cmd .. " -ucf '" .. config_path .. "'" -- quote config_path to avoid whitespace errors
|
cmd = cmd .. " -ucf '" .. config_path .. "'" -- quote config_path to avoid whitespace errors
|
||||||
end
|
end
|
||||||
|
|
||||||
if path == nil then
|
if vim.env.GIT_DIR ~= nil and vim.env.GIT_WORK_TREE ~= nil then
|
||||||
|
cmd = cmd .. " -w " .. vim.env.GIT_WORK_TREE .. " -g " .. vim.env.GIT_DIR
|
||||||
|
elseif path == nil then
|
||||||
if is_symlink() then
|
if is_symlink() then
|
||||||
path = project_root_dir()
|
path = project_root_dir()
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user