From 632fda72df903255dc1683cd739dceaa7338128a Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Wed, 22 Jan 2025 09:55:15 +0000 Subject: [PATCH] fix: #1182 --- lua/gitsigns/manager.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lua/gitsigns/manager.lua b/lua/gitsigns/manager.lua index 63c9037..bba4414 100644 --- a/lua/gitsigns/manager.lua +++ b/lua/gitsigns/manager.lua @@ -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