lewis6991 / gitsigns.nvim

Git integration for buffers
MIT License
5.08k stars 193 forks source link

Module `gitsigns.diff_int` #786

Closed axieax closed 1 year ago

axieax commented 1 year ago

Description

Very difficult to reproduce, but occasionally when I start Neovim, I get the following error (which I've had for several months already):

Error executing luv callback:
...cal/share/nvim/lazy/gitsigns.nvim/lua/gitsigns/async.lua:105: The coroutine failed with this message: ...ocal/share/nvim/l
azy/gitsigns.nvim/lua/gitsigns/diff.lua:8: module 'gitsigns.diff_int' not found:
        no field package.preload['gitsigns.diff_int']e/luajit-2.1.0-beta3/gitsigns/diff_int.lua'
cache_loader: module gitsigns.diff_int not found
cache_loader_lib: module gitsigns.diff_int not found
        no file './gitsigns/diff_int.lua'
        no file '/home/axie/dev/neovim/.deps/usr/share/luajit-2.1.0-beta3/gitsigns/diff_int.lua'
        no file '/usr/local/share/lua/5.1/gitsigns/diff_int.lua'
        no file '/usr/local/share/lua/5.1/gitsigns/diff_int/init.lua'
        no file '/home/axie/dev/neovim/.deps/usr/share/lua/5.1/gitsigns/diff_int.lua'
        no file '/home/axie/dev/neovim/.deps/usr/share/lua/5.1/gitsigns/diff_int/init.lua'
        no file './gitsigns/diff_int.so'
        no file '/usr/local/lib/lua/5.1/gitsigns/diff_int.so'
        no file '/home/axie/dev/neovim/.deps/usr/lib/lua/5.1/gitsigns/diff_int.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
        no file './gitsigns.so'
        no file '/usr/local/lib/lua/5.1/gitsigns.so'
        no file '/home/axie/dev/neovim/.deps/usr/lib/lua/5.1/gitsigns.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
        [C]: in function 'require'
        ...ocal/share/nvim/lazy/gitsigns.nvim/lua/gitsigns/diff.lua:8: in function 'run_diff'
        ...l/share/nvim/lazy/gitsigns.nvim/lua/gitsigns/manager.lua:304: in function 'fn'
        .../share/nvim/lazy/gitsigns.nvim/lua/gitsigns/debounce.lua:76: in function 'update'
        ...al/share/nvim/lazy/gitsigns.nvim/lua/gitsigns/attach.lua:342: in function 'fn'
        .../share/nvim/lazy/gitsigns.nvim/lua/gitsigns/debounce.lua:76: in function 'attach_throttled'
        ...al/share/nvim/lazy/gitsigns.nvim/lua/gitsigns/attach.lua:408: in function 'attach'
        ...ie/.local/share/nvim/lazy/gitsigns.nvim/lua/gitsigns.lua:132: in function 'setup_attach'
        ...ie/.local/share/nvim/lazy/gitsigns.nvim/lua/gitsigns.lua:191: in function <...ie/.local/share/nvim/lazy/gitsigns.n
vim/lua/gitsigns.lua:167>
stack traceback:
        [C]: in function 'error'
        ...cal/share/nvim/lazy/gitsigns.nvim/lua/gitsigns/async.lua:105: in function 'cb'
        ...cal/share/nvim/lazy/gitsigns.nvim/lua/gitsigns/async.lua:140: in function 'callback'
        ...hare/nvim/lazy/gitsigns.nvim/lua/gitsigns/subprocess.lua:93: in function <...hare/nvim/lazy/gitsigns.nvim/lua/gits
igns/subprocess.lua:83>
        [C]: in function 'nvim_get_runtime_file'
        vim/loader.lua: in function 'get_rtp'
        vim/loader.lua: in function 'find'
        vim/loader.lua: in function <vim/loader.lua:0>
        [C]: in function 'require'
        /home/axie/.config/nvim/lua/axie/plugins/lsp/aerial.lua:9: in function 'config'
        ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:323: in function <...local/share/nvim/lazy/lazy.nvim/lua/
lazy/core/loader.lua:321>
        ...
        ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:306: in function '_load'
        ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:180: in function 'load'
        ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:467: in function 'auto_load'
        ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:482: in function <...local/share/nvim/lazy/lazy.nvim/lua/
lazy/core/loader.lua:478>
        [C]: at 0x55ba053f41e0
        [C]: in function 'pcall'
        /home/axie/.config/nvim/lua/axie/winbar.lua:90: in function 'context'
        /home/axie/.config/nvim/lua/axie/winbar.lua:143: in function </home/axie/.config/nvim/lua/axie/winbar.lua:136>
        [C]: in function 'pcall'
        /home/axie/.config/nvim/lua/axie/winbar.lua:136: in function </home/axie/.config/nvim/lua/axie/winbar.lua:131>

Here's a video showing how this issue only pops up sometimes:

https://user-images.githubusercontent.com/62098008/234017791-8b39de56-94ce-4eb8-9e26-a9561360d401.mp4

I'm not sure which plugin is causing this to happen, and it doesn't seem very clear from the error either. Could be related to https://github.com/LunarVim/LunarVim/issues/2490 but not too sure.

Neovim version

NVIM v0.10.0-dev-57+gb85ac8932

Operating system and version

Arch Linux

NOTE: this issue occurs on MacOS as well

Expected behavior

No error

Actual behavior

The error above appears

Minimal config

Full dotfiles in https://github.com/axieax/dotconfig/tree/main/nvim

gitsigns.nvim loaded with "VeryLazy"

Relevant [winbar.lua] config loaded at the end of init.lua:
https://github.com/axieax/dotconfig/blob/eb2aec0d58f7ab882103ad3f3e68dce4ee3f9f93/nvim/lua/axie/winbar.lua

Relevant [aerial.lua] config loaded by [winbar.lua]
https://github.com/axieax/dotconfig/blob/eb2aec0d58f7ab882103ad3f3e68dce4ee3f9f93/nvim/lua/axie/plugins/lsp/aerial.lua

Steps to reproduce

  1. nvim
  2. Open a file
  3. Sometimes it produces the error, most often not

Gitsigns debug messages

The following logs were produced when the error occurred

signs.init: Using vimfn signs
dprintf: Highlight GitSignsAdd is already defined
dprintf: Highlight GitSignsChange is already defined
dprintf: Highlight GitSignsDelete is already defined
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: Highlight GitSignsAddPreview is already defined
dprintf: Highlight GitSignsDeletePreview is already defined
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
attach(1): Attaching (trigger=setup)
run_job: git --version
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 --git-dir /home/axie/dotconfig/.git -c core.quotepath=off ls-files --stage --others --exclude-standard --eol /home/axie/do
tconfig/nvim/lua/axie/plugins/editor/init.lua
watch_gitdir(1): Watching git dir
run_job: git --no-pager --literal-pathspecs -c gc.auto=0 --git-dir /home/axie/dotconfig/.git show :0:nvim/lua/axie/plugins/editor/init.lua
cli.run: Running action 'debug_messages' with arguments {}
cli.run: Running action 'debug_messages' with arguments {}
cli.run: Running action 'dump_cache' with arguments {}
cli.run: Running action 'debug_messages' with arguments {}
{ {
    compare_text = { "...",
      head = "local spec = {",
      length = 171
    },
    file = "/home/axie/dotconfig/nvim/lua/axie/plugins/editor/init.lua",
    git_obj = {
      encoding = "utf-8",
      file = "/home/axie/dotconfig/nvim/lua/axie/plugins/editor/init.lua",
      i_crlf = false,
      mode_bits = "100644",
      object_name = "747c32f3c6c212b68c4019af85d2b7130b4c152d",
      relpath = "nvim/lua/axie/plugins/editor/init.lua",
      repo = {
        abbrev_head = "main",
        detached = false,
        gitdir = "/home/axie/dotconfig/.git",
        toplevel = "/home/axie/dotconfig",
        username = "Andrew"
      },
      w_crlf = false
    },
    gitdir_watcher = <userdata 1>,
    staged_diffs = {}
  } }
{ {
    compare_text = { "local spec = {", "  -- ALT: https://github.com/zbirenbaum/copilot.lua with https://github.com/zbirenbaum/copilot-cmp", '  { "github/copilot.vim", event = "In
sertEnter", settings = "copilot" },', "  {", '    "jackMort/ChatGPT.nvim",', '    cmd = { "ChatGPT", "ChatGPTActAs", "ChatGPTEditWithInstructions" },', "    keys = {", '      { "<
Space>rc", "<Cmd>ChatGPT<CR>", desc = "ChatGPT" },', "      {", '        "<Space>rC",', '        "<Cmd>ChatGPTEditWithInstructions<CR>",', '        desc = "ChatGPTEditWithInstruct
ions",', '        mode = { "n", "v" },', "      },", '      { "<Space>rk", "<Cmd>ChatGPTActAs<CR>", desc = "ChatGPTActAs" },', "    },", '    opts = { popup_input = { submit = "<C
-s>" } },', "  },", '  { "folke/todo-comments.nvim", event = "VeryLazy", settings = "todo" },', "", "  {", "    -- TODO: automatically install parsers for new file types (don't do
wnload all)", '    "nvim-treesitter/nvim-treesitter",', '    build = ":TSUpdate",', '    event = "BufReadPost",', '    settings = "treesitter",', "  },", '  { "nvim-treesitter/nvi
m-treesitter-textobjects", event = "BufReadPost" },', "  -- TODO: use fork https://github.com/HiPhish/nvim-ts-rainbow2 instead?", '  { "p00f/nvim-ts-rainbow", event = "BufReadPost
" },', '  { "lukas-reineke/indent-blankline.nvim", event = "BufReadPost", settings = "indentline" },', '  { "code-biscuits/nvim-biscuits", event = "BufReadPost", settings = "biscu
its" },', '  { "zbirenbaum/neodim", branch = "v2", event = "LspAttach", config = true },', "  {", '    "danymat/neogen",', '    cmd = "Neogen",', '    keys = { { "<Space>/", "<Cmd
>Neogen<CR>", desc = "Generate docstring" } },', '    opts = { snippet_engine = "luasnip" },', "  },", "  {", '    "numToStr/Comment.nvim",', "    -- language-aware commentstring"
, '    dependencies = "JoosepAlviste/nvim-ts-context-commentstring",', '    settings = "comment",', "  },", '  { "tpope/vim-surround", event = "VeryLazy" },', "  {", '    "andymas
s/vim-matchup",', '    event = "BufReadPost",', "    config = function()", '      vim.g.matchup_matchparen_offscreen = { method = "status_manual" }', '      vim.cmd.highlight("Mat
chParen", "guibg=NONE")', "    end,", "  },", '  { "windwp/nvim-autopairs", event = "InsertEnter", settings = "autopairs" },', "  {", '    "windwp/nvim-ts-autotag",', "    ft = {"
, '      "html",', '      "javascript",', '      "typescript",', '      "javascriptreact",', '      "typescriptreact",', '      "svelte",', '      "vue",', '      "tsx",', '
"jsx",', '      "rescript",', '      "xml",', '      "php",', '      "markdown",', '      "glimmer",', '      "handlebars",', '      "hbs",', "    },", "    config = true,", "  },
", "  -- NOTE: requires treesitter regex", '  { "bennypowers/nvim-regexplainer", build = ":TSUpdate regex", settings = "regexplainer" },', '  { "nacro90/numb.nvim", event = "Cmdli
neEnter", opts = { number_only = true } },', "", "  -- IDE tools", "  {", '    "mfussenegger/nvim-dap",', "    dependencies = {", '      { "rcarriga/nvim-dap-ui", settings = "plug
ins.editor.debug.dapui" },', '      { "theHamsta/nvim-dap-virtual-text", config = true },', "    },", '    settings = "plugins.editor.debug.dap",', "  },", '  { "nvim-telescope/te
lescope-dap.nvim", settings = "plugins.editor.debug.dap_telescope" },', "  {", '    "mfussenegger/nvim-dap-python",', '    ft = "python",', "    config = function()", "      -- SE
TUP: pip install debugpy", '      local dap_python = require("dap-python")', "      dap_python.setup()", '      dap_python.test_runner = "pytest"', "    end,", "  },", "  {", '
 "jbyuki/one-small-step-for-vimkind",', '    ft = "lua",', "    config = function()", '      local dap = require("dap")', "      dap.configurations.lua = {", "        {", '
   type = "nlua",', '          request = "attach",', '          name = "Attach to running Neovim instance",', "        },", "      }", "", "      dap.adapters.nlua = function(call
back, config)", '        callback({ type = "server", host = config.host or "127.0.0.1", port = config.port or 8086 })', "      end", "    end,", "  },", "", "  {", '    "nvim-neot
est/neotest",', "    dependencies = {", '      "nvim-lua/plenary.nvim",', '      "nvim-neotest/neotest-go",', '      "haydenmeade/neotest-jest",', '      "nvim-neotest/neotest-pyt
hon",', '      "nvim-neotest/neotest-plenary",', '      -- "mrcjkb/neotest-haskell",', '      { "nvim-neotest/neotest-vim-test", dependencies = "vim-test/vim-test" },', "    },",
'    settings = "test",', "  },", "", "  -- Python indenting issues", "  -- https://github.com/nvim-treesitter/nvim-treesitter/issues/1136", '  { "Vimjas/vim-python-pep8-indent",
ft = "python" },', '  { "vuki656/package-info.nvim", ft = "json", settings = "package" },', "  {", "    -- NOTE: requires xclip (X11), wl-clipboard (Wayland) or pngpaste (MacOS)",
 '    "ekickx/clipboard-image.nvim",', '    ft = { "markdown", "latex", "plaintex", "tex", "org" },', '    settings = "pasteimage",', "  },", "  {", '    "iamcco/markdown-preview.
nvim",', '    ft = "markdown",', "    build = function()", '      vim.fn["mkdp#util#install"]()', "    end,", '    keys = { { ",O", "<Cmd>MarkdownPreview<CR>" } },', "  },", "  {"
, '    "ellisonleao/glow.nvim",', '    ft = "markdown",', '    keys = { { ",o", "<Cmd>Glow<CR>" } },', "    opts = {", '      border = "rounded",', "      pager = false,", "    },
", "  },", "  {", "    -- NOTE: <C-t> (tab) to indent after auto continue, <C-d> (dedent) to unindent", '    "gaoDean/autolist.nvim",', '    ft = { "markdown", "txt", "tex", "plai
ntex" },', '    dependencies = { "hrsh7th/nvim-cmp", "windwp/nvim-autopairs" },', '    settings = "autolist",', "  },", "}", "", 'return require("axie.lazy").transform_spec(spec,
"editor")' },
    file = "/home/axie/dotconfig/nvim/lua/axie/plugins/editor/init.lua",
    git_obj = {
      encoding = "utf-8",
      file = "/home/axie/dotconfig/nvim/lua/axie/plugins/editor/init.lua",
      i_crlf = false,
      mode_bits = "100644",
      object_name = "747c32f3c6c212b68c4019af85d2b7130b4c152d",
      relpath = "nvim/lua/axie/plugins/editor/init.lua",
      repo = {
        abbrev_head = "main",
        detached = false,
        gitdir = "/home/axie/dotconfig/.git",
        toplevel = "/home/axie/dotconfig",
        username = "Andrew",
        <metatable> = {
          __index = {
            command = <function 1>,
            files_changed = <function 2>,
            get_show_text = <function 3>,
            new = <function 4>,
            update_abbrev_head = <function 5>
          }
        }
      },
      w_crlf = false,
      <metatable> = {
        __index = {
          command = <function 6>,
          file_info = <function 7>,
          get_show_text = <function 8>,
          has_moved = <function 9>,
          new = <function 10>,
          run_blame = <function 11>,
          stage_hunks = <function 12>,
          stage_lines = <function 13>,
          unstage_file = <function 14>,
          update_file_info = <function 15>
        }
      }
    },
    gitdir_watcher = <userdata 1>,
    staged_diffs = {},
    <metatable> = {
      __index = {
        destroy = <function 16>,
        get_compare_rev = <function 17>,
        get_rev_bufname = <function 18>,
        get_staged_compare_rev = <function 19>,
        invalidate = <function 20>,
        new = <function 21>
      }
    }
  },
  <metatable> = {
    __index = {
      destroy = <function 22>
    }
  }
lewis6991 commented 1 year ago

Do not lazy load gitsigns