Skip to content

Conflict with vim-fugitive when staging a hunk #916

@m-demare

Description

@m-demare

Description

I'm having the following issue: when I'm viewing a diff in fugitive, and I stage a hunk with gitsigns, the colours on all windows glitch out. The only way to fix them is to close the diff windows

Neovim version

NVIM v0.9.4 Build type: Release LuaJIT 2.1.1699392533 system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/usr/share/nvim"

Operating system and version

Arch linux

Expected behavior

No response

Actual behavior

This is what it looks like:

Before stage:
unnamed

After stage:
unnamed

Minimal config

for name, url in pairs{
    gitsigns = 'https://github.com/lewis6991/gitsigns.nvim',
    fugitive = 'https://github.com/tpope/vim-fugitive',
} 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,
    on_attach = function(bufnr)
        local gs = package.loaded.gitsigns
        vim.keymap.set('n', '<leader>hs', gs.stage_hunk, { buffer = bufnr, silent = true })
    end
}

Steps to reproduce

  1. nvim --clean -u minimal.lua
  2. Open fugitive with :G
  3. Use dv on an unstaged file to open diff
  4. Use <leader>hs on a hunk to stage it

Gitsigns debug messages

run_job: git --version
run_job: git --no-pager --literal-pathspecs -c gc.auto=0 rev-parse --show-toplevel --git-dir --abbrev-ref HEAD
signs.init: Using extmark signs
dprintf: Deriving GitSignsAdd from DiffAdd
dprintf: Deriving GitSignsChange from DiffChange
dprintf: Deriving GitSignsDelete from DiffDelete
dprintf: Deriving GitSignsChangedelete from GitSignsChange
dprintf: Deriving GitSignsTopdelete from GitSignsDelete
dprintf: Deriving GitSignsUntracked from GitSignsAdd
dprintf: Deriving GitSignsAddNr from GitSignsAdd
dprintf: Deriving GitSignsChangeNr from GitSignsChange
dprintf: Deriving GitSignsDeleteNr from GitSignsDelete
dprintf: Deriving GitSignsChangedeleteNr from GitSignsChangeNr
dprintf: Deriving GitSignsTopdeleteNr from GitSignsDeleteNr
dprintf: Deriving GitSignsUntrackedNr from GitSignsAddNr
dprintf: Deriving GitSignsAddLn from DiffAdd
dprintf: Deriving GitSignsChangeLn from DiffChange
dprintf: Deriving GitSignsChangedeleteLn from GitSignsChangeLn
dprintf: Deriving GitSignsUntrackedLn from GitSignsAddLn
dprintf: Deriving GitSignsStagedAdd from GitSignsAdd
dprintf: Deriving GitSignsStagedChange from GitSignsChange
dprintf: Deriving GitSignsStagedDelete from GitSignsDelete
dprintf: Deriving GitSignsStagedChangedelete from GitSignsChangedelete
dprintf: Deriving GitSignsStagedTopdelete from GitSignsTopdelete
dprintf: Deriving GitSignsStagedAddNr from GitSignsAddNr
dprintf: Deriving GitSignsStagedChangeNr from GitSignsChangeNr
dprintf: Deriving GitSignsStagedDeleteNr from GitSignsDeleteNr
dprintf: Deriving GitSignsStagedChangedeleteNr from GitSignsChangedeleteNr
dprintf: Deriving GitSignsStagedTopdeleteNr from GitSignsTopdeleteNr
dprintf: Deriving GitSignsStagedAddLn from GitSignsAddLn
dprintf: Deriving GitSignsStagedChangeLn from GitSignsChangeLn
dprintf: Could not derive GitSignsStagedDeleteLn
dprintf: Deriving GitSignsStagedChangedeleteLn from GitSignsChangedeleteLn
dprintf: Could not derive GitSignsStagedTopdeleteLn
dprintf: Deriving GitSignsAddPreview from DiffAdd
dprintf: Deriving GitSignsDeletePreview from DiffDelete
dprintf: Deriving GitSignsCurrentLineBlame from NonText
dprintf: Deriving GitSignsAddInline from TermCursor
dprintf: Deriving GitSignsDeleteInline from TermCursor
dprintf: Deriving GitSignsChangeInline from TermCursor
dprintf: Deriving GitSignsAddLnInline from GitSignsAddInline
dprintf: Deriving GitSignsChangeLnInline from GitSignsChangeInline
dprintf: Deriving GitSignsDeleteLnInline from GitSignsDeleteInline
dprintf: Deriving GitSignsDeleteVirtLn from DiffDelete
dprintf: Deriving GitSignsDeleteVirtLnInLine from GitSignsDeleteLnInline
dprintf: Deriving GitSignsVirtLnum from GitSignsDeleteVirtLn
attach(2): Attaching (trigger=BufReadPost)
attach(2): Non-normal buffer
attach(2): Attaching (trigger=BufReadPost)
attach(2): Non-normal buffer
attach(1): Attaching (trigger=BufReadPost)
run_job: git --no-pager --literal-pathspecs -c gc.auto=0 config user.name
attach(3): Attaching (trigger=BufReadPost)
get_buf_path(3): Fugitive buffer for file '/home/matias/localwork/dotfiles/vim/nvim/lua/autocmds.lua' from path 'fugitive:///home/matias/localwork/dotfiles/.git//0/vim/nvim/lua/autocmds
.lua'
run_job: git --no-pager --literal-pathspecs -c gc.auto=0 config user.name
run_job: git --no-pager --literal-pathspecs -c gc.auto=0 rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD
run_job: git --no-pager --literal-pathspecs -c gc.auto=0 rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD
run_job: git --no-pager --literal-pathspecs -c gc.auto=0 --git-dir /home/matias/localwork/dotfiles/.git -c core.quotepath=off ls-files --stage --others --exclude-standard --eol /home/ma
tias/localwork/dotfiles/vim/nvim/lua/autocmds.lua
run_job: git --no-pager --literal-pathspecs -c gc.auto=0 --git-dir /home/matias/localwork/dotfiles/.git -c core.quotepath=off ls-files --stage --others --exclude-standard --eol /home/ma
tias/localwork/dotfiles/vim/nvim/lua/autocmds.lua
watch_gitdir(1): Watching git dir
run_job: git --no-pager --literal-pathspecs -c gc.auto=0 --git-dir /home/matias/localwork/dotfiles/.git show :0:vim/nvim/lua/autocmds.lua
watch_gitdir(3): Watching git dir
run_job: git --no-pager --literal-pathspecs -c gc.auto=0 --git-dir /home/matias/localwork/dotfiles/.git show :0:vim/nvim/lua/autocmds.lua
update(1): updates: 1, jobs: 10
update(3): updates: 2, jobs: 10
run_job: git --no-pager --literal-pathspecs -c gc.auto=0 --git-dir /home/matias/localwork/dotfiles/.git apply --whitespace=nowarn --cached --unidiff-zero -
watcher_cb(1): Git dir update: 'index.lock' { rename = true } (ignoring)
watcher_cb(3): Git dir update: 'index.lock' { rename = true } (ignoring)
watcher_cb(1): Git dir update: 'index.lock' { change = true } (ignoring)
watcher_cb(3): Git dir update: 'index.lock' { change = true } (ignoring)
watcher_cb(1): Git dir update: 'index.lock' { rename = true } (ignoring)
watcher_cb(3): Git dir update: 'index.lock' { rename = true } (ignoring)
watcher_cb(1): Git dir update: 'index' { rename = true }
watcher_cb(3): Git dir update: 'index' { rename = true }
run_job: git --no-pager --literal-pathspecs -c gc.auto=0 --git-dir /home/matias/localwork/dotfiles/.git show :0:vim/nvim/lua/autocmds.lua
update(1): updates: 3, jobs: 12
attach(2): Attaching (trigger=BufReadPost)
attach(2): Non-normal buffer
attach(3): Already attached
update(3): updates: 4, jobs: 12
run_job: git --no-pager --literal-pathspecs -c gc.auto=0 rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD
run_job: git --no-pager --literal-pathspecs -c gc.auto=0 rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD
run_job: git --no-pager --literal-pathspecs -c gc.auto=0 --git-dir /home/matias/localwork/dotfiles/.git -c core.quotepath=off ls-files --stage --others --exclude-standard --eol /home/ma
tias/localwork/dotfiles/vim/nvim/lua/autocmds.lua
run_job: git --no-pager --literal-pathspecs -c gc.auto=0 --git-dir /home/matias/localwork/dotfiles/.git -c core.quotepath=off ls-files --stage --others --exclude-standard --eol /home/ma
tias/localwork/dotfiles/vim/nvim/lua/autocmds.lua
run_job: git --no-pager --literal-pathspecs -c gc.auto=0 --git-dir /home/matias/localwork/dotfiles/.git show :0:vim/nvim/lua/autocmds.lua
run_job: git --no-pager --literal-pathspecs -c gc.auto=0 --git-dir /home/matias/localwork/dotfiles/.git show :0:vim/nvim/lua/autocmds.lua
update(1): updates: 5, jobs: 18
update(3): updates: 6, jobs: 18
cli.run: Running action 'debug_messages' with arguments {}

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