git2-rs icon indicating copy to clipboard operation
git2-rs copied to clipboard

Stage/apply lines

Open valerauko opened this issue 5 years ago • 3 comments

It's an useful feature in git (gui) clients to be able to select individual lines to stage and commit, not just hunks or files. I saw that nodegit implemented it a good while back. Can git2-rs have a feature like that too?

nodegit seems to be replacing the selected lines in the affected blob and then calculating a new diff based on that.

If it's not against some design principle of git2-rs, I'd be happy to implement it too with some design guidance.

valerauko avatar Jul 11 '20 12:07 valerauko

git2-rs is just a wrapper around libgit2 - this would be the appropriate place to add this. that being said I would love to see libgit2 support this feature👍

extrawurst avatar Jul 11 '20 13:07 extrawurst

Thanks for the quick response. I opened a feature request with libgit2 too. In the meanwhile I'll go on and do it in rust for my project as I can't help writing it in C...

valerauko avatar Jul 11 '20 13:07 valerauko

if anyone needs an inspiration on how to do this, I implemented it now in extrawurst/gitui#571

it is based off of nodegits implementation

extrawurst avatar Mar 09 '21 08:03 extrawurst