-
-
Notifications
You must be signed in to change notification settings - Fork 236
Description
Description
When running :Gitsigns change_base <branch_name>
I expect Gitsigns to show the difference between the current file and the version that's on the tip of <branch_name>. However, it seems like Gitsigns is adding a ^
to the end of the revision string, thus causing unexpected diffs. Instead of comparing against, for example, master
, Gitsigns is comparing against master^
Here's the code and the commit that's adding the ^
, everything works as expected if I remove the ^
but I'm not sure if it's there to serve some other purposes.
gitsigns.nvim/lua/gitsigns/manager.lua
Line 479 in 1ef74b5
local staged_rev = git_obj:from_tree() and git_obj.revision .. '^' or 'HEAD' |
47c8e3e
Neovim version
NVIM v0.10.1
Operating system and version
openSUSE Tumbleweed 20240901
Expected behavior
After doing the reproduce steps, no git change line should be shown.
Actual behavior
A git change indicator was shown
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
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
-- ADD GITSIGNS CONFIG THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE
}
-- ADD INIT.LUA SETTINGS THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE
Steps to reproduce
mkdir gitsigns_issue
cd gitsigns_issue
git init
echo 1 > file
git add file
git commit -m 'commit msg'
git switch -c branch
nvim --clean -u minimal.lua file
:Gitsigns change_base master
Gitsigns debug messages
9659.55 D cli.run: Running action 'change_base' with arguments { "master" }
9659.60 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /home/xxx/gitsigns_issue/.git -c core.quotepath=off ls-tree master /home/xxx/gitsigns_issue/file
9661.29 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /home/xxx/gitsigns_issue/.git show d00491fd7e5bb6fa28c517a0bb32b8b506539d4d
9663.12 D run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir /home/xxx/gitsigns_issue/.git show master^:file
Gitsigns cache
No response