Skip to content

Commit 09a5126

Browse files
authored
fix(#1494): git showUntracked value and log (#1504)
* should_show_untracked correctly evaluates status.showUntrackedFiles * git.Runner:_run_git_job removes nils before logging args
1 parent b314b3a commit 09a5126

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

lua/nvim-tree/git/runner.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function Runner:_run_git_job()
8484

8585
local opts = self:_getopts(stdout, stderr)
8686
log.line("git", "running job with timeout %dms", self.timeout)
87-
log.line("git", "git %s", table.concat(opts.args, " "))
87+
log.line("git", "git %s", table.concat(utils.array_remove_nils(opts.args), " "))
8888

8989
handle, pid = uv.spawn(
9090
"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

lua/nvim-tree/utils.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,12 @@ function M.array_remove(array, item)
408408
end
409409
end
410410

411+
function M.array_remove_nils(array)
412+
return vim.tbl_filter(function(v)
413+
return v ~= nil
414+
end, array)
415+
end
416+
411417
function M.inject_node(f)
412418
return function()
413419
f(require("nvim-tree.lib").get_node_at_cursor())

0 commit comments

Comments
 (0)