Skip to content

Commit 3f6f15c

Browse files
committed
fix(#3171): use vim.system() to determine git toplevel
1 parent 0a7fcdf commit 3f6f15c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lua/nvim-tree/git/utils.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ function M.get_toplevel(cwd)
1616
local cmd = { "git", "-C", cwd, "rev-parse", "--show-toplevel", "--absolute-git-dir" }
1717
log.line("git", "%s", table.concat(cmd, " "))
1818

19-
local out = vim.fn.system(cmd)
19+
local obj = vim.system(cmd):wait()
20+
local out = vim.trim(obj.stdout)
2021

2122
log.raw("git", out)
2223
log.profile_end(profile)
2324

24-
if vim.v.shell_error ~= 0 or not out or #out == 0 or out:match("fatal") then
25+
if obj.code ~= 0 or not out or #out == 0 or out:match("fatal") then
2526
return nil, nil
2627
end
2728

0 commit comments

Comments
 (0)