refactor(git): make the git module self-contained under git.util

This commit is contained in:
2026-04-28 09:05:01 +02:00
parent 4390b55dfe
commit 37e5582795
10 changed files with 195 additions and 75 deletions
+4 -5
View File
@@ -1,7 +1,6 @@
local git = require("git")
local log = require("log")
local repo = require("git.repo")
local util = require("util")
local util = require("git.util")
local M = {}
@@ -23,7 +22,7 @@ local cached_cmds
---@param result vim.SystemCompleted
local function populate_cached_cmds(result)
if result.code ~= 0 then
log.error("git --list-cmds failed: %s", vim.trim(result.stderr or ""))
util.error("git --list-cmds failed: %s", vim.trim(result.stderr or ""))
return
end
cached_cmds = {}
@@ -140,7 +139,7 @@ local function run_in_split(worktree, args, conf)
vim.bo[buf].modifiable = false
vim.bo[buf].modified = false
if obj.code ~= 0 then
log.error(
util.error(
"git %s failed: %s",
args[1] or "",
vim.trim(obj.stderr or "")
@@ -216,7 +215,7 @@ end
function M.run(args)
local _, worktree = repo.resolve_cwd()
if not worktree then
log.warning("not in a git repository")
util.warning("not in a git repository")
return
end