From cbcd61b053a2e84586651f6502572e9a82f00329 Mon Sep 17 00:00:00 2001 From: "Joel D. Elkins" Date: Sun, 17 Jan 2021 15:06:14 -0600 Subject: [PATCH] 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. --- lua/lib/git.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/lib/git.lua b/lua/lib/git.lua index 0b625d75..d2cf4aca 100644 --- a/lua/lib/git.lua +++ b/lua/lib/git.lua @@ -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