refactor(git): rework module around clearer Status and Repo split

This commit is contained in:
2026-05-06 00:45:56 +02:00
parent 1b43fa6a1c
commit 80d6d465cf
17 changed files with 821 additions and 775 deletions
+13 -5
View File
@@ -4,6 +4,14 @@ local util = require("git.util")
local M = {}
---@class ow.Git.Diff.Side
---@field buf integer
---@field name string?
---@class ow.Git.Diff.Pair
---@field left ow.Git.Diff.Side
---@field right ow.Git.Diff.Side
---@param win integer
---@param enabled boolean
function M.set_diff(win, enabled)
@@ -28,7 +36,7 @@ end
---@param left_win integer
---@param right_win integer
---@param pair ow.Git.DiffPair
---@param pair ow.Git.Diff.Pair
function M.update_pair(left_win, right_win, pair)
M.set_diff(left_win, false)
M.set_diff(right_win, false)
@@ -58,11 +66,11 @@ local function place_pair(buf_a, buf_b, a_left, vertical)
end
end
---@param opts ow.Git.SplitOpts
---@param opts ow.Git.Diff.SplitOpts
---@param buf integer
---@param rev ow.Git.Revision
local function uri_split(opts, buf, rev)
local r = repo.find(buf)
local r = repo.resolve(buf)
if not r then
util.warning("git URI buffer has no worktree")
return
@@ -127,11 +135,11 @@ local function uri_split(opts, buf, rev)
place_pair(buf, object.buf_for(r, other_rev, content), left, opts.vertical)
end
---@class ow.Git.SplitOpts
---@class ow.Git.Diff.SplitOpts
---@field rev string?
---@field vertical boolean
---@param opts ow.Git.SplitOpts
---@param opts ow.Git.Diff.SplitOpts
function M.split(opts)
local cur_buf = vim.api.nvim_get_current_buf()
local cur_path = vim.api.nvim_buf_get_name(cur_buf)