Re: [PATCH] diff-highlight: split code into module
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 15, 2017, 19:15 UTC
- Message-ID
- <xmqqpoe512rc.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20170615163055.b63hcivjogafkerq@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 34 quoted lines
> 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 <peff@peff.net>
> ---
> Scott and I discussed this off-list, and this was the least-gross
> solution I came up with. The plan would be for diff-so-fancy to pull in
> this copy of diff-highlight from git.git and have a wrapper script
> similar to the diff-highlight.perl found here.
>
> contrib/diff-highlight/.gitignore | 2 ++
> .../{diff-highlight => DiffHighlight.pm} | 40 +++++++++++++---------
> contrib/diff-highlight/Makefile | 21 ++++++++++--
> contrib/diff-highlight/README | 30 ++++++++++++++++
> contrib/diff-highlight/diff-highlight.perl | 8 +++++
> 5 files changed, 82 insertions(+), 19 deletions(-)
> create mode 100644 contrib/diff-highlight/.gitignore
> rename contrib/diff-highlight/{diff-highlight => DiffHighlight.pm} (91%)
> mode change 100755 => 100644
> create mode 100644 contrib/diff-highlight/diff-highlight.perlDo you want +x bit for the last one? I could throw that bit in while queuing if you want.
Thanks.