refactor(git): split URI read from conditional refresh
This commit is contained in:
@@ -49,10 +49,10 @@ local function fetch(worktree, max_count)
|
||||
end
|
||||
|
||||
---@param buf integer
|
||||
local function populate(buf)
|
||||
local r = repo.resolve(buf)
|
||||
local state = r and r:state(buf)
|
||||
if not r or not state then
|
||||
---@param r ow.Git.Repo
|
||||
local function populate(buf, r)
|
||||
local state = r:state(buf)
|
||||
if not state then
|
||||
return
|
||||
end
|
||||
local stdout = fetch(r.worktree, state.log_max_count)
|
||||
@@ -110,7 +110,7 @@ function M.read_uri(buf)
|
||||
end
|
||||
|
||||
attach_dispatch(buf)
|
||||
populate(buf)
|
||||
populate(buf, r)
|
||||
end
|
||||
|
||||
---@class ow.Git.Log.OpenOpts
|
||||
@@ -144,7 +144,7 @@ function M.open(opts)
|
||||
end
|
||||
|
||||
if was_loaded then
|
||||
populate(buf)
|
||||
populate(buf, r)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -183,6 +183,6 @@ function M.complete_glog(arg_lead)
|
||||
return matches
|
||||
end
|
||||
|
||||
repo.on_uri_refresh(M.URI_PREFIX, M.read_uri)
|
||||
repo.on_uri_refresh(M.URI_PREFIX, populate)
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user