From 0c977dbc8180892af42d7ab9235fd3e51d6c4078 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 15 Jun 2017 12:30:55 -0400 Subject: diff-highlight: split code into module The diff-so-fancy project is also written in perl, and most of its users pipe diffs through both diff-highlight and diff-so-fancy. It would be nice if this could be done in a single script. So let's pull most of diff-highlight's code into its own module which can be used by diff-so-fancy. In addition, we'll abstract a few basic items like reading from stdio so that a script using the module can do more processing before or after diff-highlight handles the lines. See the README update for more details. One small downside is that the diff-highlight script must now be built using the Makefile. There are ways around this, but it quickly gets into perl arcana. Let's go with the simple solution. As a bonus, our Makefile now respects the PERL_PATH variable if it is set. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- contrib/diff-highlight/diff-highlight.perl | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 contrib/diff-highlight/diff-highlight.perl (limited to 'contrib/diff-highlight/diff-highlight.perl') diff --git a/contrib/diff-highlight/diff-highlight.perl b/contrib/diff-highlight/diff-highlight.perl new file mode 100644 index 0000000000..9b3e9c1f4d --- /dev/null +++ b/contrib/diff-highlight/diff-highlight.perl @@ -0,0 +1,8 @@ +package main; + +# Some scripts may not realize that SIGPIPE is being ignored when launching the +# pager--for instance scripts written in Python. +$SIG{PIPE} = 'DEFAULT'; + +DiffHighlight::highlight_stdin(); +exit 0; -- cgit v1.2.3