git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
From: Stefan Beller <sbeller@google.com>
To: dpb@corrigendum.ru
Cc: git <git@vger.kernel.org>, Paul Mackerras <paulus@ozlabs.org>
Subject: Re: [PATCH] gitk: don't highlight submodule diff lines outside submodule diffs
Date: Tue, 6 Nov 2018 12:06:49 -0800
Message-ID: <CAGZ79kZKN8U5+F+BAhQMkLuJVupgAvUgCaMt5-e_FDmY1RUY5g@mail.gmail.com> (raw)
In-Reply-To: <20181106195417.5456-1-dpb@corrigendum.ru>

On Tue, Nov 6, 2018 at 12:03 PM Роман Донченко <dpb@corrigendum.ru> wrote:
>
> A line that starts with "  <" or "  >" is not necessarily a submodule
> diff line. It might just be a context line in a normal diff, representing
> a line starting with " <" or " >" respectively.
>
> Use the currdiffsubmod variable to track whether we are currently
> inside a submodule diff and only highlight these lines if we are.

This explanation makes sense, some prior art is at
https://public-inbox.org/git/20181021163401.4458-1-dummy@example.com/
which was not taken AFAICT.

Thanks,
Stefan

>
> Signed-off-by: Роман Донченко <dpb@corrigendum.ru>
> ---
>  gitk | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/gitk b/gitk
> index a14d7a1..6bb6dc6 100755
> --- a/gitk
> +++ b/gitk
> @@ -8109,6 +8109,8 @@ proc parseblobdiffline {ids line} {
>         }
>         # start of a new file
>         set diffinhdr 1
> +       set currdiffsubmod ""
> +
>         $ctext insert end "\n"
>         set curdiffstart [$ctext index "end - 1c"]
>         lappend ctext_file_names ""
> @@ -8191,12 +8193,10 @@ proc parseblobdiffline {ids line} {
>         } else {
>             $ctext insert end "$line\n" filesep
>         }
> -    } elseif {![string compare -length 3 "  >" $line]} {
> -       set $currdiffsubmod ""
> +    } elseif {$currdiffsubmod ne "" && ![string compare -length 3 "  >" $line]} {
>         set line [encoding convertfrom $diffencoding $line]
>         $ctext insert end "$line\n" dresult
> -    } elseif {![string compare -length 3 "  <" $line]} {
> -       set $currdiffsubmod ""
> +    } elseif {$currdiffsubmod ne "" && ![string compare -length 3 "  <" $line]} {
>         set line [encoding convertfrom $diffencoding $line]
>         $ctext insert end "$line\n" d0
>      } elseif {$diffinhdr} {
> --
> 2.19.1.windows.1
>

  reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-06 19:54 Роман Донченко
2018-11-06 20:06 ` Stefan Beller [this message]
2018-11-06 21:56   ` Роман Донченко

Reply instructions:

You may reply publically 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=CAGZ79kZKN8U5+F+BAhQMkLuJVupgAvUgCaMt5-e_FDmY1RUY5g@mail.gmail.com \
    --to=sbeller@google.com \
    --cc=dpb@corrigendum.ru \
    --cc=git@vger.kernel.org \
    --cc=paulus@ozlabs.org \
    /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

git@vger.kernel.org mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox