refactor(git): narrow entry_key + show_diff to FileEntry
This commit is contained in:
+7
-11
@@ -447,13 +447,9 @@ local function other_pane(s, entry)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---@param s ow.Git.StatusState
|
---@param s ow.Git.StatusState
|
||||||
---@param entry ow.Git.StatusEntry
|
---@param entry ow.Git.FileEntry
|
||||||
---@return ow.Git.DiffPair?
|
---@return ow.Git.DiffPair?
|
||||||
local function compute_pair(s, entry)
|
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)
|
local other = other_pane(s, entry)
|
||||||
if not other then
|
if not other then
|
||||||
return nil
|
return nil
|
||||||
@@ -535,20 +531,20 @@ local function adopt_diff_wins(s, sidebar_win)
|
|||||||
return left, right
|
return left, right
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param entry ow.Git.StatusEntry
|
---@param entry ow.Git.FileEntry
|
||||||
---@return string
|
---@return string
|
||||||
local function entry_key(entry)
|
local function entry_key(entry)
|
||||||
return entry.section
|
return entry.section .. "|" .. entry.path .. "|" .. (entry.orig or "")
|
||||||
.. "|"
|
|
||||||
.. (entry.path or entry.sha or "")
|
|
||||||
.. "|"
|
|
||||||
.. (entry.orig or "")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param s ow.Git.StatusState
|
---@param s ow.Git.StatusState
|
||||||
---@param entry ow.Git.StatusEntry
|
---@param entry ow.Git.StatusEntry
|
||||||
---@param focus_left boolean
|
---@param focus_left boolean
|
||||||
local function show_diff(s, entry, focus_left)
|
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()
|
local sidebar_win = find_sidebar()
|
||||||
if not sidebar_win then
|
if not sidebar_win then
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user