add--interactive: allow hunk filtering on command line

If you have a lot of uninteresting hunks (e.g., because you
have a file with boilerplate that changed, but you want to
add only the interesting bits and discard the rest), it can
be cumbersome to sift through the boring hunks.

This patch provides an option to match hunks by regular
expression, pretending as if the non-matching changes do not
exist at all (similar to how path-limiting ignores
non-matching paths entirely).

There are two special case pseudo-hunks to consider in the
code: mode hunks and deletion hunks.

  - If a filter is given, this patch will never include mode
    hunks, since the user has asked for a specific subset of
    hunks, and the mode has no text to match.

  - Deletion hunks actually require no special care. In a
    deletion there will be only a single giant diff hunk of
    deleted content. If it matches the filter, then the
    deletion can be presented as normal. If it doesn't
    match, then we exit early from patch_update_file and
    never consider showing the deletion at all (since there
    is nothing to delete).

This patch provides only the perl portion; it is up to
individual callers of add--interactive to pass the option
through to the perl code.

Signed-off-by: Jeff King <peff@peff.net>
add--interactive: allow negatation of hunk filters

This patch lets you filter out certain boring hunks, rather
than trying to match particular interesting ones (which may
be much easier, depending on your file contents).

Signed-off-by: Jeff King <peff@peff.net>
add--interactive: add option to autosplit hunks

It is sometimes useful to see changes in their smallest
possible form, rather than complete hunks with overlapping
context. You can do this manually, of course, with the
's'plit hunk command. But when filtering hunks, you may want
to pre-split to give your filtering a finer granularity.

This patch adds only the perl infrastructure; to expose this
to the user, the various callers of add--interactive need to
pass the new option through to the perl script.

Signed-off-by: Jeff King <peff@peff.net>