fix(git): small bug fixes
This commit is contained in:
+11
-5
@@ -93,11 +93,17 @@ local function run_in_split(worktree, args, conf)
|
|||||||
vim.b[buf].git_worktree = worktree
|
vim.b[buf].git_worktree = worktree
|
||||||
if conf.needs_ref then
|
if conf.needs_ref then
|
||||||
local user_ref = first_positional(args, 2) or "HEAD"
|
local user_ref = first_positional(args, 2) or "HEAD"
|
||||||
local sha = repo.rev_parse(worktree, user_ref, true) or user_ref
|
local sha = repo.rev_parse(worktree, user_ref, true)
|
||||||
vim.b[buf].git_ref = sha
|
if sha then
|
||||||
vim.b[buf].git_parent_ref =
|
vim.b[buf].git_ref = sha
|
||||||
repo.rev_parse(worktree, user_ref .. "^", true)
|
vim.b[buf].git_parent_ref =
|
||||||
pcall(vim.api.nvim_buf_set_name, buf, "git://" .. sha .. "/")
|
repo.rev_parse(worktree, user_ref .. "^", true)
|
||||||
|
end
|
||||||
|
pcall(
|
||||||
|
vim.api.nvim_buf_set_name,
|
||||||
|
buf,
|
||||||
|
"git://" .. (sha or user_ref) .. "/"
|
||||||
|
)
|
||||||
end
|
end
|
||||||
vim.bo[buf].filetype = conf.ft
|
vim.bo[buf].filetype = conf.ft
|
||||||
|
|
||||||
|
|||||||
@@ -311,6 +311,10 @@ local function render(bufnr, branch, groups)
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
state[bufnr].lines = meta
|
state[bufnr].lines = meta
|
||||||
|
-- The diff windows we last opened may now be showing content for an
|
||||||
|
-- entry whose underlying file has changed. Drop the cache so the next
|
||||||
|
-- show_diff recomputes pre/post panes instead of short-circuiting.
|
||||||
|
state[bufnr].last_shown_key = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param bufnr integer
|
---@param bufnr integer
|
||||||
|
|||||||
Reference in New Issue
Block a user