Skip to content

Commit 6878252

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 6878252

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

lua/nvim-tree/git/runner.lua

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

85+
local function clean_log(t)
86+
clean_tbl = vim.tbl_filter(function(v)
87+
return v ~= nil
88+
end, t)
89+
return clean_tbl
90+
end
91+
8592
local opts = self:_getopts(stdout, stderr)
8693
log.line("git", "running job with timeout %dms", self.timeout)
87-
log.line("git", "git %s", table.concat(opts.args, " "))
94+
log.line("git", "git %s", table.concat(clean_log(opts.args), " "))
8895

8996
handle, pid = uv.spawn(
9097
"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)