refactor(git): narrow entry_key + show_diff to FileEntry

This commit is contained in:
2026-04-27 13:56:01 +02:00
parent 5833323814
commit 4dfd7ef5fa
+7 -11
View File
@@ -447,13 +447,9 @@ local function other_pane(s, entry)
end
---@param s ow.Git.StatusState
---@param entry ow.Git.StatusEntry
---@param entry ow.Git.FileEntry
---@return ow.Git.DiffPair?
local function compute_pair(s, entry)
if not entry.path then
return nil
end
---@cast entry ow.Git.FileEntry
local other = other_pane(s, entry)
if not other then
return nil
@@ -535,20 +531,20 @@ local function adopt_diff_wins(s, sidebar_win)
return left, right
end
---@param entry ow.Git.StatusEntry
---@param entry ow.Git.FileEntry
---@return string
local function entry_key(entry)
return entry.section
.. "|"
.. (entry.path or entry.sha or "")
.. "|"
.. (entry.orig or "")
return entry.section .. "|" .. entry.path .. "|" .. (entry.orig or "")
end
---@param s ow.Git.StatusState
---@param entry ow.Git.StatusEntry
---@param focus_left boolean
local function show_diff(s, entry, focus_left)
if not entry.path then
return
end
---@cast entry ow.Git.FileEntry
local sidebar_win = find_sidebar()
if not sidebar_win then
return