fix(git): validate placement, cache repo lookups, tighten lifecycle
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user