git-add--interactive: manual hunk editing mode
commitac083c47ea226b470afab39d975e718a475a3c78
authorThomas Rast <trast@student.ethz.ch>
Wed, 2 Jul 2008 22:00:00 +0000 (3 00:00 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 2 Jul 2008 22:31:49 +0000 (2 15:31 -0700)
tree2a0306b5162a8f9dd64068f18d57183b8013b9e8
parent0beee4c6dec15292415e3d56075c16a76a22af54
git-add--interactive: manual hunk editing mode

Adds a new option 'e' to the 'add -p' command loop that lets you edit
the current hunk in your favourite editor.

If the resulting patch applies cleanly, the edited hunk will
immediately be marked for staging. If it does not apply cleanly, you
will be given an opportunity to edit again. If all lines of the hunk
are removed, then the edit is aborted and the hunk is left unchanged.

Applying the changed hunk(s) relies on Johannes Schindelin's new
--recount option for git-apply.

Note that the "real patch" test intentionally uses
  (echo e; echo n; echo d) | git add -p
even though the 'n' and 'd' are superfluous at first sight.  They
serve to get out of the interaction loop if git add -p wrongly
concludes the patch does not apply.

Many thanks to Jeff King <peff@peff.net> for lots of help and
suggestions.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-add.txt
git-add--interactive.perl
t/t3701-add-interactive.sh