git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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.perl

Do you want +x bit for the last one? I could throw that bit in while queuing if you want.

Thanks.
Previous: Jeff KingNext: Junio C Hamano
Message 2 of 5 in “diff-highlight: split code into module”
  1. diff-highlight: split code into moduleJeff King, Jun 15, 2017
  2. Junio C HamanoJun 15, 2017
  3. Junio C HamanoJun 15, 2017
  4. Jeff KingJun 16, 2017
  5. Scott BakerJun 15, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.