diff --git a/lua/nvim-tree/git/utils.lua b/lua/nvim-tree/git/utils.lua index d76cbe8335b..ee5eee251de 100644 --- a/lua/nvim-tree/git/utils.lua +++ b/lua/nvim-tree/git/utils.lua @@ -4,10 +4,11 @@ local log = require "nvim-tree.log" local has_cygpath = vim.fn.executable "cygpath" == 1 function M.get_toplevel(cwd) - local cmd = "git -C " .. vim.fn.shellescape(cwd) .. " rev-parse --show-toplevel" local ps = log.profile_start("git toplevel %s", cwd) - log.line("git", cmd) + + local cmd = { "git", "-C", cwd, "rev-parse", "--show-toplevel" } + log.line("git", "%s", vim.inspect(cmd)) local toplevel = vim.fn.system(cmd) @@ -41,10 +42,10 @@ function M.should_show_untracked(cwd) return untracked[cwd] end - local cmd = "git -C " .. cwd .. " config status.showUntrackedFiles" - local ps = log.profile_start("git untracked %s", cwd) - log.line("git", cmd) + + local cmd = { "git", "-C", cwd, "config", "status.showUntrackedFiles" } + log.line("git", vim.inspect(cmd)) local has_untracked = vim.fn.system(cmd)