lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Navigate by color in `git-diff --color-moved=plain`


From: Vadim Zeitlin
Subject: Re: [lmi] Navigate by color in `git-diff --color-moved=plain`
Date: Thu, 25 Apr 2019 01:00:12 +0200

On Wed, 24 Apr 2019 22:40:07 +0000 Greg Chicares <address@hidden> wrote:

GC> That's weird in the same way. Both logs print the sourced 'set_arch.sh',
GC> and the relevant lines are identical:
GC>         w0="$(winepath -w "$localbindir" | sed -e's/\\/\\\\/g')"
GC>         w1="$(winepath -w "$locallibdir" | sed -e's/\\/\\\\/g')"
GC>         w2="$(winepath -w "$winebindir"  | sed -e's/\\/\\\\/g')"
GC> 
GC> and the older log shows a regular trace, but the newer log traces
GC> the middle ('w1') line differently:
GC> 
GC> + winepath -w /opt/lmi/x86_64-w64-mingw32/local/bin
GC> + sed -es/\\/\\\\/g
GC> + w0=Z:\\opt\\lmi\\x86_64-w64-mingw32\\local\\bin
GC> + winepath -w+  /opt/lmi/x86_64-w64-mingw32/local/lib
GC> sed -es/\\/\\\\/g
GC> + w1=Z:\\opt\\lmi\\x86_64-w64-mingw32\\local\\lib
GC> + winepath -w /opt/lmi/third_party/bin
GC> + sed -es/\\/\\\\/g
GC> + w2=Z:\\opt\\lmi\\third_party\\bin
GC> 
GC> Any idea what's going on there?

 Absolutely none, but this looks like a bug in dash (this is executed by
dash, isn't it?) to me... I'm not sure what exactly do I need to do to see
this, so it's easier to ask you:

1. Is this reproducible?
2. If yes, does it still happen with bash instead of dash?

(of course, if it's not reproducible, it's arguably even worse, but I have
no idea how to debug it then).

GC> If I find the time, I think I could combine these ideas into something
GC> better, thus:
GC>  - produce the differences with escape codes
GC>  - instead of filtering with "grep '^.\[3[12]'" as above, do something like
GC>      | sed -e's/^.\[3[12]/ZZZ/' | ...
GC>  - pipe the result back into 'less'; then just search for "ZZZ"
GC> Actually, carrying out that plan is trivially easy, and this works great:
GC> 
GC> git diff --no-index --color=always --color-moved=plain \
GC>   ../log-20190424T2109Z ../log-20190421T2325Z-good \
GC>   |sed -e's/^.\[3[12]m/ZZZ/' |less -RS
GC> 
GC> I'm not ambitious enough to try using a non-printing character like ZWNJ
GC> instead of the sufficiently unlikely string "ZZZ".

 The idea with "ZZZ" (I'd probably use something like "+ " instead and just
search for "^++ ") is nice, but why not preserve the colours as well to
still make the changes stand out visually?

 E.g. something like (untested):

        sed -e's/^.\[31m/&YYY/' -e's/^.\[32m/&ZZZ/'

?

VZ


reply via email to

[Prev in Thread] Current Thread [Next in Thread]