Skip to content

Gitsigns blame crashes on Neovim versions prior to 0.11 #1405

@IIIHSUAN

Description

@IIIHSUAN

Description

Hello, this issue has the same error as described in #1388 but on a different line, which is caused by the non-compatible function signature of vim.str_utfindex in neovim 0.11 at blame.lua:66.

Neovim version

NVIM v0.10.4 Build type: Release LuaJIT 2.1.1713484068

Operating system and version

Debian GNU/Linux 12 (bookworm)

Expected behavior

No response

Actual behavior

Error after running :Gitsigns blame:

Error executing vim.schedule lua callback: ...e/nvim/lazy/gitsigns.nvim/lua/gitsigns/actions/blame.lua:66: bad argument #2 to 'str_utfindex' (number expected, got string)
stack traceback:
	[thread: 0x7fec1643e940] [C]: in function 'str_utfindex'
	[thread: 0x7fec1643e940] ...e/nvim/lazy/gitsigns.nvim/lua/gitsigns/actions/blame.lua:66: in function 'lalign'
	[thread: 0x7fec1643e940] ...e/nvim/lazy/gitsigns.nvim/lua/gitsigns/actions/blame.lua:119: in function 'render'
	[thread: 0x7fec1643e940] ...e/nvim/lazy/gitsigns.nvim/lua/gitsigns/actions/blame.lua:362: in function 'blame'
	[thread: 0x7fec1643e940] ...l/share/nvim/lazy/gitsigns.nvim/lua/gitsigns/actions.lua:646: in function <...l/share/nvim/lazy/gitsigns.nvim/lua/gitsigns/actions.lua:645>
stack traceback:
	[C]: in function 'error'
	...cal/share/nvim/lazy/gitsigns.nvim/lua/gitsigns/async.lua:232: in function '_finish'
	...cal/share/nvim/lazy/gitsigns.nvim/lua/gitsigns/async.lua:300: in function '_resume'
	...cal/share/nvim/lazy/gitsigns.nvim/lua/gitsigns/async.lua:321: in function <...cal/share/nvim/lazy/gitsigns.nvim/lua/gitsigns/async.lua:311>

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

Open any file, and run :Gitsigns blame.

Gitsigns debug messages

90.54 D git: git rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD
93.49 D git: git rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD
97.22 D git: git --git-dir $CWD/.git config user.name
103.27 D git: git --git-dir $CWD/.git  ls-files --stage --others --exclude-standard --eol $CWD/LICENSE
108.57 D attach(9): Watching git dir
108.69 D git: git --git-dir $CWD/.git show 6598444ff2add868068a7697b1277b1b59213f8d
114.54 D git: git --git-dir $CWD/.git show HEAD:LICENSE
120.19 D attach(9): attach complete
|
2078.38 D cli.run: Running action 'blame' with arguments {}
2078.95 D git: git --git-dir $CWD/.git blame --incremental --contents - -- $CWD/LICENSE
2105.18 D detach(12): Detached
2105.19 D detach(12): Cache was nil
2105.35 D attach(12): Attaching (trigger=BufFilePost)
2105.39 D attach(12): Non-normal buffer
|
10896.33 D cli.run: Running action 'debug_messages' with arguments {}

Gitsigns cache

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions