* should_show_untracked correctly evaluates status.showUntrackedFiles * git.Runner:_run_git_job removes nils before logging args
This commit is contained in:
@@ -84,7 +84,7 @@ function Runner:_run_git_job()
|
|||||||
|
|
||||||
local opts = self:_getopts(stdout, stderr)
|
local opts = self:_getopts(stdout, stderr)
|
||||||
log.line("git", "running job with timeout %dms", self.timeout)
|
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(
|
handle, pid = uv.spawn(
|
||||||
"git",
|
"git",
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ function M.should_show_untracked(cwd)
|
|||||||
return untracked[cwd]
|
return untracked[cwd]
|
||||||
end
|
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)
|
local ps = log.profile_start("git untracked %s", cwd)
|
||||||
log.line("git", cmd)
|
log.line("git", cmd)
|
||||||
@@ -51,7 +51,7 @@ function M.should_show_untracked(cwd)
|
|||||||
log.raw("git", has_untracked)
|
log.raw("git", has_untracked)
|
||||||
log.profile_end(ps, "git untracked %s", cwd)
|
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]
|
return untracked[cwd]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -408,6 +408,12 @@ function M.array_remove(array, item)
|
|||||||
end
|
end
|
||||||
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)
|
function M.inject_node(f)
|
||||||
return function()
|
return function()
|
||||||
f(require("nvim-tree.lib").get_node_at_cursor())
|
f(require("nvim-tree.lib").get_node_at_cursor())
|
||||||
|
|||||||
Reference in New Issue
Block a user