Only do git status -u if status.showUntrackedFiles = true

Some git use cases, specifically where $HOME is a git worktree with
a bare git repo somewhere else, really get bogged down if you do
`git status -u`. This overcomes that issue.
This commit is contained in:
Joel D. Elkins
2021-01-17 15:06:14 -06:00
committed by Kiyan
parent 32640f7689
commit cbcd61b053

View File

@@ -6,7 +6,11 @@ local roots = {}
local not_git = 'not a git repo'
local function update_root_status(root)
local status = vim.fn.systemlist('cd "'..root..'" && git status --porcelain=v1 -u')
local untracked = ' -u'
if vim.fn.trim(vim.fn.system('git config --type=bool status.showUntrackedFiles')) == 'false' then
untracked = ''
end
local status = vim.fn.systemlist('cd "'..root..'" && git status --porcelain=v1'..untracked)
roots[root] = {}
for _, v in pairs(status) do