refactor(git): split URI read from conditional refresh

This commit is contained in:
2026-05-06 04:46:01 +02:00
parent abb5434893
commit abc09d4ae3
5 changed files with 70 additions and 69 deletions
+7 -7
View File
@@ -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