Description
Originally requested on the Git mailing list, in a reply Jeff King sketched how this would have been implemented in the Perl version of git add -p
.
In the meantime, git add -p
is a built-in, therefore it will be slightly more involved.
In particular, while the Perl variant seems to have staged changes immediately, the pure C version reassembles a single patch per file and applies that. The Perl variant is no more, therefore the C version would need to be patched. And there, that the paradigm would have to be extended so that an optional "reassemble-and-stash" or "reassemble-and-discard" step would precede that "reassemble-and-stage" phase.
Not the easiest project, but probably Outreachy/Google Summer of Code-sized.
I have pushed a very rudimentary sketch to my add-p-stash-mode
branch.