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
parent 787cef2a1d
commit 88f4421e9c
No known key found for this signature in database
GPG Key ID: 133589DC38921AE2

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