-
-
Notifications
You must be signed in to change notification settings - Fork 236
Labels
bugSomething isn't workingSomething isn't working
Description
Description
I am trying to hook into the event emitted by gitsigns after staging/unstaging a hunk. I created an autocmd that should trigger on User GitSignsChanged
but it doesn't seem like gitsigns actually fires the autocmd. However I can see events on User GitSignsUpdate
Neovim version
NVIM v0.11.0-dev-6064+ge8a6c1b021-Homebrew Build type: Release LuaJIT 2.1.1734355927 Run "nvim -V1 -v" for more info
Operating system and version
macOS 15.2
Expected behavior
autocmd User GitSignsChanged
is fired, my callback should print something (see config)
Actual behavior
the hunk is staged, but autocmd User GitSignsChanged
is not fired
Minimal config
for name, url in pairs {
gitsigns = 'https://github.com/lewis6991/gitsigns.nvim',
} do
local install_path = vim.fn.fnamemodify('gitsigns_issue/' .. name, ':p')
if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system { 'git', 'clone', '--depth=1', 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
}
vim.api.nvim_create_autocmd('User', {
pattern = 'GitSignsChanged',
callback = function(args)
vim.print(os.time(), ' Gitsigns made a change on ', args)
end,
})
Steps to reproduce
mkdir gitsigns_issue
cd gitsigns_issue
git init
touch file
git add file
echo "foo" > file
nvim --clean -u minimal.lua file
:lua require('gitsigns').stage_hunk()
Gitsigns debug messages
7.13 D run_job: git --version
38.63 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD
68.27 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /Users/disrupted/gitsigns_issue/.git config user.name
97.71 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD
98.45 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /Users/disrupted/gitsigns_issue/.git -c core.quotepath=off ls-files --stage --others --exclude
-standard --eol /Users/disrupted/gitsigns_issue/file
131.40 D watch_gitdir(1): Watching git dir
131.92 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /Users/disrupted/gitsigns_issue/.git show e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
163.70 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /Users/disrupted/gitsigns_issue/.git show HEAD:file
8911.53 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /Users/disrupted/gitsigns_issue/.git apply --whitespace=nowarn --cached --unidiff-zero -
8964.33 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /Users/disrupted/gitsigns_issue/.git show e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
8973.51 D watcher_cb(1): Git dir update: 'index.lock' { rename = true }
8973.52 D watcher_cb(1): Git dir update: 'index' { rename = true }
8973.56 D watcher_cb(1): Git dir update: 'index' { rename = true }
8996.87 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /Users/disrupted/gitsigns_issue/.git show HEAD:file
9174.16 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD
9216.72 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /Users/disrupted/gitsigns_issue/.git -c core.quotepath=off ls-files --stage --others --exclu
de-standard --eol /Users/disrupted/gitsigns_issue/file
9248.45 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /Users/disrupted/gitsigns_issue/.git show 257cc5642cb1a054f08cc83f2d943e56fd3ebe99
9278.83 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /Users/disrupted/gitsigns_issue/.git show HEAD:file
30082.44 D cli.run: Running action 'debug_messages' with arguments {}
Gitsigns cache
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working