Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signs Not Updating for Non-Loaded Buffers #1122

Open
joeyagreco opened this issue Sep 19, 2024 · 3 comments
Open

Signs Not Updating for Non-Loaded Buffers #1122

joeyagreco opened this issue Sep 19, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@joeyagreco
Copy link

joeyagreco commented Sep 19, 2024

Description

Any buffers that are not shown in Neovim will not update their git signs upon a commit.

If a buffer is shown during a commit, the signs "disappear" as expected on commit.

In this brief example, I make a change to foo.txt and navigate to bar.txt.
I then commit the changes and navigate back to foo.txt to see the signs still by my changes.
A restart of Neovim removes the signs.

git.signs.example.1.mov

Neovim version

NVIM v0.10.1 Build type: Release LuaJIT 2.1.1720049189

Operating system and version

MacOS Sonoma 14.6.1

Expected behavior

All git signs for all buffers (shown or not) are cleared on a commit.

Actual behavior

All git signs in buffers that are not shown are not cleared on a commit.

Minimal config

Using Lazy, here is my `git_signs.lua` file

I also keep my full config here: https://github.com/joeyagreco/terminal


return {
    "lewis6991/gitsigns.nvim",
    opts = {},
}

Steps to reproduce

  1. Make change to 1 file
  2. Navigate away from the file with changes (i.e. change to a file that has no changes)
  3. Commit change
  4. Git signs are NOT updated on the 1 file

  1. Make change to 1 file
  2. Stay on the file with changes (i.e. do NOT change to a file that has no changes)
  3. Commit change
  4. Git signs ARE updated on the 1 file

  1. Make change to 2+ files (file A and file B)
  2. Navigate to file A
  3. Commit change
  4. Git signs are NOT updated on file B

  1. Make change to 2+ files (file A and file B)
  2. Navigate to file B
  3. Commit change
  4. Git signs are NOT updated on file A

Gitsigns debug messages

[0.267] function: 0x0102cb0068: Deriving GitSignsAdd from Added
[0.376] function: 0x0102cb0068: Deriving GitSignsChange from Changed
[0.471] function: 0x0102cb0068: Deriving GitSignsDelete from Removed
[0.515] function: 0x0102cb0068: Deriving GitSignsChangedelete from GitSignsChange
[0.568] function: 0x0102cb0068: Deriving GitSignsTopdelete from GitSignsDelete
[0.595] function: 0x0102cb0068: Deriving GitSignsUntracked from GitSignsAdd
[0.652] function: 0x0102cb0068: Deriving GitSignsAddNr from GitSignsAdd
[0.703] function: 0x0102cb0068: Deriving GitSignsChangeNr from GitSignsChange
[0.760] function: 0x0102cb0068: Deriving GitSignsDeleteNr from GitSignsDelete
[0.793] function: 0x0102cb0068: Deriving GitSignsChangedeleteNr from GitSignsChangeNr
[0.820] function: 0x0102cb0068: Deriving GitSignsTopdeleteNr from GitSignsDeleteNr
[0.851] function: 0x0102cb0068: Deriving GitSignsUntrackedNr from GitSignsAddNr
[0.924] function: 0x0102cb0068: Deriving GitSignsAddLn from DiffAdd
[1.002] function: 0x0102cb0068: Deriving GitSignsChangeLn from DiffChange
[1.029] function: 0x0102cb0068: Deriving GitSignsChangedeleteLn from GitSignsChangeLn
[1.056] function: 0x0102cb0068: Deriving GitSignsUntrackedLn from GitSignsAddLn
[1.082] function: 0x0102cb0068: Deriving GitSignsStagedAdd from GitSignsAdd
[1.110] function: 0x0102cb0068: Deriving GitSignsStagedChange from GitSignsChange
[1.137] function: 0x0102cb0068: Deriving GitSignsStagedDelete from GitSignsDelete
[1.164] function: 0x0102cb0068: Deriving GitSignsStagedChangedelete from GitSignsChangedelete
[1.201] function: 0x0102cb0068: Deriving GitSignsStagedTopdelete from GitSignsTopdelete
[1.232] function: 0x0102cb0068: Deriving GitSignsStagedAddNr from GitSignsAddNr
[1.259] function: 0x0102cb0068: Deriving GitSignsStagedChangeNr from GitSignsChangeNr
[1.292] function: 0x0102cb0068: Deriving GitSignsStagedDeleteNr from GitSignsDeleteNr
[1.319] function: 0x0102cb0068: Deriving GitSignsStagedChangedeleteNr from GitSignsChangedeleteNr
[1.345] function: 0x0102cb0068: Deriving GitSignsStagedTopdeleteNr from GitSignsTopdeleteNr
[1.371] function: 0x0102cb0068: Deriving GitSignsStagedAddLn from GitSignsAddLn
[1.398] function: 0x0102cb0068: Deriving GitSignsStagedChangeLn from GitSignsChangeLn
[1.447] function: 0x0102cb0068: Could not derive GitSignsStagedDeleteLn
[1.473] function: 0x0102cb0068: Deriving GitSignsStagedChangedeleteLn from GitSignsChangedeleteLn
[1.522] function: 0x0102cb0068: Could not derive GitSignsStagedTopdeleteLn
[1.597] function: 0x0102cb0068: Deriving GitSignsAddPreview from DiffAdd
[1.668] function: 0x0102cb0068: Deriving GitSignsDeletePreview from DiffDelete
[1.701] function: 0x0102cb0068: Deriving GitSignsCurrentLineBlame from NonText
[1.728] function: 0x0102cb0068: Deriving GitSignsAddInline from TermCursor
[1.754] function: 0x0102cb0068: Deriving GitSignsDeleteInline from TermCursor
[1.780] function: 0x0102cb0068: Deriving GitSignsChangeInline from TermCursor
[1.806] function: 0x0102cb0068: Deriving GitSignsAddLnInline from GitSignsAddInline
[1.833] function: 0x0102cb0068: Deriving GitSignsChangeLnInline from GitSignsChangeInline
[1.859] function: 0x0102cb0068: Deriving GitSignsDeleteLnInline from GitSignsDeleteInline
[1.930] function: 0x0102cb0068: Deriving GitSignsDeleteVirtLn from DiffDelete
[1.956] function: 0x0102cb0068: Deriving GitSignsDeleteVirtLnInLine from GitSignsDeleteLnInline
[1.983] function: 0x0102cb0068: Deriving GitSignsVirtLnum from GitSignsDeleteVirtLn
[7.075] function: 0x0102cb0068: Highlight GitSignsAdd is already defined
[7.079] function: 0x0102cb0068: Highlight GitSignsChange is already defined
[7.081] function: 0x0102cb0068: Highlight GitSignsDelete is already defined
[7.086] function: 0x0102cb0068: Highlight GitSignsChangedelete is already defined
[7.088] function: 0x0102cb0068: Highlight GitSignsTopdelete is already defined
[7.091] function: 0x0102cb0068: Highlight GitSignsUntracked is already defined
[7.094] function: 0x0102cb0068: Highlight GitSignsAddNr is already defined
[7.097] function: 0x0102cb0068: Highlight GitSignsChangeNr is already defined
[7.100] function: 0x0102cb0068: Highlight GitSignsDeleteNr is already defined
[7.104] function: 0x0102cb0068: Highlight GitSignsChangedeleteNr is already defined
[7.107] function: 0x0102cb0068: Highlight GitSignsTopdeleteNr is already defined
[7.110] function: 0x0102cb0068: Highlight GitSignsUntrackedNr is already defined
[7.137] function: 0x0102cb0068: Highlight GitSignsAddLn is already defined
[7.141] function: 0x0102cb0068: Highlight GitSignsChangeLn is already defined
[7.144] function: 0x0102cb0068: Highlight GitSignsChangedeleteLn is already defined
[7.147] function: 0x0102cb0068: Highlight GitSignsUntrackedLn is already defined
[7.150] function: 0x0102cb0068: Highlight GitSignsStagedAdd is already defined
[7.177] function: 0x0102cb0068: Highlight GitSignsStagedChange is already defined
[7.180] function: 0x0102cb0068: Highlight GitSignsStagedDelete is already defined
[7.183] function: 0x0102cb0068: Highlight GitSignsStagedChangedelete is already defined

[7.186] function: 0x0102cb0068: Highlight GitSignsStagedTopdelete is already defined
[7.192] function: 0x0102cb0068: Highlight GitSignsStagedAddNr is already defined
[7.196] function: 0x0102cb0068: Highlight GitSignsStagedChangeNr is already defined
[7.199] function: 0x0102cb0068: Highlight GitSignsStagedDeleteNr is already defined
[7.202] function: 0x0102cb0068: Highlight GitSignsStagedChangedeleteNr is already defined
[7.205] function: 0x0102cb0068: Highlight GitSignsStagedTopdeleteNr is already defined
[7.209] function: 0x0102cb0068: Highlight GitSignsStagedAddLn is already defined
[7.212] function: 0x0102cb0068: Highlight GitSignsStagedChangeLn is already defined
[7.261] function: 0x0102cb0068: Could not derive GitSignsStagedDeleteLn
[7.264] function: 0x0102cb0068: Highlight GitSignsStagedChangedeleteLn is already defined
[7.311] function: 0x0102cb0068: Could not derive GitSignsStagedTopdeleteLn
[7.315] function: 0x0102cb0068: Highlight GitSignsAddPreview is already defined
[7.319] function: 0x0102cb0068: Highlight GitSignsDeletePreview is already defined
[7.322] function: 0x0102cb0068: Highlight GitSignsCurrentLineBlame is already defined
[7.325] function: 0x0102cb0068: Highlight GitSignsAddInline is already defined
[7.328] function: 0x0102cb0068: Highlight GitSignsDeleteInline is already defined
[7.331] function: 0x0102cb0068: Highlight GitSignsChangeInline is already defined
[7.334] function: 0x0102cb0068: Highlight GitSignsAddLnInline is already defined
[7.338] function: 0x0102cb0068: Highlight GitSignsChangeLnInline is already defined
[7.341] function: 0x0102cb0068: Highlight GitSignsDeleteLnInline is already defined
[7.344] function: 0x0102cb0068: Highlight GitSignsDeleteVirtLn is already defined
[7.347] function: 0x0102cb0068: Highlight GitSignsDeleteVirtLnInLine is already defined
[7.350] function: 0x0102cb0068: Highlight GitSignsVirtLnum is already defined
[34.983] run_job: git --version
[38.105] run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD
[4195.402] function: 0x0102cb0068(2): Detached
[4195.423] function: 0x0102cb0068(2): Cache was nil
[4195.997] attach(2): Attaching (trigger=BufFilePost)
[4196.083] run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 config user.name
[4207.691] run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD
[4211.697] run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /Users/joeyagreco/Code/mee/.git -c core.quotepath=off ls-files --stage --others --exclude-standard --eol /Users/joeyag
reco/Code/mee/NvimTree_1
[4216.469] attach(2): Not a file
[6149.689] attach(1): Attaching (trigger=BufReadPost)
[6149.967] run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 config user.name
[6159.980] run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD
[6166.037] run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /Users/joeyagreco/Code/mee/.git -c core.quotepath=off ls-files --stage --others --exclude-standard --eol /Users/joeyag
reco/Code/mee/foo.txt
[6171.257] function: 0x0102cb0068(1): Watching git dir
[6171.366] run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /Users/joeyagreco/Code/mee/.git show cb97d8b181f8818f6c522d4be001101750e3db3b
[8501.002] attach(1): Already attached
[10850.596] attach(3): Attaching (trigger=BufReadPost)
[10850.877] run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 config user.name
[10858.231] run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD
[10863.285] run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /Users/joeyagreco/Code/mee/.git -c core.quotepath=off ls-files --stage --others --exclude-standard --eol /Users/joeya
greco/Code/mee/baz.txt
[10868.486] function: 0x0102cb0068(3): Watching git dir

[10868.650] run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /Users/joeyagreco/Code/mee/.git show a5376b9c4786c1048bd373678e85646f5b88b7d2
[12570.470] watcher_cb(1): Git dir update: 'index.lock' { rename = true } (ignoring)
[12570.491] watcher_cb(1): Git dir update: 'index' { rename = true }
[12570.512] watcher_cb(1): Git dir update: 'index' { rename = true }
[12570.526] watcher_cb(3): Git dir update: 'index.lock' { rename = true } (ignoring)
[12570.621] watcher_cb(3): Git dir update: 'index' { rename = true }
[12570.664] watcher_cb(3): Git dir update: 'index' { rename = true }
[12771.281] run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD
[12780.441] run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /Users/joeyagreco/Code/mee/.git -c core.quotepath=off ls-files --stage --others --exclude-standard --eol /Users/joeya
greco/Code/mee/baz.txt
[12787.131] run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /Users/joeyagreco/Code/mee/.git show a5376b9c4786c1048bd373678e85646f5b88b7d2
[13616.458] watcher_cb(1): Git dir update: 'index.lock' { rename = true } (ignoring)
[13616.558] watcher_cb(1): Git dir update: 'index' { rename = true }
[13616.622] watcher_cb(1): Git dir update: 'index' { rename = true }
[13616.659] watcher_cb(1): Git dir update: 'COMMIT_EDITMSG' { change = true }
[13616.677] watcher_cb(3): Git dir update: 'index.lock' { rename = true } (ignoring)
[13616.712] watcher_cb(3): Git dir update: 'index' { rename = true }
[13616.831] watcher_cb(3): Git dir update: 'index' { rename = true }
[13616.841] watcher_cb(3): Git dir update: 'COMMIT_EDITMSG' { change = true }
[13667.169] watcher_cb(1): Git dir update: '.COMMIT_EDITMSG.swpx' { rename = true }
[13667.191] watcher_cb(1): Git dir update: '.COMMIT_EDITMSG.swp' { rename = true }
[13667.200] watcher_cb(1): Git dir update: '.COMMIT_EDITMSG.swp' { rename = true }
[13667.209] watcher_cb(3): Git dir update: '.COMMIT_EDITMSG.swpx' { rename = true }
[13667.222] watcher_cb(3): Git dir update: '.COMMIT_EDITMSG.swp' { rename = true }
[13667.289] watcher_cb(3): Git dir update: '.COMMIT_EDITMSG.swp' { rename = true }
[13868.389] run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD
[13874.127] run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /Users/joeyagreco/Code/mee/.git -c core.quotepath=off ls-files --stage --others --exclude-standard --eol /Users/joeya
greco/Code/mee/baz.txt
[13878.862] run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /Users/joeyagreco/Code/mee/.git show a5376b9c4786c1048bd373678e85646f5b88b7d2
[15883.851] watcher_cb(1): Git dir update: '4913' { rename = true }
[15883.974] watcher_cb(1): Git dir update: 'COMMIT_EDITMSG' { rename = true }
[15884.039] watcher_cb(1): Git dir update: 'COMMIT_EDITMSG' { rename = true }
[15884.180] watcher_cb(1): Git dir update: 'COMMIT_EDITMSG~' { rename = true }
[15884.228] watcher_cb(3): Git dir update: '4913' { rename = true }
[15884.271] watcher_cb(3): Git dir update: 'COMMIT_EDITMSG' { rename = true }
[15884.316] watcher_cb(3): Git dir update: 'COMMIT_EDITMSG' { rename = true }
[15884.401] watcher_cb(3): Git dir update: 'COMMIT_EDITMSG~' { rename = true }

[15933.399] watcher_cb(1): Git dir update: '.COMMIT_EDITMSG.swp' { rename = true }
[15933.628] watcher_cb(1): Git dir update: 'HEAD.lock' { rename = true } (ignoring)
[15933.729] watcher_cb(1): Git dir update: 'AUTO_MERGE.lock' { rename = true } (ignoring)
[15933.775] watcher_cb(1): Git dir update: 'packed-refs.lock' { rename = true } (ignoring)
[15933.818] watcher_cb(3): Git dir update: '.COMMIT_EDITMSG.swp' { rename = true }
[15933.964] watcher_cb(3): Git dir update: 'HEAD.lock' { rename = true } (ignoring)
[15934.000] watcher_cb(3): Git dir update: 'AUTO_MERGE.lock' { rename = true } (ignoring)
[15934.041] watcher_cb(3): Git dir update: 'packed-refs.lock' { rename = true } (ignoring)
[16134.158] run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD
[16147.286] run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /Users/joeyagreco/Code/mee/.git -c core.quotepath=off ls-files --stage --others --exclude-standard --eol /Users/joeya
greco/Code/mee/baz.txt
[16156.254] run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /Users/joeyagreco/Code/mee/.git show a5376b9c4786c1048bd373678e85646f5b88b7d2
[22598.455] cli.run: Running action 'debug_messages' with arguments {}

Gitsigns cache

:Gitsigns dump_cache
{ {
    bufnr = 1,
    compare_text = { "...",
      head = "this ",
      length = 36
    },
    file = "/Users/joeyagreco/Code/mee/foo.txt",
    force_next_update = false,
    git_obj = {
      encoding = "utf-8",
      file = "/Users/joeyagreco/Code/mee/foo.txt",
      i_crlf = false,
      mode_bits = "100644",
      object_name = "cb97d8b181f8818f6c522d4be001101750e3db3b",
      relpath = "foo.txt",
      repo = {
        abbrev_head = "main",
        detached = false,
        gitdir = "/Users/joeyagreco/Code/mee/.git",
        toplevel = "/Users/joeyagreco/Code/mee",
        username = "joeyagreco"
      },
      w_crlf = false
    },
    gitdir_watcher = <userdata 1>,
    hunks = { "...",
      head = {
        added = {
          count = 2,
          lines = { "", "foo" },
          start = 36
        },
        head = "@@ -35 +36,2 @@",
        removed = {
          count = 0,
          lines = {},
          start = 35
        },
        type = "add",
        vend = 37
      },
      length = 1
    },
    staged_diffs = { "...",
      length = 0
    }
  },
 [3] = {
    bufnr = 3,
    compare_text = { "...",
      head = "foo",
      length = 18
    },
    file = "/Users/joeyagreco/Code/mee/baz.txt",
    force_next_update = false,
    git_obj = {
      encoding = "utf-8",
      file = "/Users/joeyagreco/Code/mee/baz.txt",
      i_crlf = false,
      mode_bits = "100644",
      object_name = "a5376b9c4786c1048bd373678e85646f5b88b7d2",
      relpath = "baz.txt",
      repo = {
        abbrev_head = "main",
        detached = false,
        gitdir = "/Users/joeyagreco/Code/mee/.git",
        toplevel = "/Users/joeyagreco/Code/mee",
        username = "joeyagreco"
      },
      w_crlf = false
    },
    gitdir_watcher = <userdata 2>,
    hunks = { "...",
      length = 0
    },
    staged_diffs = { "...",
      length = 0
    }
  }
}
@joeyagreco joeyagreco added the bug Something isn't working label Sep 19, 2024
@Xoffio
Copy link

Xoffio commented Sep 22, 2024

Experiencing the same issue. I make changes to the code, the left signs color show up correctly, then I commit and push, but the color don't refresh. I would have to close nvim and reopen it.

Here are some information about my gitsigns. I am using astronvim.
url https://github.com/lewis6991/gitsigns.nvim
version 0.9.0
tag v0.9.0
branch main
commit 0b04035

@willparsons
Copy link

:e seems to refresh it so you don't have to re-open nvim

@eugene-babichenko
Copy link

This happens to me specifically when I do a commit with neogit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants