refactor(git): make the git module self-contained under git.util
This commit is contained in:
+4
-5
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user