git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Microproject | Add more builtin patterns for userdiff
@ 2017-03-28 10:46 Pickfire
  2017-03-28 12:31 ` Jacob Keller
  2017-03-28 18:11 ` Stefan Beller
  0 siblings, 2 replies; 7+ messages in thread
From: Pickfire @ 2017-03-28 10:46 UTC (permalink / raw)
  To: git

While I was working buildins shell patterns for user diffs. I noticed that
the tests t4034 passes but I can reproduce it manually with:

    mkdir cpp/ && cd cpp/ && git init

    cat > pre <<EOF
    Foo():x(0&&1){}
    cout<<"Hello World!\n"<<endl;
    1 -1e10 0xabcdef 'x'
    [a] a->b a.b
    !a ~a a++ a-- a*b a&b
    a*b a/b a%b
    a+b a-b
    a<<b a>>b
    a<b a<=b a>b a>=b
    a==b a!=b
    a&b
    a^b
    a|b
    a&&b
    a||b
    a?b:z
    a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b
    a,y
    a::b
    EOF

    cat > post <<EOF
    Foo() : x(0&42) { bar(x); }
    cout<<"Hello World?\n"<<endl;
    (1) (-1e10) (0xabcdef) 'y'
    [x] x->y x.y
    !x ~x x++ x-- x*y x&y
    x*y x/y x%y
    x+y x-y
    x<<y x>>y
    x<y x<=y x>y x>=y
    x==y x!=y
    x&y
    x^y
    x|y
    x&&y
    x||y
    x?y:z
    x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y
    x,y
    x::y
    EOF

    echo '* diff="cpp"' > .gitmodules
    git diff --no-index --color-words pre post > output

Surprisingly, it shows (which is very different from the expected output):

^[[1mdiff --git a/pre b/post^[[m
^[[1mindex 23d5c8a..7e8c026 100644^[[m
^[[1m--- a/pre^[[m
^[[1m+++ b/post^[[m
^[[36m@@ -1,19 +1,19 @@^[[m
^[[31mFoo():x(0&&1){}^[[m^[[32mFoo() : x(0&42) { bar(x); }^[[m
cout<<"Hello ^[[31mWorld!\n"<<endl;^[[m
^[[31m1 -1e10 0xabcdef 'x'^[[m
^[[31m[a] a->b a.b^[[m
^[[31m!a ~a a++ a-- a*b a&b^[[m
^[[31ma*b a/b a%b^[[m
^[[31ma+b a-b^[[m
^[[31ma<<b a>>b^[[m
^[[31ma<b a<=b a>b a>=b^[[m
^[[31ma==b a!=b^[[m
^[[31ma&b^[[m
^[[31ma^b^[[m
^[[31ma|b^[[m
^[[31ma&&b^[[m
^[[31ma||b^[[m
^[[31ma?b:z^[[m
^[[31ma=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b^[[m
^[[31ma,y^[[m
^[[31ma::b^[[m^[[32mWorld?\n"<<endl;^[[m
^[[32m(1) (-1e10) (0xabcdef) 'y'^[[m
^[[32m[x] x->y x.y^[[m
^[[32m!x ~x x++ x-- x*y x&y^[[m
^[[32mx*y x/y x%y^[[m
^[[32mx+y x-y^[[m
^[[32mx<<y x>>y^[[m
^[[32mx<y x<=y x>y x>=y^[[m
^[[32mx==y x!=y^[[m
^[[32mx&y^[[m
^[[32mx^y^[[m
^[[32mx|y^[[m
^[[32mx&&y^[[m
^[[32mx||y^[[m
^[[32mx?y:z^[[m
^[[32mx=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y^[[m
^[[32mx,y^[[m
^[[32mx::y^[[m

Instead of:

<BOLD>diff --git a/pre b/post<RESET>
<BOLD>index 23d5c8a..7e8c026 100644<RESET>
<BOLD>--- a/pre<RESET>
<BOLD>+++ b/post<RESET>
<CYAN>@@ -1,19 +1,19 @@<RESET>
Foo() : x(0<RED>&&1<RESET><GREEN>&42<RESET>) { <GREEN>bar(x);<RESET> }
cout<<"Hello World<RED>!<RESET><GREEN>?<RESET>\n"<<endl;
<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>)<RESET> '<RED>x<RESET><GREEN>y<RESET>'
[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>
!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>
<RED>a<RESET><GREEN>y<RESET>
<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>
<RED>a<RESET><GREEN>y<RESET>
<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>
<RED>a<RESET><GREEN>y<RESET>
<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>
<RED>a<RESET><GREEN>y<RESET>
<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>
<RED>a<RESET><GREEN>y<RESET>
<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>
<RED>a<RESET><GREEN>y<RESET>
<GREEN>x<RESET>&<RED>b<RESET>
<RED>a<RESET><GREEN>y<RESET>
<GREEN>x<RESET>^<RED>b<RESET>
<RED>a<RESET><GREEN>y<RESET>
<GREEN>x<RESET>|<RED>b<RESET>
<RED>a<RESET><GREEN>y<RESET>
<GREEN>x<RESET>&&<RED>b<RESET>
<RED>a<RESET><GREEN>y<RESET>
<GREEN>x<RESET>||<RED>b<RESET>
<RED>a<RESET><GREEN>y<RESET>
<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z
<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>
<RED>a<RESET><GREEN>y<RESET>
<GREEN>x<RESET>,y
<RED>a<RESET><GREEN>x<RESET>::<RED>b<RESET><GREEN>y<RESET>

That's does not just happens to cpp builtins, it happens to bibtex as well.
Is it that I had missed some configuration since I have tested this on a
few machines?

I have a workaround for that, which is to run log with --color-words=<regex>
with regex from the userdiff.c, does it automatically use the builtins diff?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Microproject | Add more builtin patterns for userdiff
  2017-03-28 10:46 Microproject | Add more builtin patterns for userdiff Pickfire
@ 2017-03-28 12:31 ` Jacob Keller
  2017-03-28 17:53   ` Pickfire
  2017-03-28 18:11 ` Stefan Beller
  1 sibling, 1 reply; 7+ messages in thread
From: Jacob Keller @ 2017-03-28 12:31 UTC (permalink / raw)
  To: git

On Tue, Mar 28, 2017 at 3:46 AM, Pickfire <pickfire@riseup.net> wrote:
> While I was working buildins shell patterns for user diffs. I noticed that
> the tests t4034 passes but I can reproduce it manually with:
>
>     mkdir cpp/ && cd cpp/ && git init
>
>     cat > pre <<EOF
>     Foo():x(0&&1){}
>     cout<<"Hello World!\n"<<endl;
>     1 -1e10 0xabcdef 'x'
>     [a] a->b a.b
>     !a ~a a++ a-- a*b a&b
>     a*b a/b a%b
>     a+b a-b
>     a<<b a>>b
>     a<b a<=b a>b a>=b
>     a==b a!=b
>     a&b
>     a^b
>     a|b
>     a&&b
>     a||b
>     a?b:z
>     a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b
>     a,y
>     a::b
>     EOF
>
>     cat > post <<EOF
>     Foo() : x(0&42) { bar(x); }
>     cout<<"Hello World?\n"<<endl;
>     (1) (-1e10) (0xabcdef) 'y'
>     [x] x->y x.y
>     !x ~x x++ x-- x*y x&y
>     x*y x/y x%y
>     x+y x-y
>     x<<y x>>y
>     x<y x<=y x>y x>=y
>     x==y x!=y
>     x&y
>     x^y
>     x|y
>     x&&y
>     x||y
>     x?y:z
>     x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y
>     x,y
>     x::y
>     EOF
>
>     echo '* diff="cpp"' > .gitmodules
>     git diff --no-index --color-words pre post > output
>
> Surprisingly, it shows (which is very different from the expected output):
>

The diff test code uses "test_decode_color" function which decodes the
color commands into human readable text. From the looks of it, you're
trying to reproduce the test outside the test suite. However, you're
not decoding the colors using the test library function, so it doesn't
look right.

Thanks,
Jake

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Re: Microproject | Add more builtin patterns for userdiff
  2017-03-28 12:31 ` Jacob Keller
@ 2017-03-28 17:53   ` Pickfire
  2017-03-28 18:10     ` Jacob Keller
  0 siblings, 1 reply; 7+ messages in thread
From: Pickfire @ 2017-03-28 17:53 UTC (permalink / raw)
  To: jacob.keller; +Cc: git

Jacob Keller <jacob.keller@gmail.com> wrote:

> On Tue, Mar 28, 2017 at 3:46 AM, Pickfire <pickfire@riseup.net> wrote:
> > While I was working buildins shell patterns for user diffs. I noticed that
> > the tests t4034 passes but I can reproduce it manually with:
> >
> >     mkdir cpp/ && cd cpp/ && git init
> >
> >     cat > pre <<EOF
> >     Foo():x(0&&1){}
> >     cout<<"Hello World!\n"<<endl;
> >     1 -1e10 0xabcdef 'x'
> >     [a] a->b a.b
> >     !a ~a a++ a-- a*b a&b
> >     a*b a/b a%b
> >     a+b a-b
> >     a<<b a>>b
> >     a<b a<=b a>b a>=b
> >     a==b a!=b
> >     a&b
> >     a^b
> >     a|b
> >     a&&b
> >     a||b
> >     a?b:z
> >     a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b
> >     a,y
> >     a::b
> >     EOF
> >
> >     cat > post <<EOF
> >     Foo() : x(0&42) { bar(x); }
> >     cout<<"Hello World?\n"<<endl;
> >     (1) (-1e10) (0xabcdef) 'y'
> >     [x] x->y x.y
> >     !x ~x x++ x-- x*y x&y
> >     x*y x/y x%y
> >     x+y x-y
> >     x<<y x>>y
> >     x<y x<=y x>y x>=y
> >     x==y x!=y
> >     x&y
> >     x^y
> >     x|y
> >     x&&y
> >     x||y
> >     x?y:z
> >     x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y
> >     x,y
> >     x::y
> >     EOF
> >
> >     echo '* diff="cpp"' > .gitmodules
> >     git diff --no-index --color-words pre post > output
> >
> > Surprisingly, it shows (which is very different from the expected output):
> >
> 
> The diff test code uses "test_decode_color" function which decodes the
> color commands into human readable text. From the looks of it, you're
> trying to reproduce the test outside the test suite. However, you're
> not decoding the colors using the test library function, so it doesn't
> look right.

Yes, I can't reproduce it outside the test suite. I have added the builtin
and yet the test fails. test_decode_color gets same output as expect but
still it fails, should I send in the patch?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Re: Microproject | Add more builtin patterns for userdiff
  2017-03-28 17:53   ` Pickfire
@ 2017-03-28 18:10     ` Jacob Keller
  2017-03-29  1:55       ` Pickfire
  0 siblings, 1 reply; 7+ messages in thread
From: Jacob Keller @ 2017-03-28 18:10 UTC (permalink / raw)
  To: Jacob Keller, Git mailing list

On Tue, Mar 28, 2017 at 10:53 AM, Pickfire <pickfire@riseup.net> wrote:
>
> Yes, I can't reproduce it outside the test suite. I have added the builtin
> and yet the test fails. test_decode_color gets same output as expect but
> still it fails, should I send in the patch?

You also need to ensure you have the exact same color settings as used
by the test scripts.

Thanks,
Jake

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Microproject | Add more builtin patterns for userdiff
  2017-03-28 10:46 Microproject | Add more builtin patterns for userdiff Pickfire
  2017-03-28 12:31 ` Jacob Keller
@ 2017-03-28 18:11 ` Stefan Beller
  2017-03-29  1:54   ` Pickfire
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Beller @ 2017-03-28 18:11 UTC (permalink / raw)
  To: git, Ivan Tham

On Tue, Mar 28, 2017 at 3:46 AM, Pickfire <pickfire@riseup.net> wrote:

>     EOF
>
>     echo '* diff="cpp"' > .gitmodules

Did you mean .gitattributes?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Re: Microproject | Add more builtin patterns for userdiff
  2017-03-28 18:11 ` Stefan Beller
@ 2017-03-29  1:54   ` Pickfire
  0 siblings, 0 replies; 7+ messages in thread
From: Pickfire @ 2017-03-29  1:54 UTC (permalink / raw)
  To: sbeller; +Cc: git

Stefan Beller <sbeller@google.com> wrote:

> On Tue, Mar 28, 2017 at 3:46 AM, Pickfire <pickfire@riseup.net> wrote:
> 
> >     EOF
> >
> >     echo '* diff="cpp"' > .gitmodules
> 
> Did you mean .gitattributes?

Yeah, that's a spelling error.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Re: Re: Microproject | Add more builtin patterns for userdiff
  2017-03-28 18:10     ` Jacob Keller
@ 2017-03-29  1:55       ` Pickfire
  0 siblings, 0 replies; 7+ messages in thread
From: Pickfire @ 2017-03-29  1:55 UTC (permalink / raw)
  To: jacob.keller; +Cc: git

Jacob Keller <jacob.keller@gmail.com> wrote:

> On Tue, Mar 28, 2017 at 10:53 AM, Pickfire <pickfire@riseup.net> wrote:
> >
> > Yes, I can't reproduce it outside the test suite. I have added the builtin
> > and yet the test fails. test_decode_color gets same output as expect but
> > still it fails, should I send in the patch?
> 
> You also need to ensure you have the exact same color settings as used
> by the test scripts.
> 
> Thanks,
> Jake

Yes, I used the same color, looks like the block that are failing is:

    test_must_fail git diff --no-index "$@" pre post >output

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-03-29  1:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-28 10:46 Microproject | Add more builtin patterns for userdiff Pickfire
2017-03-28 12:31 ` Jacob Keller
2017-03-28 17:53   ` Pickfire
2017-03-28 18:10     ` Jacob Keller
2017-03-29  1:55       ` Pickfire
2017-03-28 18:11 ` Stefan Beller
2017-03-29  1:54   ` Pickfire

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