Skip to content

Manual editing for 'add' and 'add -p'

Thomas Rast git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3Allow git-apply to ignore the hunk headers (AKA recountdiff)Documentation/git-apply.txt builtin-apply.c+66 -53 replies
2/3git-add: introduce --edit (to edit the diff vs. the index)Documentation/git-add.txt builtin-add.c t/t3702-add-edit.sh+191 -20 replies
3/3git-add--interactive: manual hunk editing modeDocumentation/git-add.txt git-add--interactive.perl t/t3701-add-interactive.sh+191 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] Manual editing for 'add' and 'add -p'
Quoted 2 lines · Jeff King

Thomas, do you want to just re-submit the "--recount" patches when you re-submit your patch?

If that is the right thing to do :-)

I rebased Johannes' patches to current 'next', which had some trivial merge conflicts, and made one actual change: By analogy with one earlier patch that caused some of the conflicts, I split '-e' and '--edit' across two lines in the documentation.

I also integrated your last suggestion:

Quoted 4 lines

# Abort if nothing remains
if (!grep { /\S/ } @newtext) {
return undef;
}

I'm not really convinced it is needed, but any such patch can obviously not change anything, so it can't hurt. Who knows, perhaps there are editors brain-damaged enough to always save at least one newline. (This is the only change to my patch compared to v4.)

Quoted 4 lines · Johannes Schindelin

To spare you following that link: Junio wanted to reuse "git apply --recount" to apply mboxes, where a separator "^-- $" to the signature is quite common, and could be mistaken for a "-" line of a hunk.

[...]

Quoted 3 lines

However, I think that this issue should not concern us _now_. As long as --recount is only to be used in "add -i" and "add -e", I think the patch is good as is:

I'm wondering if this should be turned into docs. After all, it's not some DWIM option. It just says that instead of trusting the counts, lines starting with "diff " or "@@ " start hunks, implying that all /^[-+ ]/ lines in between are significant.

I hope this series turns out right in mail; I'm struggling a bit to properly import the mails to KMail. Most annoyingly, format-patch apparently cannot turn other people's patches into mails by myself with an appropriate "From:" line. :-(

- Thomas

Johannes Schindelin (2):
Allow git-apply to ignore the hunk headers (AKA recountdiff)
git-add: introduce --edit (to edit the diff vs. the index)

Thomas Rast (1):
git-add--interactive: manual hunk editing mode

 Documentation/git-add.txt   |   13 ++++-
 Documentation/git-apply.txt |    7 ++-
 builtin-add.c               |   55 ++++++++++++++++++-
 builtin-apply.c             |   64 ++++++++++++++++++++--
 git-add--interactive.perl   |  124 +++++++++++++++++++++++++++++++++++++++++-
 t/t3701-add-interactive.sh  |   67 +++++++++++++++++++++++
 t/t3702-add-edit.sh         |  126 +++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 448 insertions(+), 8 deletions(-)
 create mode 100755 t/t3702-add-edit.sh