fix: #1182
Some checks are pending
CI / commit_lint (push) Waiting to run
CI / test (nightly) (push) Waiting to run
CI / test (v0.10.0) (push) Waiting to run
CI / test (v0.9.5) (push) Waiting to run
CI / stylua (push) Waiting to run
CI / luals (push) Waiting to run
CI / doc (push) Waiting to run
release-please / release-please (push) Waiting to run
release-please / luarocks-upload (push) Blocked by required conditions
release-please / update-doc (push) Blocked by required conditions

This commit is contained in:
Lewis Russell 2025-01-22 09:55:15 +00:00
parent 2ff0c29f2a
commit 632fda72df

View File

@ -491,13 +491,12 @@ M.update = throttle_by_id(function(bufnr)
return
end
local rev_from_index = not git_obj:from_tree()
local buf_is_editable_file = vim.bo[bufnr].buftype == ''
local bufname = api.nvim_buf_get_name(bufnr)
if
config.signs_staged_enable
and not file_mode
and (rev_from_index or not buf_is_editable_file)
and (bufname:match('^fugitive://') or bufname:match('^gitsigns://'))
then
if not bcache.compare_text_head or config._refresh_staged_on_update then
-- When the revision is from the index, we compare against HEAD to
@ -508,7 +507,7 @@ M.update = throttle_by_id(function(bufnr)
-- utilize the staged signs to represent the changes introduced in that
-- revision. Therefore we compare against the previous commit. Note there
-- should not be any normal signs for these buffers.
local staged_rev = rev_from_index and 'HEAD' or git_obj.revision .. '^'
local staged_rev = git_obj:from_tree() and git_obj.revision .. '^' or 'HEAD'
bcache.compare_text_head = git_obj:get_show_text(staged_rev)
if not M.schedule(bufnr, true) then
return