Skip to content

Commit 9914780

Browse files
Xyhlonalex-courtis
andauthored
fix(#1547): pass explicit system arguments to for git toplevel and untracked actions
* the nice fix * fix(#1547): pass git toplevel cwd unescaped, pass git untracked arguments as per toplevel Co-authored-by: Maximilian Philipp <[email protected]> Co-authored-by: Alexander Courtis <[email protected]>
1 parent 52b0c32 commit 9914780

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Diff for: lua/nvim-tree/git/utils.lua

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ local log = require "nvim-tree.log"
44
local has_cygpath = vim.fn.executable "cygpath" == 1
55

66
function M.get_toplevel(cwd)
7-
local cmd = "git -C " .. vim.fn.shellescape(cwd) .. " rev-parse --show-toplevel"
87

98
local ps = log.profile_start("git toplevel %s", cwd)
10-
log.line("git", cmd)
9+
10+
local cmd = { "git", "-C", cwd, "rev-parse", "--show-toplevel" }
11+
log.line("git", "%s", vim.inspect(cmd))
1112

1213
local toplevel = vim.fn.system(cmd)
1314

@@ -41,10 +42,10 @@ function M.should_show_untracked(cwd)
4142
return untracked[cwd]
4243
end
4344

44-
local cmd = "git -C " .. cwd .. " config status.showUntrackedFiles"
45-
4645
local ps = log.profile_start("git untracked %s", cwd)
47-
log.line("git", cmd)
46+
47+
local cmd = { "git", "-C", cwd, "config", "status.showUntrackedFiles" }
48+
log.line("git", vim.inspect(cmd))
4849

4950
local has_untracked = vim.fn.system(cmd)
5051

0 commit comments

Comments
 (0)