NeogitOrg / neogit

An interactive and powerful Git interface for Neovim, inspired by Magit
MIT License
4.08k stars 241 forks source link

Async errors + Neogit showing outdated state: neogit/lib/buffer.lua:349: Invalid buffer id: 44 #1377

Closed fnune closed 4 months ago

fnune commented 5 months ago

Description

While using Neovim, I get messages popping up async (not directly during or after an action) saying Invalid buffer id: <some buffer id>.

This seems to manifest in that Neogit no longer shows up-to-date information (e.g. I know I've staged some changes, but the UI has not updated, or I know I've committed, but there are still staged changes in Neogit, sometimes with duplicated things like the same staged file listed twice).

Dump of messages:

stack traceback:
^I[C]: in function 'nvim_set_option_value'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: in function 'set_buffer_option'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:331: in function 'unlock'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:645: in function 'update'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:631: in function 'render'
^I...hare/nvim/lazy/neogit/lua/neogit/buffers/status/init.lua:291: in function 'callback'
^I...share/nvim/lazy/neogit/lua/neogit/lib/git/repository.lua:266: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'saved_callback'
^I...are/nvim/lazy/plenary.nvim/lua/plenary/async/control.lua:126: in function 'tx'
^I.../share/nvim/lazy/plenary.nvim/lua/plenary/async/util.lua:67: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
^I...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:282: in function <...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:244>
.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: Invalid buffer id: 24
stack traceback:
^I[C]: in function 'nvim_set_option_value'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: in function 'set_buffer_option'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:331: in function 'unlock'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:645: in function 'update'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:631: in function 'render'
^I...hare/nvim/lazy/neogit/lua/neogit/buffers/status/init.lua:291: in function 'callback'
^I...share/nvim/lazy/neogit/lua/neogit/lib/git/repository.lua:266: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'saved_callback'
^I...are/nvim/lazy/plenary.nvim/lua/plenary/async/control.lua:126: in function 'tx'
^I.../share/nvim/lazy/plenary.nvim/lua/plenary/async/util.lua:67: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
^I...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:282: in function <...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:244> function: builtin#18 .../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: Invalid buffer id: 44
stack traceback:
^I[C]: in function 'nvim_set_option_value'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: in function 'set_buffer_option'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:331: in function 'unlock'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:645: in function 'update'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:631: in function 'render'
^I...hare/nvim/lazy/neogit/lua/neogit/buffers/status/init.lua:291: in function 'callback'
^I...share/nvim/lazy/neogit/lua/neogit/lib/git/repository.lua:266: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'saved_callback'
^I...are/nvim/lazy/plenary.nvim/lua/plenary/async/control.lua:126: in function 'tx'
^I.../share/nvim/lazy/plenary.nvim/lua/plenary/async/util.lua:67: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
^I...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:282: in function <...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:244> function: builtin#18 .../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: Invalid buffer id: 24
stack traceback:
^I[C]: in function 'nvim_set_option_value'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: in function 'set_buffer_option'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:331: in function 'unlock'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:645: in function 'update'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:631: in function 'render'
^I...hare/nvim/lazy/neogit/lua/neogit/buffers/status/init.lua:291: in function 'callback'
^I...share/nvim/lazy/neogit/lua/neogit/lib/git/repository.lua:266: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'saved_callback'
^I...are/nvim/lazy/plenary.nvim/lua/plenary/async/control.lua:126: in function 'tx'
^I.../share/nvim/lazy/plenary.nvim/lua/plenary/async/util.lua:67: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
^I...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:282: in function <...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:244>
".git/COMMIT_EDITMSG" 22L, 565B written
Committed
.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: Invalid buffer id: 24
stack traceback:
^I[C]: in function 'nvim_set_option_value'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: in function 'set_buffer_option'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:331: in function 'unlock'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:645: in function 'update'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:631: in function 'render'
^I...hare/nvim/lazy/neogit/lua/neogit/buffers/status/init.lua:291: in function 'callback'
^I...share/nvim/lazy/neogit/lua/neogit/lib/git/repository.lua:266: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'saved_callback'
^I...are/nvim/lazy/plenary.nvim/lua/plenary/async/control.lua:126: in function 'tx'
^I.../share/nvim/lazy/plenary.nvim/lua/plenary/async/util.lua:67: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
^I...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:282: in function <...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:244> function: builtin#18 .../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: Invalid buffer id: 44
stack traceback:
^I[C]: in function 'nvim_set_option_value'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: in function 'set_buffer_option'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:331: in function 'unlock'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:645: in function 'update'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:631: in function 'render'
^I...hare/nvim/lazy/neogit/lua/neogit/buffers/status/init.lua:291: in function 'callback'
^I...share/nvim/lazy/neogit/lua/neogit/lib/git/repository.lua:266: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'saved_callback'
^I...are/nvim/lazy/plenary.nvim/lua/plenary/async/control.lua:126: in function 'tx'
^I.../share/nvim/lazy/plenary.nvim/lua/plenary/async/util.lua:67: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
^I...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:282: in function <...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:244> function: builtin#18 .../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: Invalid buffer id: 24
stack traceback:
^I[C]: in function 'nvim_set_option_value'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: in function 'set_buffer_option'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:331: in function 'unlock'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:645: in function 'update'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:631: in function 'render'
^I...hare/nvim/lazy/neogit/lua/neogit/buffers/status/init.lua:291: in function 'callback'
^I...share/nvim/lazy/neogit/lua/neogit/lib/git/repository.lua:266: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'saved_callback'
^I...are/nvim/lazy/plenary.nvim/lua/plenary/async/control.lua:126: in function 'tx'
^I.../share/nvim/lazy/plenary.nvim/lua/plenary/async/util.lua:67: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
^I...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:282: in function <...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:244> function: builtin#18 .../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: Invalid buffer id: 58
stack traceback:
^I[C]: in function 'nvim_set_option_value'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: in function 'set_buffer_option'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:331: in function 'unlock'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:645: in function 'update'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:631: in function 'render'
^I...hare/nvim/lazy/neogit/lua/neogit/buffers/status/init.lua:291: in function 'callback'
^I...share/nvim/lazy/neogit/lua/neogit/lib/git/repository.lua:266: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'saved_callback'
^I...are/nvim/lazy/plenary.nvim/lua/plenary/async/control.lua:126: in function 'tx'
^I.../share/nvim/lazy/plenary.nvim/lua/plenary/async/util.lua:67: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
^I...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:282: in function <...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:244>
.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: Invalid buffer id: 24
stack traceback:
^I[C]: in function 'nvim_set_option_value'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: in function 'set_buffer_option'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:331: in function 'unlock'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:645: in function 'update'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:631: in function 'render'
^I...hare/nvim/lazy/neogit/lua/neogit/buffers/status/init.lua:291: in function 'callback'
^I...share/nvim/lazy/neogit/lua/neogit/lib/git/repository.lua:266: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'saved_callback'
^I...are/nvim/lazy/plenary.nvim/lua/plenary/async/control.lua:126: in function 'tx'
^I.../share/nvim/lazy/plenary.nvim/lua/plenary/async/util.lua:67: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
^I...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:282: in function <...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:244> function: builtin#18 .../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: Invalid buffer id: 44
stack traceback:
^I[C]: in function 'nvim_set_option_value'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: in function 'set_buffer_option'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:331: in function 'unlock'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:645: in function 'update'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:631: in function 'render'
^I...hare/nvim/lazy/neogit/lua/neogit/buffers/status/init.lua:291: in function 'callback'
^I...share/nvim/lazy/neogit/lua/neogit/lib/git/repository.lua:266: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'saved_callback'
^I...are/nvim/lazy/plenary.nvim/lua/plenary/async/control.lua:126: in function 'tx'
^I.../share/nvim/lazy/plenary.nvim/lua/plenary/async/util.lua:67: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
^I...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:282: in function <...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:244> function: builtin#18 .../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: Invalid buffer id: 24
stack traceback:
^I[C]: in function 'nvim_set_option_value'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: in function 'set_buffer_option'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:331: in function 'unlock'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:645: in function 'update'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:631: in function 'render'
^I...hare/nvim/lazy/neogit/lua/neogit/buffers/status/init.lua:291: in function 'callback'
^I...share/nvim/lazy/neogit/lua/neogit/lib/git/repository.lua:266: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'saved_callback'
^I...are/nvim/lazy/plenary.nvim/lua/plenary/async/control.lua:126: in function 'tx'
^I.../share/nvim/lazy/plenary.nvim/lua/plenary/async/util.lua:67: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
^I...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:282: in function <...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:244> function: builtin#18 .../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: Invalid buffer id: 58
stack traceback:
^I[C]: in function 'nvim_set_option_value'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: in function 'set_buffer_option'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:331: in function 'unlock'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:645: in function 'update'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:631: in function 'render'
^I...hare/nvim/lazy/neogit/lua/neogit/buffers/status/init.lua:291: in function 'callback'
^I...share/nvim/lazy/neogit/lua/neogit/lib/git/repository.lua:266: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'saved_callback'
^I...are/nvim/lazy/plenary.nvim/lua/plenary/async/control.lua:126: in function 'tx'
^I.../share/nvim/lazy/plenary.nvim/lua/plenary/async/util.lua:67: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
^I...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:282: in function <...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:244> function: builtin#18 .../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: Invalid buffer id: 44
stack traceback:
^I[C]: in function 'nvim_set_option_value'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:349: in function 'set_buffer_option'
^I.../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:331: in function 'unlock'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:645: in function 'update'
^I....local/share/nvim/lazy/neogit/lua/neogit/lib/ui/init.lua:631: in function 'render'
^I...hare/nvim/lazy/neogit/lua/neogit/buffers/status/init.lua:291: in function 'callback'
^I...share/nvim/lazy/neogit/lua/neogit/lib/git/repository.lua:266: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'saved_callback'
^I...are/nvim/lazy/plenary.nvim/lua/plenary/async/control.lua:126: in function 'tx'
^I.../share/nvim/lazy/plenary.nvim/lua/plenary/async/util.lua:67: in function 'callback'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:25: in function 'callback_or_next'
^I...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
^I...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:282: in function <...sto/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:244>

Neovim version

NVIM v0.10.0 Build type: Release LuaJIT 2.1.1693350652

Operating system and version

Linux feanor 6.8.12 #1-NixOS SMP PREEMPT_DYNAMIC Thu May 30 07:49:53 UTC 2024 x86_64 GNU/Linux

Steps to reproduce

Expected behavior

Actual behavior

Minimal config

-- NOTE: See the end of this file if you are reporting an issue, etc. Ignore all the "scary" functions up top, those are
-- used for setup and other operations.
local M = {}

local base_root_path = vim.fn.fnamemodify(debug.getinfo(1, "S").source:sub(2), ":p:h") .. "/.min"
function M.root(path)
    return base_root_path .. "/" .. (path or "")
end

function M.load_plugin(plugin_name, plugin_url)
    local package_root = M.root("plugins/")
    local install_destination = package_root .. plugin_name
    vim.opt.runtimepath:append(install_destination)

    if not vim.loop.fs_stat(package_root) then
        vim.fn.mkdir(package_root, "p")
    end

    if not vim.loop.fs_stat(install_destination) then
        print(string.format("> Downloading plugin '%s' to '%s'", plugin_name, install_destination))
        vim.fn.system({
            "git",
            "clone",
            "--depth=1",
            plugin_url,
            install_destination,
        })
        if vim.v.shell_error > 0 then
            error(
                string.format("> Failed to clone plugin: '%s' in '%s'!", plugin_name, install_destination),
                vim.log.levels.ERROR
            )
        end
    end
end

---@alias PluginName string The plugin name, will be used as part of the git clone destination
---@alias PluginUrl string The git url at which a plugin is located, can be a path. See https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols for details
---@alias MinPlugins table<PluginName, PluginUrl>

---Do the initial setup. Downloads plugins, ensures the minimal init does not pollute the filesystem by keeping
---everything self contained to the CWD of the minimal init file. Run prior to running tests, reproducing issues, etc.
---@param plugins? table<PluginName, PluginUrl>
function M.setup(plugins)
    vim.opt.packpath = {} -- Empty the package path so we use only the plugins specified
    vim.opt.runtimepath:append(M.root(".min")) -- Ensure the runtime detects the root min dir

    -- Install required plugins
    if plugins ~= nil then
        for plugin_name, plugin_url in pairs(plugins) do
            M.load_plugin(plugin_name, plugin_url)
        end
    end

    vim.env.XDG_CONFIG_HOME = M.root("xdg/config")
    vim.env.XDG_DATA_HOME = M.root("xdg/data")
    vim.env.XDG_STATE_HOME = M.root("xdg/state")
    vim.env.XDG_CACHE_HOME = M.root("xdg/cache")

    -- NOTE: Cleanup the xdg cache on exit so new runs of the minimal init doesn't share any previous state, e.g. shada
    vim.api.nvim_create_autocmd("VimLeave", {
        callback = function()
            vim.fn.system({
                "rm",
                "-r",
                "-f",
                M.root("xdg"),
            })
        end,
    })
end

-- NOTE: If you have additional plugins you need to install to reproduce your issue, include them in the plugins
-- table within the setup call below.
M.setup({
    plenary = "https://github.com/nvim-lua/plenary.nvim.git",
    telescope = "https://github.com/nvim-telescope/telescope.nvim",
    diffview = "https://github.com/sindrets/diffview.nvim",
    neogit = "https://github.com/NeogitOrg/neogit",
})
-- WARN: Do all plugin setup, test runs, reproductions, etc. AFTER calling setup with a list of plugins!
-- Basically, do all that stuff AFTER this line.
require("neogit").setup({}) -- For instance, setup Neogit
fnune commented 5 months ago

I'm closing this because:

I don't understand what's going on, but this is not a great issue anyway.

Minimal config
-- NOTE: See the end of this file if you are reporting an issue, etc. Ignore all the "scary" functions up top, those are
-- used for setup and other operations.
local M = {}

local base_root_path = vim.fn.fnamemodify(debug.getinfo(1, "S").source:sub(2), ":p:h") .. "/.min"
function M.root(path)
    return base_root_path .. "/" .. (path or "")
end

function M.load_plugin(plugin_name, plugin_url)
    local package_root = M.root("plugins/")
    local install_destination = package_root .. plugin_name
    vim.opt.runtimepath:append(install_destination)

    if not vim.loop.fs_stat(package_root) then
        vim.fn.mkdir(package_root, "p")
    end

    if not vim.loop.fs_stat(install_destination) then
        print(string.format("> Downloading plugin '%s' to '%s'", plugin_name, install_destination))
        vim.fn.system({
            "git",
            "clone",
            "--depth=1",
            plugin_url,
            install_destination,
        })
        if vim.v.shell_error > 0 then
            error(
                string.format("> Failed to clone plugin: '%s' in '%s'!", plugin_name, install_destination),
                vim.log.levels.ERROR
            )
        end
    end
end

---@alias PluginName string The plugin name, will be used as part of the git clone destination
---@alias PluginUrl string The git url at which a plugin is located, can be a path. See https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols for details
---@alias MinPlugins table

---Do the initial setup. Downloads plugins, ensures the minimal init does not pollute the filesystem by keeping
---everything self contained to the CWD of the minimal init file. Run prior to running tests, reproducing issues, etc.
---@param plugins? table
function M.setup(plugins)
    vim.opt.packpath = {} -- Empty the package path so we use only the plugins specified
    vim.opt.runtimepath:append(M.root(".min")) -- Ensure the runtime detects the root min dir

    -- Install required plugins
    if plugins ~= nil then
        for plugin_name, plugin_url in pairs(plugins) do
            M.load_plugin(plugin_name, plugin_url)
        end
    end

    vim.env.XDG_CONFIG_HOME = M.root("xdg/config")
    vim.env.XDG_DATA_HOME = M.root("xdg/data")
    vim.env.XDG_STATE_HOME = M.root("xdg/state")
    vim.env.XDG_CACHE_HOME = M.root("xdg/cache")

    -- NOTE: Cleanup the xdg cache on exit so new runs of the minimal init doesn't share any previous state, e.g. shada
    vim.api.nvim_create_autocmd("VimLeave", {
        callback = function()
            vim.fn.system({
                "rm",
                "-r",
                "-f",
                M.root("xdg"),
            })
        end,
    })
end

-- NOTE: If you have additional plugins you need to install to reproduce your issue, include them in the plugins
-- table within the setup call below.
M.setup({
    plenary = "https://github.com/nvim-lua/plenary.nvim.git",
    telescope = "https://github.com/nvim-telescope/telescope.nvim",
    diffview = "https://github.com/sindrets/diffview.nvim",
    neogit = "https://github.com/NeogitOrg/neogit",
})
-- WARN: Do all plugin setup, test runs, reproductions, etc. AFTER calling setup with a list of plugins!
-- Basically, do all that stuff AFTER this line.
require("neogit").setup({}) -- For instance, setup Neogit
fnune commented 5 months ago

Never mind, I managed to reproduce it with a minimal config. What I did was:

When I came back, I saw this (notice Neogit hasn't shown the new state yet: the unmerged commit should be gone):

image

Updating my issue with the minimal config.

fnune commented 5 months ago

I can't tell for sure but it looks like this isn't happening if Neogit is in its own tab. It happens when kind=vsplit (sharing a tab with other non-Neogit windows)?

fnune commented 5 months ago

Just saw this happen on my kind=tab Neogit instance.

fnune commented 5 months ago

@CKolkey Even though I have reproduced this with a minimal config, I am worried that it may still be an issue with my setup. Do you have the same impression?

It's making using Neogit really hard for me. The UI glitches a bit every time I see this error, and in some cases it happens a lot (like 10s of times per second).

Any idea what could be causing it on my side, if that's the case?

CKolkey commented 5 months ago

It might be related to the filewatcher.. You could try disabling that. I feel bad that this is getting in your way, but just to be above board with things, my wife is pregnant right now, and I don't have a lot of time to triage things.

Anyways. I did git reset --hard HEAD~1 in a separate terminal with neogit open and it just works fine :\

fnune commented 5 months ago

:smile: Enjoy your time! I'll try to figure this out own my own. THX

morgsmccauley commented 5 months ago

@CKolkey congrats! ๐ŸŽ‰ ๐Ÿ‘ถ๐Ÿผ

I also have the same issue, and use kind=tab exclusively. Disabling filewatcher has seemed to help.

will-lynas commented 5 months ago

I have the same issue using kind=tab.

tiagolupepic commented 5 months ago

It's happening with me as well, after disabling filewatcher, I'm not having the issue.

@CKolkey congrats! ๐ŸŽ‰ and, thank you for the work done so far here!

fnune commented 5 months ago

Yep, filewatcher = { enabled = false } is a workaround.

It seems like there is a filewatcher implementation problem where filewatcher events are pointing at the wrong window when the UI tries to update.

will-lynas commented 5 months ago

Is there a known good commit?

~Reverting to 98b72c075844aa28338729ffdc9fe8b58e4e7684 seemed to work for me.~

laughingman-hass commented 5 months ago

I'm also seeing this error when you edit a commit even with the filewatcher disabled and kind = 'vsplit'

CKolkey commented 4 months ago

I think this is resolved? I reworked how the filewatcher handles things. Feel free to reopen if you experience it any more :)

will-lynas commented 4 months ago

Seems to be fixed for me