refactor(git): route every git invocation through util.git
This commit is contained in:
+7
-8
@@ -96,8 +96,8 @@ local function attach_index_writer(buf, r, path)
|
||||
vim.api.nvim_buf_get_lines(buf, 0, -1, false),
|
||||
"\n"
|
||||
) .. "\n"
|
||||
local hash_stdout = util.exec(
|
||||
{ "git", "hash-object", "-w", "--stdin" },
|
||||
local hash_stdout = util.git(
|
||||
{ "hash-object", "-w", "--stdin" },
|
||||
{ cwd = r.worktree, stdin = body }
|
||||
)
|
||||
if not hash_stdout then
|
||||
@@ -108,8 +108,8 @@ local function attach_index_writer(buf, r, path)
|
||||
local mode = state and state.index_mode
|
||||
if not mode then
|
||||
mode = "100644"
|
||||
local ls = util.exec(
|
||||
{ "git", "ls-files", "-s", "--", path },
|
||||
local ls = util.git(
|
||||
{ "ls-files", "-s", "--", path },
|
||||
{ cwd = r.worktree, silent = true }
|
||||
)
|
||||
if ls then
|
||||
@@ -123,8 +123,7 @@ local function attach_index_writer(buf, r, path)
|
||||
end
|
||||
end
|
||||
if
|
||||
not util.exec({
|
||||
"git",
|
||||
not util.git({
|
||||
"update-index",
|
||||
"--cacheinfo",
|
||||
mode,
|
||||
@@ -171,8 +170,8 @@ end
|
||||
---@return boolean ok
|
||||
local function populate(buf, r, rev, state, rev_sha)
|
||||
local rev_str = rev:format()
|
||||
local stdout = util.exec(
|
||||
{ "git", "cat-file", "-p", rev_str },
|
||||
local stdout = util.git(
|
||||
{ "cat-file", "-p", rev_str },
|
||||
{ cwd = r.worktree }
|
||||
)
|
||||
if not stdout then
|
||||
|
||||
Reference in New Issue
Block a user