From 5f7b11fe01cb0b60da7298ac89951500bb555dce Mon Sep 17 00:00:00 2001 From: przepompownia Date: Tue, 5 Aug 2025 01:54:02 +0200 Subject: [PATCH] Keep Nvim 0.9 compatibility --- lua/nvim-tree/git/utils.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lua/nvim-tree/git/utils.lua b/lua/nvim-tree/git/utils.lua index 7f8ef0a3..971e727e 100644 --- a/lua/nvim-tree/git/utils.lua +++ b/lua/nvim-tree/git/utils.lua @@ -16,13 +16,18 @@ function M.get_toplevel(cwd) local cmd = { "git", "-C", cwd, "rev-parse", "--show-toplevel", "--absolute-git-dir" } log.line("git", "%s", table.concat(cmd, " ")) - local obj = vim.system(cmd):wait() - local out = obj.stdout or "" + local out, exitCode + if vim.fn.has("nvim-0.10") == 1 then + local obj = vim.system(cmd):wait() + out, exitCode = obj.stdout or "", obj.code + else + out, exitCode = vim.fn.system(cmd), vim.v.shell_error + end log.raw("git", out) log.profile_end(profile) - if obj.code ~= 0 or not out or #out == 0 or out:match("fatal") then + if exitCode ~= 0 or not out or #out == 0 or out:match("fatal") then return nil, nil end