git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Brian Henderson <henderson.bj@gmail.com>
Cc: git@vger.kernel.org, peff@peff.net
Subject: Re: [PATCH 3/3] diff-highlight: add support for --graph output.
Date: Mon, 01 Aug 2016 10:16:01 -0700	[thread overview]
Message-ID: <xmqqk2g0l8a6.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20160730151149.15980-4-henderson.bj@gmail.com> (Brian Henderson's message of "Sat, 30 Jul 2016 08:11:49 -0700")

Brian Henderson <henderson.bj@gmail.com> writes:

> ---
>  contrib/diff-highlight/diff-highlight | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/contrib/diff-highlight/diff-highlight b/contrib/diff-highlight/diff-highlight
> index ffefc31..ec31356 100755
> --- a/contrib/diff-highlight/diff-highlight
> +++ b/contrib/diff-highlight/diff-highlight
> @@ -20,6 +20,7 @@ my @NEW_HIGHLIGHT = (
>  my $RESET = "\x1b[m";
>  my $COLOR = qr/\x1b\[[0-9;]*m/;
>  my $BORING = qr/$COLOR|\s/;
> +my $GRAPH = qr/$COLOR?\|$COLOR?\s+/;

I didn't read the other parts (or existing code this patch changes,
for that matter) of the series, but this looks like an attempt to
catch the leading "|" bar showing direct ancestry.  It makes a
reader wonder what happens in a mergy histroy, though.

I _think_ that the patch portion of "log -p" output would only have
"|" and never "\" or "/" that are used to adjust the number of
tracks to deal with forks and merges, but perhaps the fact that this
code relies on that assumption deserves to be written down here as
an in-code comment?

>  my @removed;
>  my @added;
> @@ -32,12 +33,12 @@ $SIG{PIPE} = 'DEFAULT';
>  while (<>) {
>  	if (!$in_hunk) {
>  		print;
> -		$in_hunk = /^$COLOR*\@/;
> +		$in_hunk = /^$GRAPH*$COLOR*\@/;
>  	}
> -	elsif (/^$COLOR*-/) {
> +	elsif (/^$GRAPH*$COLOR*-/) {
>  		push @removed, $_;
>  	}
> -	elsif (/^$COLOR*\+/) {
> +	elsif (/^$GRAPH*$COLOR*\+/) {
>  		push @added, $_;
>  	}
>  	else {
> @@ -46,7 +47,7 @@ while (<>) {
>  		@added = ();
>  
>  		print;
> -		$in_hunk = /^$COLOR*[\@ ]/;
> +		$in_hunk = /^$GRAPH*$COLOR*[\@ ]/;
>  	}
>  
>  	# Most of the time there is enough output to keep things streaming,
> @@ -211,8 +212,8 @@ sub is_pair_interesting {
>  	my $suffix_a = join('', @$a[($sa+1)..$#$a]);
>  	my $suffix_b = join('', @$b[($sb+1)..$#$b]);
>  
> -	return $prefix_a !~ /^$COLOR*-$BORING*$/ ||
> -	       $prefix_b !~ /^$COLOR*\+$BORING*$/ ||
> +	return $prefix_a !~ /^$GRAPH*$COLOR*-$BORING*$/ ||
> +	       $prefix_b !~ /^$GRAPH*$COLOR*\+$BORING*$/ ||
>  	       $suffix_a !~ /^$BORING*$/ ||
>  	       $suffix_b !~ /^$BORING*$/;
>  }

  reply	other threads:[~2016-08-01 17:16 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-30 15:11 [PATCH 0/3] diff-highlight: add support for git log --graph output Brian Henderson
2016-07-30 15:11 ` [PATCH 1/3] diff-highlight: add some tests Brian Henderson
2016-08-10  8:56   ` Eric Wong
2016-08-15 16:20     ` Brian Henderson
2016-08-15 16:25       ` Junio C Hamano
2016-08-17 15:31     ` [PATCH v2 0/3] diff-highlight: add support for git log --graph output Brian Henderson
2016-08-19 21:19       ` Eric Wong
2016-08-19 21:23         ` Jeff King
2016-08-17 15:31     ` [PATCH v2 1/3] diff-highlight: add some tests Brian Henderson
2016-08-17 19:09       ` Junio C Hamano
2016-08-19 14:42         ` Brian Henderson
2016-08-19 14:51           ` Jeff King
2016-08-19 15:13             ` Brian Henderson
2016-08-19 17:08             ` [PATCH v3 0/3] diff-highlight: add support for git log --graph output Brian Henderson
2016-08-19 17:08             ` [PATCH v3 1/3] diff-highlight: add some tests Brian Henderson
2016-08-19 18:10               ` Junio C Hamano
2016-08-19 19:30                 ` Brian Henderson
2016-08-19 20:56                   ` Eric Wong
2016-08-19 20:18                 ` [PATCH] " Brian Henderson
2016-08-19 20:44                   ` Junio C Hamano
2016-08-19 21:04                     ` Jeff King
2016-08-19 22:31                       ` Junio C Hamano
2016-08-22 15:55                         ` Brian Henderson
2016-08-23  4:12                           ` Jeff King
2016-08-29 17:33                             ` [PATCH v4 0/3] diff-highlight: add support for --graph option Brian Henderson
2016-08-29 17:33                               ` [PATCH v4 1/3] diff-highlight: add some tests Brian Henderson
2016-08-29 17:33                               ` [PATCH v4 2/3] diff-highlight: add failing test for handling --graph output Brian Henderson
2016-08-29 17:33                               ` [PATCH v4 3/3] diff-highlight: add support for " Brian Henderson
2016-08-29 21:37                               ` [PATCH v4 0/3] diff-highlight: add support for --graph option Junio C Hamano
2016-08-30 14:07                                 ` Brian Henderson
2016-08-30 14:07                                   ` [PATCH v4 1/3] diff-highlight: add some tests Brian Henderson
2016-08-30 14:07                                   ` [PATCH v4 2/3] diff-highlight: add failing test for handling --graph output Brian Henderson
2016-08-30 14:07                                   ` [PATCH v4 3/3] diff-highlight: add support for " Brian Henderson
2016-08-31  5:02                                   ` [PATCH v4 0/3] diff-highlight: add support for --graph option Jeff King
2016-08-31  5:02                                     ` [PATCH 1/3] diff-highlight: ignore test cruft Jeff King
2016-08-31  5:03                                     ` [PATCH 2/3] diff-highlight: add multi-byte tests Jeff King
2016-08-31  5:05                                     ` [PATCH 3/3] diff-highlight: avoid highlighting combined diffs Jeff King
2016-08-30  8:11                               ` [PATCH v4 0/3] diff-highlight: add support for --graph option Jeff King
2016-08-19 21:05                   ` [PATCH] diff-highlight: add some tests Junio C Hamano
2016-08-19 17:08             ` [PATCH v3 2/3] diff-highlight: add failing test for handling --graph output Brian Henderson
2016-08-19 18:25               ` Junio C Hamano
2016-08-19 17:08             ` [PATCH v3 3/3] diff-highlight: add support for " Brian Henderson
2016-08-19 18:27               ` Junio C Hamano
2016-08-17 15:31     ` [PATCH v2 2/3] diff-highlight: add failing test for handling " Brian Henderson
2016-08-17 19:18       ` Junio C Hamano
2016-08-17 15:31     ` [PATCH v2 3/3] diff-highlight: add support for " Brian Henderson
2016-08-19 14:37       ` Jeff King
2016-08-15 16:40   ` [PATCH 1/3] diff-highlight: add some tests Lars Schneider
2016-08-16 20:48     ` Junio C Hamano
2016-08-24  9:38       ` Lars Schneider
2016-07-30 15:11 ` [PATCH 2/3] diff-highlight: add failing test for handling --graph output Brian Henderson
2016-07-30 15:11 ` [PATCH 3/3] diff-highlight: add support for " Brian Henderson
2016-08-01 17:16   ` Junio C Hamano [this message]
2016-08-04 15:02     ` [PATCH] diff-highlight: Add comment for our assumption about " Brian Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqk2g0l8a6.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=henderson.bj@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).