Skip to content

git blame fails -- looks like the git command is incorrect #975

@tkinz27

Description

@tkinz27

Description

Recently updated plugin now fails to git blame the current line. The output from :messages

My config (pretty close to LazyVim configuration just with the added blame configuration). The minimal reproduction config below works too.

My version of gitsigns plugin

~/.local/share/nvim/lazy/gitsigns.nvim main
❯ git rev-parse HEAD
fa052c20aa7cc62ce6a328c7f3bd556c93b5370e

Maybe related to #974 ?

Neovim version

❯ nvim --version NVIM v0.10.0-dev-2410+g6d8bbfe19-Homebrew Build type: Release LuaJIT 2.1.1710088188 Run "nvim -V1 -v" for more info

Operating system and version

MacOS (apple silicon)

Expected behavior

git blame integration works without error.

Actual behavior

Error running git-blame: usage: git blame [<options>] [<rev-opts>] [<rev>] [--] <file>

    <rev-opts> are documented in git-rev-list(1)

    --[no-]incremental    show blame entries as we find them, incrementally
    -b                    do not show object names of boundary commits (Default: off)
    --[no-]root           do not treat root commits as boundaries (Default: off)
    --[no-]show-stats     show work cost statistics
    --[no-]progress       force progress reporting
    --[no-]score-debug    show output score for blame entries
    -f, --[no-]show-name  show original filename (Default: auto)
    -n, --[no-]show-number
                          show original linenumber (Default: off)
    -p, --[no-]porcelain  show in a format designed for machine consumption
    --[no-]line-porcelain show porcelain format with per-line commit information
    -c                    use the same output mode as git-annotate (Default: off)
    -t                    show raw timestamp (Default: off)
    -l                    show long commit SHA1 (Default: off)
    -s                    suppress author name and timestamp (Default: off)
    -e, --[no-]show-email show author email instead of name (Default: off)
    -w                    ignore whitespace differences
    --[no-]ignore-rev <rev>
                          ignore <rev> when blaming
    --[no-]ignore-revs-file <file>
                          ignore revisions from <file>
    --[no-]color-lines    color redundant metadata from previous line differently
    --[no-]color-by-age   color lines by age
    --[no-]minimal        spend extra cycles to find better match
    -S <file>             use revisions from <file> instead of calling git-rev-list
    --[no-]contents <file>
                          use <file>'s contents as the final image
    -C[<score>]           find line copies within and across files
    -M[<score>]           find line movements within and across files
    -L <range>            process only line range <start>,<end> or function :<funcname>
    --[no-]abbrev[=<n>]   use <n> digits to display object names

Error executing vim.schedule lua callback: ...cal/share/nvim/lazy/gitsigns.nvim/lua/gitsigns/async.lua:85: The coroutine failed with this message: ...l/share/nvim/lazy/gitsigns.nvim/lua/gitsigns/actions.lua:938: assertion failed!
stack traceback:
        [C]: in function 'assert'
        ...l/share/nvim/lazy/gitsigns.nvim/lua/gitsigns/actions.lua:938: in function <...l/share/nvim/lazy/gitsigns.nvim/lua/gitsigns/actions.lua:905>
stack traceback:
        [C]: in function 'error'
        ...cal/share/nvim/lazy/gitsigns.nvim/lua/gitsigns/async.lua:85: in function 'cb'
        ...cal/share/nvim/lazy/gitsigns.nvim/lua/gitsigns/async.lua:127: in function <...cal/share/nvim/lazy/gitsigns.nvim/lua/gitsigns/async.lua:126>

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
        current_line_blame = true,
      current_line_blame_opts = { delay = 1000, virt_text_priority = 100, virt_text = true, virt_text_pos = 'eol' },
      debug_mode = true,
}

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

Steps to reproduce

  1. nvim --clean -u minimal.lua
  2. ...

Gitsigns debug messages

relevant lines

run_job: git --no-pager --literal-pathspecs -c gc.auto=0 --git-dir /Users/tony.kinsley/code/github.com/braincorp/titanium/.git blame --contents - --incremental -- /Users/tony.kinsley/code/github.com/braincorp/titanium/api/proto/autoroboapi/v1/alerts.proto --igno
re-revs-file /Users/tony.kinsley/code/github.com/braincorp/titanium/.git-blame-ignore-revs
run_job: git --no-pager --literal-pathspecs -c gc.auto=0 --git-dir /Users/tony.kinsley/code/github.com/braincorp/titanium/.git blame --contents - --incremental -- /Users/tony.kinsley/code/github.com/braincorp/titanium/api/proto/autoroboapi/v1/alerts.proto --igno
re-revs-file /Users/tony.kinsley/code/github.com/braincorp/titanium/.git-blame-ignore-revs

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