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

Partialy staged hunks are not reported as accurately #1088

Closed
ambroisie opened this issue Jul 12, 2024 · 2 comments
Closed

Partialy staged hunks are not reported as accurately #1088

ambroisie opened this issue Jul 12, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ambroisie
Copy link

Description

When partially staging a hunk (e.g: only staging the middle line of a 5-line hunk), the whole hunk's sign changes to the "staged" (dimmer) sign.

The unstaged lines should keep their "unstaged" sign, and the staged one the "staged" sign.

A similar problem that I've noticed is when staging a hunk, then modifying it (e.g: staging a 5-line hunk, then adding a line in the middle).

I remember this not being an issue in a previous version of gitsigns.nvim (haven't tried bisecting it yet).

Neovim version

0.10.0

Operating system and version

NixOS unstable

Expected behavior

No response

Actual behavior

Only the middle line (3) has been staged in the following screenshot:

image

It looks like the whole hunk has been staged.

I would expect to instead have 2 "unstaged" (bright green), one "staged" (dull green), and two "unstaged".

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

  1. git init test
  2. cd test
  3. Emulate partial staging:
    1. echo '3' > test
    2. git add test
    3. printf "1\n2\n3\n4\n5\n" > test
  4. nvim test

Gitsigns debug messages

No response

Gitsigns cache

No response

@ambroisie ambroisie added the bug Something isn't working label Jul 12, 2024
ambroisie added a commit to ambroisie/nix-config that referenced this issue Jul 12, 2024
I thought the partial staging feature had broken, but it looks to be
unrelated [1].

[1]: lewis6991/gitsigns.nvim#1088
ambroisie added a commit to ambroisie/nix-config that referenced this issue Jul 12, 2024
I thought the partial staging feature had broken, but it looks to be
unrelated [1].

[1]: lewis6991/gitsigns.nvim#1088
@gegoune
Copy link
Contributor

gegoune commented Jul 12, 2024

Is it the same as #929?

@ambroisie
Copy link
Author

@gegoune ah yes thank you, I'd tried searching for it but didn't find it. Closing as dupe.

ambroisie added a commit to ambroisie/nix-config that referenced this issue Jul 19, 2024
I thought the partial staging feature had broken, but it looks to be
unrelated [1].

[1]: lewis6991/gitsigns.nvim#1088
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

2 participants