Skip to content

Commit 7ef1d2d

Browse files
committed
fix(#1494): git showUntracked value and log
* should_show_untracked correctly evaluates status.showUntrackedFiles * git.Runner:_run_git_job removes nils before logging args
1 parent 261a5c3 commit 7ef1d2d

File tree

2 files changed

+9
-3
lines changed

2 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: 8 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

@@ -75,4 +75,10 @@ function M.file_status_to_dir_status(status, cwd)
7575
return dirs
7676
end
7777

78+
function M.array_remove_nils(array)
79+
return vim.tbl_filter(function(v)
80+
return v ~= nil
81+
end, array)
82+
end
83+
7884
return M

0 commit comments

Comments
 (0)