NeogitOrg / neogit

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

`Head: 0000000 (no commits)` on repositories. `Missing oid` #1449

Closed azzamsa closed 1 month ago

azzamsa commented 3 months ago

Description

Sometimes I get Head: 0000000 (no commits) on large repos, sometimes it is not. I can't do anything but to close-and-reopen nvim and then invoke Neogit again until it succeded.

image

ngit_here. cwd = /home/alice/playground/rust
...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../share/nvim/lazy/neogit/lua/neogit/lib/git/rev_parse.lua:11: Missing oid
stack traceback:
    [C]: in function 'error'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
    ...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:299: in function <...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:264>
...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../share/nvim/lazy/neogit/lua/neogit/lib/git/rev_parse.lua:11: Missing oid
stack traceback:
    [C]: in function 'error'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
    ...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:299: in function <...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:264> function: builtin#18 ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../share/nvim/lazy/neogit/lua/neogit/lib/git/sequencer.lua:50: attempt to index local 'HEAD_oid' (a nil value)
stack traceback:
    [C]: in function 'error'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
    ...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:299: in function <...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:264>
...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../share/nvim/lazy/neogit/lua/neogit/lib/git/rev_parse.lua:11: Missing oid
stack traceback:
    [C]: in function 'error'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
    ...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:299: in function <...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:264> function: builtin#18 ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../share/nvim/lazy/neogit/lua/neogit/lib/git/sequencer.lua:50: attempt to index local 'HEAD_oid' (a nil value)
stack traceback:
    [C]: in function 'error'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
    ...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:299: in function <...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:264> function: builtin#18 ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../share/nvim/lazy/neogit/lua/neogit/lib/git/rev_parse.lua:11: Missing oid
stack traceback:
    [C]: in function 'error'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
    ...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:299: in function <...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:264>
...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../share/nvim/lazy/neogit/lua/neogit/lib/git/rev_parse.lua:11: Missing oid
stack traceback:
    [C]: in function 'error'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
    ...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:299: in function <...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:264> function: builtin#18 ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../share/nvim/lazy/neogit/lua/neogit/lib/git/sequencer.lua:50: attempt to index local 'HEAD_oid' (a nil value)
stack traceback:
    [C]: in function 'error'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
    ...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:299: in function <...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:264> function: builtin#18 ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../share/nvim/lazy/neogit/lua/neogit/lib/git/rev_parse.lua:11: Missing oid
stack traceback:
    [C]: in function 'error'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
    ...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:299: in function <...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:264> function: builtin#18 ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../share/nvim/lazy/neogit/lua/neogit/lib/git/sequencer.lua:50: attempt to index local 'HEAD_oid' (a nil value)
stack traceback:
    [C]: in function 'error'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
    ...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:299: in function <...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:264>
E21: Cannot make changes, 'modifiable' is off

Neovim version

🦄 nvim --version NVIM v0.10.0 Build type: Release LuaJIT 2.1.1713484068 Run "nvim -V1 -v" for more info

🦄 neovide --version neovide 0.13.3

Operating system and version

Fedora Linux 40 (Workstation Edition) x86_64

Steps to reproduce

  1. Use "neogit": { "branch": "master", "commit": "2b74a777b963dfdeeabfabf84d5ba611666adab4" },
  2. Open any big repo (sometimes I also able to reproduce on small repo)
  3. Invoke neogit with require("neogit").open({ cwd = path }).
  4. You will get (sometimes) Head: 0000000 (no commits)

Expected behavior

Display git status correctly

Actual behavior

I get Head: 0000000 (no commits) instead

Minimal config

{
        "neogitorg/neogit",
        event = "VeryLazy",
        config = function()
            local neogit = require("neogit")
            neogit.setup({
                mappings = {
                    commit_editor = {
                        ["<c-c><c-g>"] = "Abort",
                        ["<c-c><c-k>"] = false,
                    },
                    rebase_editor = {
                        -- `C-c C-k` doesn't work
                        ["<c-c><c-g>"] = "Abort",
                        ["<c-c><c-k>"] = false,

                        ["gi"] = "MoveUp", -- default: gk
                        ["ge"] = "MoveDown", -- default: gj
                    },
                },
            })
        end,
    },
CKolkey commented 3 months ago

How large in terms of commits are we talking here?

azzamsa commented 3 months ago

Now, It happens to almost all my repo.

function M.neogit_open(path)
    print("path before neogit open = " .. path)
    require("neogit").open({ cwd = path })
end
path before neogit open = /home/my/dotfiles
...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../share/nvim/lazy/neogit/lua/neogit/lib/git/sequencer.lua:50: attempt to index local 'HEAD_oid' (a nil value)
stack traceback:
    [C]: in function 'error'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'

this is the full log

...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../share/nvim/lazy/neogit/lua/neogit/lib/git/sequencer.lua:50: attempt to index local 'HEAD_oid' (a nil value)
stack traceback:
    [C]: in function 'error'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
    ...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:299: in function <...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:264>
...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../share/nvim/lazy/neogit/lua/neogit/lib/git/sequencer.lua:50: attempt to index local 'HEAD_oid' (a nil value)
stack traceback:
    [C]: in function 'error'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
    ...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:299: in function <...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:264> function: builtin#18 ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../share/nvim/lazy/neogit/lua/neogit/lib/git/rev_parse.lua:11: Missing oid
stack traceback:
    [C]: in function 'error'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
    ...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:299: in function <...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:264>
...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../share/nvim/lazy/neogit/lua/neogit/lib/git/sequencer.lua:50: attempt to index local 'HEAD_oid' (a nil value)
stack traceback:
    [C]: in function 'error'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
    ...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:299: in function <...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:264> function: builtin#18 ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../share/nvim/lazy/neogit/lua/neogit/lib/git/rev_parse.lua:11: Missing oid
stack traceback:
    [C]: in function 'error'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
    ...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:299: in function <...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:264> function: builtin#18 ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../share/nvim/lazy/neogit/lua/neogit/lib/git/sequencer.lua:50: attempt to index local 'HEAD_oid' (a nil value)
stack traceback:
    [C]: in function 'error'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
    ...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:299: in function <...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:264>
...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../share/nvim/lazy/neogit/lua/neogit/lib/git/sequencer.lua:50: attempt to index local 'HEAD_oid' (a nil value)
stack traceback:
    [C]: in function 'error'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
    ...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:299: in function <...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:264> function: builtin#18 ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../share/nvim/lazy/neogit/lua/neogit/lib/git/rev_parse.lua:11: Missing oid
stack traceback:
    [C]: in function 'error'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
    ...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:299: in function <...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:264> function: builtin#18 ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../share/nvim/lazy/neogit/lua/neogit/lib/git/sequencer.lua:50: attempt to index local 'HEAD_oid' (a nil value)
stack traceback:
    [C]: in function 'error'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
    ...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:299: in function <...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:264> function: builtin#18 ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../share/nvim/lazy/neogit/lua/neogit/lib/git/rev_parse.lua:11: Missing oid
stack traceback:
    [C]: in function 'error'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'cb'
    ...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:299: in function <...msa/.local/share/nvim/lazy/neogit/lua/neogit/process.lua:264>
CKolkey commented 3 months ago

If you don't do the cwd flag, i presume it works fine?

azzamsa commented 3 months ago

Yes, it is. But I need to do :cd <path> beforehand.

I believe it is a regression because I have been using Neogit cwd=<path> for almost a year without any issues.

azzamsa commented 3 months ago

My current workaround is to fire Neogit cwd=... repeatedly until it works. But usually, it only took twice.

azzamsa commented 2 months ago

Related: https://github.com/NeogitOrg/neogit/issues/1392

azzamsa commented 2 months ago

Current temporary workaround:

image

azzamsa commented 1 month ago

Fixed in https://github.com/NeogitOrg/neogit/pull/1489 by @Strongleong

I relly depend on cwd argument in my work and this issue drives me nuts

Same here, I switched back to Emacs because of this one issue. I rely heavily on cwd for my workflow. Thank you so much @Strongleong