Closed ahmadov closed 2 years ago
Partial staging is not yet supported, it is listed as a to-do in the README
This is highly needed, I sometimes find it difficult to stage my changes without playing the silly game of "lets delete that addition, stage the hunk and paste it back in".
How would you solve this in a normal git flow?
I guess you wouldn't, which is why this feature would be really useful.
Right, just trying to get a understanding of how one would implement this. I read in the table that Gitgutter
have this, so I might take a look at how they solved it there.
Neogit also has such functionality. Allows for staging line by line.
Description
Staging the changes in the selected range (lines) does not work as expected. Instead, it stages the whole hunk.
Neovim version
NVIM v0.5.0 (Build type: Release LuaJIT 2.0.5)
Operating system and version
ArchLinux
Steps to reproduce
git init
touch test.txt
git add -am "initial"
echo 'foo\nbar' > test.txt
nvim -nu minimal.lua test.txt
<space>hs
Expected behavior
Stage the changes only in the selected range.
Actual behavior
Do not stage the changes in the selected range but stage the whole hunk.
Gitsigns debug messages
setup_highlight: Deriving GitSignsDelete from DiffDelete
setup_highlight: Highlight GitSignsDelete is already defined setup_highlight: Deriving GitSignsAdd from DiffAdd setup_highlight: Deriving GitSignsChange from DiffChange setup_highlight: Highlight GitSignsChange is already defined run_job: git --no-pager --version attach(1): Attaching (trigger=BufRead) run_job: git --no-pager config user.name run_job: git --no-pager rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD run_job: git --no-pager --git-dir=/tmp/gitsigns/.git ls-files --stage --others --exclude-standard /tmp/gitsigns/test.txt watch_index(1): Watching index run_job: git --no-pager --git-dir=/tmp/gitsigns/.git show :0:test.txt update(1): updates: 1, jobs: 5 run_job: git --no-pager --git-dir=/tmp/gitsigns/.git apply --whitespace=nowarn --cached --unidiff-zero - run_job: git --no-pager --git-dir=/tmp/gitsigns/.git show :0:test.txt update(1): updates: 2, jobs: 7 watcher_cb(1): Index update run_job: git --no-pager rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD run_job: git --no-pager --git-dir=/tmp/gitsigns/.git ls-files --stage --others --exclude-standard /tmp/gitsigns/test.txt run_job: git --no-pager --git-dir=/tmp/gitsigns/.git show :0:test.txt update(1): updates: 3, jobs: 10
Minimal config