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
This commit is contained in:
axlauri 2022-08-15 00:30:22 -04:00 committed by GitHub
parent b314b3a699
commit 09a51266bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View File

@ -84,7 +84,7 @@ function Runner:_run_git_job()
local opts = self:_getopts(stdout, stderr)
log.line("git", "running job with timeout %dms", self.timeout)
log.line("git", "git %s", table.concat(opts.args, " "))
log.line("git", "git %s", table.concat(utils.array_remove_nils(opts.args), " "))
handle, pid = uv.spawn(
"git",

View File

@ -41,7 +41,7 @@ function M.should_show_untracked(cwd)
return untracked[cwd]
end
local cmd = "git -C " .. cwd .. " config --type=bool status.showUntrackedFiles"
local cmd = "git -C " .. cwd .. " config status.showUntrackedFiles"
local ps = log.profile_start("git untracked %s", cwd)
log.line("git", cmd)
@ -51,7 +51,7 @@ function M.should_show_untracked(cwd)
log.raw("git", has_untracked)
log.profile_end(ps, "git untracked %s", cwd)
untracked[cwd] = vim.trim(has_untracked) ~= "false"
untracked[cwd] = vim.trim(has_untracked) ~= "no"
return untracked[cwd]
end

View File

@ -408,6 +408,12 @@ function M.array_remove(array, item)
end
end
function M.array_remove_nils(array)
return vim.tbl_filter(function(v)
return v ~= nil
end, array)
end
function M.inject_node(f)
return function()
f(require("nvim-tree.lib").get_node_at_cursor())