Open demian85 opened 10 years ago
I found someone that is willing to help with the implementation of libgit2 methods related to file patching.
Apart from me, is anyone interested in the addition of this kind of functionality to this library?
A nice addition would be a method like add(<file>, <line>)
.
Can anyone provide me with a hint about which libgit2 functions are needed?
Thanks!
Just an update. I found a way to do this without using libgit.
Actually, you can just make a patch with git diff
, edit and remove the parts you do not want and then git apply --cached
It still would be useful to have line staging, since that is really hard to implement and hackis. You need to remove lines and edit hunk headers manually with a magic regexp....
This issue looks quite old at this point, but I've noticed support has still not been added for something like this. I'd be interested in researching and augmenting git-utils
with non-hacky methods for staging and unstaging lines if there's both a desire for it and an expectation that it would be included at some point. I may proof it out soon anyway just to see how feasible it is.
It'd certainly be handy for an Atom package I'm working on that provides a UI-centric version of the same functionality.
Would really appreciate having something like this as well.
+1
was looking for this very thing in Atom, would be nice.
+1
+1
+1
+1
+1
+1
I see that someone have recently implemented the .add method to stage files into the index. For months I've been looking for a way to programatically stage hunks and lines from a file, the same way native git-gui app does it. By any chance, is it more or less easy to implement that functionality into git-utils? My project (https://github.com/demian85/git-watcher) has been in stand by since I noticed almost everyone in my office need that functionality in order to at least try my app!
Thanks for your help.