diff options
author | Jeff King <peff@peff.net> | 2016-02-27 00:37:06 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-02-28 10:53:54 -0800 |
commit | 01143847dbf4fbf27268650f3ace16eac03b3130 (patch) | |
tree | 190b07e4d7394842da11b82d346cf420f5e7b771 /csum-file.h | |
parent | f02fbc4f9433937ee0463d0342d6d7d97e1f6f1e (diff) | |
download | git-01143847dbf4fbf27268650f3ace16eac03b3130.tar.gz |
add--interactive: allow custom diff highlighting programsjk/add-i-highlight
The patch hunk selector of add--interactive knows how ask
git for colorized diffs, and correlate them with the
uncolored diffs we apply. But there's not any way for
somebody who uses a diff-filter tool like contrib's
diff-highlight to see their normal highlighting.
This patch lets users define an arbitrary shell command to
pipe the colorized diff through. The exact output shouldn't
matter (since we just show the result to humans) as long as
it is line-compatible with the original diff (so that
hunk-splitting can split the colorized version, too).
I left two minor issues with the new system that I don't
think are worth fixing right now, but could be done later:
1. We only filter colorized diffs. Theoretically a user
could want to filter a non-colorized diff, but I find
it unlikely in practice. Users who are doing things
like diff-highlighting are likely to want color, too.
2. add--interactive will re-colorize a diff which has been
hand-edited, but it won't have run through the filter.
Fixing this is conceptually easy (just pipe the diff
through the filter), but practically hard to do without
using tempfiles (it would need to feed data to and read
the result from the filter without deadlocking; this
raises portability questions with respect to Windows).
I've punted on both issues for now, and if somebody really
cares later, they can do a patch on top.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'csum-file.h')
0 files changed, 0 insertions, 0 deletions