SuperBo / fugit2.nvim

Neovim git GUI powered by libgit2
MIT License
352 stars 7 forks source link

bug: hunk granularity #7

Closed ceuk closed 4 months ago

ceuk commented 4 months ago

Did you check docs and existing issues?

Neovim version (nvim -v)

v0.9.5

Operating system/version

Arch Linux

Describe the bug

I think this might be more of an issue with the upstream libgit2 library maybe but hunk staging doesn't work as I'd expect. e.g. in Lazygit I'm able to stage and unstage individual lines even. Perhaps this isn't representative of a canonical "hunk" in a git sense, but it's a bit restrictive e.g. if I have some staged changes and make some other changes elsewhere in the file, then stage said changes, they become part of the same hunk when it's not clear why

Steps To Reproduce

(un)staging granularity

  1. Create a file with 10 lines of text and commit it
  2. Change 3-4 unrelated lines and attempt to stage one of them
  3. All changes are staged

Hunks unexpectedly merged

  1. Create a file with 10 lines of text and commit it
  2. Change the first line and save the file
  3. Stage the change
  4. Change the last line and save the file
  5. Stage the change
  6. Hunks are merged

Expected Behavior

See above

SuperBo commented 4 months ago

Will take a look, stage and unstage logic is implemented by me because libgit2 doesn't support apply a hunk yet. Literally, this is my bug :D

SuperBo commented 4 months ago

@ceuk, Please enter visual mode (Pressing v) for lines stage/unstage. Hope this solve your problem

ceuk commented 4 months ago

@SuperBo that is so cool. What a great idea! Works a treat

SuperBo commented 4 months ago

@ceuk, I work my ass off for this line stage/unstage feature because Libgit2 doesn't support it natively :)).