NeogitOrg / neogit

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

Neogit doesn't respond to subcomands #1341

Open kuznetsss opened 4 months ago

kuznetsss commented 4 months ago

Description

Thanks for the amazing plugin! I have an issue that Neogit stops to respond to subcommands after window with git log appears.

Neovim version

NVIM v0.10.0 Build type: Release LuaJIT 2.1.1693350652

Operating system and version

macOS 14.5

Steps to reproduce

  1. Create a directory test and cd into it:
    mkdir test
    cd test
  2. Init git repo
    git init
  3. Create simple precommit hook .git/hooks/pre-commit:
    #!/bin/sh
    sleep 3

    and make the hook executable.

  4. Create file minimal.lua (see minimal config section).
  5. Open nvim using the config:
    NVIM_APP=nvim_test nvim -u ./minimal.lua
  6. Inside nvim open Neogit using :Neogit and stage all the files s and commit cc them
  7. There will be an error in floating window showing git log
    hint: Waiting for your editor to close the file... Error detected while processing command line:
    E5108: Error executing lua Vim(lua):E5108: Error executing lua .../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:266: Cannot split a floating window
    stack traceback:
        [C]: in function 'nvim_open_win'
        .../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:266: in function 'show'
        .../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:557: in function 'create'
        ...hare/nvim/lazy/neogit/lua/neogit/buffers/editor/init.lua:76: in function 'open'
        ...rgey/.local/share/nvim/lazy/neogit/lua/neogit/client.lua:122: in function 'editor'
        [string ":lua"]:1: in main chunk
    stack traceback:
        [C]: in function 'rpcrequest'
        ...gey/.local/share/nvim/lazy/neogit/lua/neogit/lib/rpc.lua:37: in function 'send_cmd'
        ...rgey/.local/share/nvim/lazy/neogit/lua/neogit/client.lua:75: in function 'client'
  8. After that Neogit doesn't respond to any subcommand, for example, after pressing c inside Neogit window to commit, split window with commit subcommands hint opens but nothing works there.

Expected behavior

No error and Neogit is responsive.

Actual behavior

There is an error in floating git log window when I try to commit:

hint: Waiting for your editor to close the file... Error detected while processing command line:
E5108: Error executing lua Vim(lua):E5108: Error executing lua .../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:266: Cannot split a floating window
stack traceback:
        [C]: in function 'nvim_open_win'
        .../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:266: in function 'show'
        .../.local/share/nvim/lazy/neogit/lua/neogit/lib/buffer.lua:557: in function 'create'
        ...hare/nvim/lazy/neogit/lua/neogit/buffers/editor/init.lua:76: in function 'open'
        ...rgey/.local/share/nvim/lazy/neogit/lua/neogit/client.lua:122: in function 'editor'
        [string ":lua"]:1: in main chunk
stack traceback:
        [C]: in function 'rpcrequest'
        ...gey/.local/share/nvim/lazy/neogit/lua/neogit/lib/rpc.lua:37: in function 'send_cmd'
        ...rgey/.local/share/nvim/lazy/neogit/lua/neogit/client.lua:75: in function 'client'

And Neogit becomes not responsive to subcommands.

Minimal config

local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system {
    'git',
    'clone',
    '--filter=blob:none',
    'https://github.com/folke/lazy.nvim.git',
    '--branch=stable', -- latest stable release
    lazypath,
  }
end
vim.opt.rtp:prepend(lazypath)

require('lazy').setup({
    'NeogitOrg/neogit',
    dependencies = {
      'nvim-lua/plenary.nvim',         -- required
      'nvim-telescope/telescope.nvim', -- optional
      'sindrets/diffview.nvim',        -- optional
    },
    config = function()
      require('neogit').setup {
        commit_editor = {
          kind = 'split',
        },
      }
    end,
  }
)
jdearmas commented 1 month ago

Upgrading to neovim v0.10.1 fixed this issue for me.