Skip to content

Commit ade3c00

Browse files
committed
fix(#1494): git showUntracked value and log
* should_show_untracked evaluates non-boolean status.showUntrackedFiles * git.Runner status logging nil values removed before concat
1 parent 261a5c3 commit ade3c00

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

lua/nvim-tree/git/runner.lua

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,19 @@ function Runner:_run_git_job()
8282
pcall(uv.kill, pid)
8383
end
8484

85+
local function clean_log(opts_args)
86+
local _opt_args = {}
87+
for key, val in ipairs(opts_args) do
88+
if (val ~= nil) then
89+
_opt_args[key] = val
90+
end
91+
end
92+
return _opt_args
93+
end
94+
8595
local opts = self:_getopts(stdout, stderr)
8696
log.line("git", "running job with timeout %dms", self.timeout)
87-
log.line("git", "git %s", table.concat(opts.args, " "))
97+
log.line("git", "git %s", table.concat(clean_log(opts.args), " "))
8898

8999
handle, pid = uv.spawn(
90100
"git",

lua/nvim-tree/git/utils.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function M.should_show_untracked(cwd)
4141
return untracked[cwd]
4242
end
4343

44-
local cmd = "git -C " .. cwd .. " config --type=bool status.showUntrackedFiles"
44+
local cmd = "git -C " .. cwd .. " config status.showUntrackedFiles"
4545

4646
local ps = log.profile_start("git untracked %s", cwd)
4747
log.line("git", cmd)
@@ -51,7 +51,7 @@ function M.should_show_untracked(cwd)
5151
log.raw("git", has_untracked)
5252
log.profile_end(ps, "git untracked %s", cwd)
5353

54-
untracked[cwd] = vim.trim(has_untracked) ~= "false"
54+
untracked[cwd] = vim.trim(has_untracked) ~= "no"
5555
return untracked[cwd]
5656
end
5757

0 commit comments

Comments
 (0)