lewis6991 / gitsigns.nvim

Git integration for buffers
MIT License
4.91k stars 187 forks source link

Recent worktree regression #1020

Closed kris-swann closed 3 months ago

kris-swann commented 3 months ago

Description

After a recent upgrade, I noticed that gitsigns stopped showing up for my dotfiles (I use a bare gitdir as a worktree for this)

Also, just want to say a quick thanks for all the hard work on this plugin, really appreciate it!

Neovim version

NVIM v0.9.5 Build type: Release LuaJIT 2.1.1692716794

Operating system and version

Ubuntu 22.04.4

Expected behavior

detached worktrees gitsigns are displayed

Actual behavior

detached worktree gitsigns are not displayed

Minimal config

for name, url in pairs({
  gitsigns = 'https://github.com/lewis6991/gitsigns.nvim',
  -- ADD OTHER PLUGINS _NECESSARY_ TO REPRODUCE THE ISSUE
}) do
  local install_path = vim.fn.fnamemodify('gitsigns_issue/' .. name, ':p')
  if vim.fn.isdirectory(install_path) == 0 then
    -- NOTE: had to remove depth=1
    vim.fn.system({ 'git', 'clone', url, install_path })
  end
  vim.opt.runtimepath:append(install_path)
end

require('gitsigns').setup({
  debug_mode = true, -- You must add this to enable debug messages
  -- ADD GITSIGNS CONFIG THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE
  worktrees = {
    {
      -- Gitsigns in dotfiles!
      toplevel = vim.env.HOME,
      gitdir = vim.env.HOME .. '/Projects/dotfiles', -- NOTE: This is a bare .git directory
    },
  },
})

Steps to reproduce

  1. cd gitsigns_issue/gitsigns
  2. git checkout d6a3bf0b36b7e0f09e39f738f9f87ab1e3c450dc
  3. nvim --clean -u minimal.lua my_file_that_has_changes
  4. Gitsigns show up, as expected
  5. git checkout a28bb1db506df663b063cc63f44fbbda178255a7
  6. nvim --clean -u minimal.lua my_file_that_has_changes
  7. Gitsigns do not show up

Gitsigns debug messages

No response

lewis6991 commented 3 months ago

What commands are needed to recreate the dotfiles directory?

kris-swann commented 3 months ago

I use this for mine

Probably don't run that exact rsync command since it'll overwrite your existing config files.

Lmk if I should try to create something easier for minimal testing

orjangj commented 3 months ago

Looks like https://github.com/lewis6991/gitsigns.nvim/commit/a28bb1db506df663b063cc63f44fbbda178255a7 introduced the regression. Worktrees works as expected on commit d6a3bf0b36b7e0f09e39f738f9f87ab1e3c450dc.

lewis6991 commented 3 months ago

Can you test #1034

huibosa commented 3 months ago

Can you test #1034

Tested, it works

adwaymalhotra commented 3 months ago

I can confirm that the issue is fixed at HEAD now. Thanks!