fix(git): validate placement, cache repo lookups, tighten lifecycle

This commit is contained in:
2026-05-10 04:47:35 +02:00
parent cb47177382
commit 8624f825eb
4 changed files with 35 additions and 2 deletions
+9 -1
View File
@@ -49,7 +49,7 @@ end
local state = {}
local group =
vim.api.nvim_create_augroup("ow.git.status_win", { clear = false })
vim.api.nvim_create_augroup("ow.git.status_win", { clear = true })
local ns = vim.api.nvim_create_namespace("ow.git.status_win")
---@return integer? win
@@ -713,6 +713,14 @@ end
function M.open(opts)
opts = opts or {}
local placement = opts.placement or "sidebar"
if not vim.tbl_contains(M.PLACEMENTS, placement) then
util.error(
"invalid placement: %s (expected one of %s)",
placement,
table.concat(M.PLACEMENTS, ", ")
)
return
end
local r = repo.resolve()
if not r then
util.error("not in a git repository")