gitsigns.nvim icon indicating copy to clipboard operation
gitsigns.nvim copied to clipboard

Reblame fail with timeout error

Open jonas0616 opened this issue 9 months ago • 1 comments

Description

  • The reblame function in blame buffer is not working on some circumstances.
  • This issue doesn't affect all file types and repos. In my tests, the functionality works fine in YAML files, but it causes problems in Go and Python files.
  • This issue doesn't occur in a brand-new Git repository, but it could be reproducible in the lua files in gitsigns.nvim/lua/gitsigns repository.

Neovim version

v0.10.4

Operating system and version

Ubuntu 24.04.2

Expected behavior

The selected reblame action should checkout the file to the previous commit and display the blame result correctly.

Actual behavior

  • An error message appears:
    Error executing vim.schedule lua callback: ...cal/share/nvim/lazy/gitsigns.nvim/lua/gitsigns/blame.lua:178: Timeout waiting for attach
      stack traceback:
          [C]: in function 'error'
          ...cal/share/nvim/lazy/gitsigns.nvim/lua/gitsigns/blame.lua:178: in function ''
          vim/_editor.lua: in function <vim/_editor.lua:0>
    

Minimal config

for name, url in pairs{
  gitsigns = 'https://github.com/lewis6991/gitsigns.nvim',
  -- ADD OTHER PLUGINS _NECESSARY_ TO REPRODUCE THE ISSUE
} do
local install_path = vim.fn.fnamemodify('gitsigns_issue/'..name, ':p')
if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system { 'git', 'clone', '--depth=1', url, install_path }
end
vim.opt.runtimepath:append(install_path)
end

require('gitsigns').setup{
  debug_mode = true, -- You must add this to enable debug messages
  -- ADD GITSIGNS CONFIG THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE
}

-- ADD INIT.LUA SETTINGS THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE

Steps to reproduce

  1. git clone https://github.com/lewis6991/gitsigns.nvim.git
  2. cd gitsigns.nvim/lua/gitsigns
  3. nvim --clean -u minimal.lua actions.lua
  4. Run :Git blame
  5. Press <CR> on any line and select Reblame as commit or Reblame as commit parent.

Gitsigns debug messages

0.99 D dprintf: Deriving GitSignsAdd from Added
1.08 D derive: Deriving GitSignsChange from Changed
1.13 D derive: Deriving GitSignsDelete from Removed
1.19 D derive: Deriving GitSignsChangedelete from GitSignsChange
1.22 D derive: Deriving GitSignsTopdelete from GitSignsDelete
1.25 D derive: Deriving GitSignsUntracked from GitSignsAdd
1.31 D derive: Deriving GitSignsAddNr from GitSignsAdd
1.35 D derive: Deriving GitSignsChangeNr from GitSignsChange
1.40 D derive: Deriving GitSignsDeleteNr from GitSignsDelete
1.44 D derive: Deriving GitSignsChangedeleteNr from GitSignsChangeNr
1.46 D derive: Deriving GitSignsTopdeleteNr from GitSignsDeleteNr
1.49 D derive: Deriving GitSignsUntrackedNr from GitSignsAddNr
1.51 D derive: Deriving GitSignsAddLn from DiffAdd
1.55 D derive: Deriving GitSignsChangeLn from DiffChange
1.57 D derive: Deriving GitSignsChangedeleteLn from GitSignsChangeLn
1.62 D derive: Deriving GitSignsTopdeleteLn from GitSignsDeleteLn
1.64 D derive: Deriving GitSignsUntrackedLn from GitSignsAddLn
1.66 D derive: Deriving GitSignsAddCul from GitSignsAdd
1.68 D derive: Deriving GitSignsChangeCul from GitSignsChange
1.69 D derive: Deriving GitSignsDeleteCul from GitSignsDelete
1.71 D derive: Deriving GitSignsChangedeleteCul from GitSignsChangeCul
1.74 D derive: Deriving GitSignsTopdeleteCul from GitSignsDeleteCul
1.75 D derive: Deriving GitSignsUntrackedCul from GitSignsAddCul
1.79 D derive: Deriving GitSignsStagedAdd from GitSignsAdd
1.81 D derive: Deriving GitSignsStagedChange from GitSignsChange
1.83 D derive: Deriving GitSignsStagedDelete from GitSignsDelete
1.87 D derive: Deriving GitSignsStagedChangedelete from GitSignsChangedelete
1.89 D derive: Deriving GitSignsStagedTopdelete from GitSignsTopdelete
1.91 D derive: Deriving GitSignsStagedUntracked from GitSignsUntracked
1.93 D derive: Deriving GitSignsStagedAddNr from GitSignsAddNr
1.94 D derive: Deriving GitSignsStagedChangeNr from GitSignsChangeNr
1.96 D derive: Deriving GitSignsStagedDeleteNr from GitSignsDeleteNr
1.98 D derive: Deriving GitSignsStagedChangedeleteNr from GitSignsChangedeleteNr
2.00 D derive: Deriving GitSignsStagedTopdeleteNr from GitSignsTopdeleteNr
2.03 D derive: Deriving GitSignsStagedUntrackedNr from GitSignsUntrackedNr
2.06 D derive: Deriving GitSignsStagedAddLn from GitSignsAddLn
2.09 D derive: Deriving GitSignsStagedChangeLn from GitSignsChangeLn
2.12 D derive: Deriving GitSignsStagedChangedeleteLn from GitSignsChangedeleteLn
2.17 D derive: Could not derive GitSignsStagedTopdeleteLn
2.25 D derive: Deriving GitSignsStagedUntrackedLn from GitSignsUntrackedLn
2.30 D derive: Deriving GitSignsStagedAddCul from GitSignsAddCul
2.33 D derive: Deriving GitSignsStagedChangeCul from GitSignsChangeCul
2.35 D derive: Deriving GitSignsStagedDeleteCul from GitSignsDeleteCul
2.38 D derive: Deriving GitSignsStagedChangedeleteCul from GitSignsChangedeleteCul
2.42 D derive: Deriving GitSignsStagedTopdeleteCul from GitSignsTopdeleteCul
2.49 D derive: Deriving GitSignsStagedUntrackedCul from GitSignsUntrackedCul
2.52 D derive: Deriving GitSignsAddPreview from DiffAdd
2.58 D derive: Deriving GitSignsDeletePreview from DiffDelete
2.60 D derive: Deriving GitSignsCurrentLineBlame from NonText
2.63 D derive: Deriving GitSignsAddInline from TermCursor
2.65 D derive: Deriving GitSignsDeleteInline from TermCursor
2.67 D derive: Deriving GitSignsChangeInline from TermCursor
2.70 D derive: Deriving GitSignsAddLnInline from GitSignsAddInline
2.72 D derive: Deriving GitSignsChangeLnInline from GitSignsChangeInline
2.77 D derive: Deriving GitSignsDeleteLnInline from GitSignsDeleteInline
2.79 D derive: Deriving GitSignsDeleteVirtLn from DiffDelete
2.81 D derive: Deriving GitSignsDeleteVirtLnInLine from GitSignsDeleteLnInline
2.83 D derive: Deriving GitSignsVirtLnum from GitSignsDeleteVirtLn
10.02 D attach(1): Attaching (trigger=BufReadPost)
10.12 D run_job: git --version
40.22 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD
44.42 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /work/github/gitsigns.nvim/.git config user.name
47.95 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /work/github/gitsigns.nvim/.git -c core.quotepath=off ls-files --stage --others --exclude-standard --eol
/work/github/gitsigns.nvim/lua/gitsigns/actions.lua
52.63 D watch_gitdir(1): Watching git dir
52.89 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /work/github/gitsigns.nvim/.git show 6ccad6e01f6c57c7389e3978d4b37562efef53f5
60.12 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /work/github/gitsigns.nvim/.git show HEAD:lua/gitsigns/actions.lua
99.58 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD
2874.32 D cli.run: Running action 'blame' with arguments {}
2875.62 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /work/github/gitsigns.nvim/.git blame --incremental --contents - -- /work/github/gitsigns.nvim/lua/gits
igns/actions.lua
8608.14 D show(3): Detached
8608.14 D show(3): Cache was nil
8608.21 D attach(3): Attaching (trigger=BufFilePost)
8608.44 D show: Gitsigns buffer for file 'lua/gitsigns/actions.lua' from path 'nil' on commit '9521fe8be39255b9abc6ec54e352bf04c410f5cf^'
8608.98 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /work/github/gitsigns.nvim/.git show 9521fe8be39255b9abc6ec54e352bf04c410f5cf^:lua/gitsigns/actions.lua
8611.33 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD
8627.77 D show(1): bufname gitsigns:///work/github/gitsigns.nvim/.git//9521fe8be39255b9abc6ec54e352bf04c410f5cf^:lua/gitsigns/actions.lua
10630.76 E ...tsigns/gitsigns_issue/gitsigns/lua/gitsigns/diffthis.lua<228>: Show buffer 'gitsigns:///work/github/gitsigns.nvim/.git//9521fe8be39255b9abc6ec54e352bf04c410f5cf^:lua/gitsigns/actions.lua
' did not attach
stack traceback:
        ...signs/gitsigns_issue/gitsigns/lua/gitsigns/debug/log.lua:134: in function 'eprint'
        ...signs/gitsigns_issue/gitsigns/lua/gitsigns/debug/log.lua:145: in function 'eprintf'
        ...tsigns/gitsigns_issue/gitsigns/lua/gitsigns/diffthis.lua:228: in function <...tsigns/gitsigns_issue/gitsigns/lua/gitsigns/diffthis.lua:208>
19659.33 D cli.run: Running action 'debug_messages' with arguments {}

Gitsigns cache

{ {
    blame = { "...",
      length = 1039
    },
    bufnr = 1,
    compare_text = { "...",
      head = "local async = require('gitsigns.async')",
      length = 1040
    },
    compare_text_head = { "...",
      head = "local async = require('gitsigns.async')",
      length = 1040
    },
    file = "/work/github/gitsigns.nvim/lua/gitsigns/actions.lua",
    force_next_update = false,
    git_obj = {
      encoding = "utf-8",
      file = "/work/github/gitsigns.nvim/lua/gitsigns/actions.lua",
      i_crlf = false,
      mode_bits = "100644",
      object_name = "6ccad6e01f6c57c7389e3978d4b37562efef53f5",
      relpath = "lua/gitsigns/actions.lua",
      repo = {
        abbrev_head = "main",
        detached = false,
        gitdir = "/work/github/gitsigns.nvim/.git",
        toplevel = "/work/github/gitsigns.nvim",
        username = "Jonas Hsiao"
      },
      w_crlf = false
    },
    gitdir_watcher = <userdata 1>,
    hunks = { "...",
      length = 0
    },
    hunks_staged = { "...",
      length = 0
    },
    staged_diffs = { "...",
      length = 0
    }
  } }

jonas0616 avatar Mar 22 '25 10:03 jonas0616

@lewis6991 I can confirm that commit 74983b4 has resolved the issue. However, when I use reblame, the cursor jumps to the top of the file instead of staying on the line where reblame was triggered.

I've been using this fixed version for a while now. Is there any plan to merge the fix into the main branch?

jonas0616 avatar Apr 26 '25 23:04 jonas0616