refactor(git): gitlog as gitlog:// URI singleton, fix synthetic-URI cwd resolve

This commit is contained in:
2026-04-29 14:06:40 +02:00
parent 49c618959d
commit 781496dc13
4 changed files with 85 additions and 29 deletions
+8 -1
View File
@@ -182,7 +182,11 @@ function M.read_uri(buf)
vim.b[buf].git_worktree = worktree
vim.bo[buf].swapfile = false
vim.bo[buf].bufhidden = "wipe"
-- `unload` frees content when the buffer is hidden, but keeps the
-- bufnr in the buffer list so the jumplist's `(bufnr, line, col)`
-- entries stay valid. `<C-o>` back to a hidden URI buffer triggers
-- the BufReadCmd again, refreshing content via `cat-file -p`.
vim.bo[buf].bufhidden = "unload"
---@type string?
local stdout = pending_content[buf]
@@ -228,6 +232,9 @@ function M.read_uri(buf)
end
if stdout then
-- Reload paths (`:e`, `<C-o>` to an unloaded buf) re-enter
-- with `modifiable = false` from the prior load.
vim.bo[buf].modifiable = true
vim.api.nvim_buf_set_lines(buf, 0, -1, false, util.split_lines(stdout))
end