{"thread":{"id":"45525","subject":"Microproject | Add more builtin patterns for userdiff","startedAt":"2017-03-28T10:47:41Z","lastAt":"2017-03-29T01:55:42Z","messageCount":7,"participants":["Pickfire","Jacob Keller","Stefan Beller"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"315560","messageId":"20170328104652.XsS8a6ysu%pickfire@riseup.net","threadId":"45525","inReplyTo":null,"subject":"Microproject | Add more builtin patterns for userdiff","fromName":"Pickfire","fromEmail":"pickfire@riseup.net","sentAt":"2017-03-28T10:46:52Z","receivedAt":"2017-03-28T10:47:41Z","isPatch":false,"sender":{"key":"pickfire@riseup.net","avatar":null},"body":"While I was working buildins shell patterns for user diffs. I noticed that\nthe tests t4034 passes but I can reproduce it manually with:\n\n    mkdir cpp/ && cd cpp/ && git init\n\n    cat > pre <<EOF\n    Foo():x(0&&1){}\n    cout<<\"Hello World!\\n\"<<endl;\n    1 -1e10 0xabcdef 'x'\n    [a] a->b a.b\n    !a ~a a++ a-- a*b a&b\n    a*b a/b a%b\n    a+b a-b\n    a<<b a>>b\n    a<b a<=b a>b a>=b\n    a==b a!=b\n    a&b\n    a^b\n    a|b\n    a&&b\n    a||b\n    a?b:z\n    a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b\n    a,y\n    a::b\n    EOF\n\n    cat > post <<EOF\n    Foo() : x(0&42) { bar(x); }\n    cout<<\"Hello World?\\n\"<<endl;\n    (1) (-1e10) (0xabcdef) 'y'\n    [x] x->y x.y\n    !x ~x x++ x-- x*y x&y\n    x*y x/y x%y\n    x+y x-y\n    x<<y x>>y\n    x<y x<=y x>y x>=y\n    x==y x!=y\n    x&y\n    x^y\n    x|y\n    x&&y\n    x||y\n    x?y:z\n    x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n    x,y\n    x::y\n    EOF\n\n    echo '* diff=\"cpp\"' > .gitmodules\n    git diff --no-index --color-words pre post > output\n\nSurprisingly, it shows (which is very different from the expected output):\n\n^[[1mdiff --git a/pre b/post^[[m\n^[[1mindex 23d5c8a..7e8c026 100644^[[m\n^[[1m--- a/pre^[[m\n^[[1m+++ b/post^[[m\n^[[36m@@ -1,19 +1,19 @@^[[m\n^[[31mFoo():x(0&&1){}^[[m^[[32mFoo() : x(0&42) { bar(x); }^[[m\ncout<<\"Hello ^[[31mWorld!\\n\"<<endl;^[[m\n^[[31m1 -1e10 0xabcdef 'x'^[[m\n^[[31m[a] a->b a.b^[[m\n^[[31m!a ~a a++ a-- a*b a&b^[[m\n^[[31ma*b a/b a%b^[[m\n^[[31ma+b a-b^[[m\n^[[31ma<<b a>>b^[[m\n^[[31ma<b a<=b a>b a>=b^[[m\n^[[31ma==b a!=b^[[m\n^[[31ma&b^[[m\n^[[31ma^b^[[m\n^[[31ma|b^[[m\n^[[31ma&&b^[[m\n^[[31ma||b^[[m\n^[[31ma?b:z^[[m\n^[[31ma=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b^[[m\n^[[31ma,y^[[m\n^[[31ma::b^[[m^[[32mWorld?\\n\"<<endl;^[[m\n^[[32m(1) (-1e10) (0xabcdef) 'y'^[[m\n^[[32m[x] x->y x.y^[[m\n^[[32m!x ~x x++ x-- x*y x&y^[[m\n^[[32mx*y x/y x%y^[[m\n^[[32mx+y x-y^[[m\n^[[32mx<<y x>>y^[[m\n^[[32mx<y x<=y x>y x>=y^[[m\n^[[32mx==y x!=y^[[m\n^[[32mx&y^[[m\n^[[32mx^y^[[m\n^[[32mx|y^[[m\n^[[32mx&&y^[[m\n^[[32mx||y^[[m\n^[[32mx?y:z^[[m\n^[[32mx=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y^[[m\n^[[32mx,y^[[m\n^[[32mx::y^[[m\n\nInstead of:\n\n<BOLD>diff --git a/pre b/post<RESET>\n<BOLD>index 23d5c8a..7e8c026 100644<RESET>\n<BOLD>--- a/pre<RESET>\n<BOLD>+++ b/post<RESET>\n<CYAN>@@ -1,19 +1,19 @@<RESET>\nFoo() : x(0<RED>&&1<RESET><GREEN>&42<RESET>) { <GREEN>bar(x);<RESET> }\ncout<<\"Hello World<RED>!<RESET><GREEN>?<RESET>\\n\"<<endl;\n<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>)<RESET> '<RED>x<RESET><GREEN>y<RESET>'\n[<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>\n!<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>\n<RED>a<RESET><GREEN>y<RESET>\n<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>\n<RED>a<RESET><GREEN>y<RESET>\n<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>\n<RED>a<RESET><GREEN>y<RESET>\n<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>\n<RED>a<RESET><GREEN>y<RESET>\n<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>\n<RED>a<RESET><GREEN>y<RESET>\n<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>\n<RED>a<RESET><GREEN>y<RESET>\n<GREEN>x<RESET>&<RED>b<RESET>\n<RED>a<RESET><GREEN>y<RESET>\n<GREEN>x<RESET>^<RED>b<RESET>\n<RED>a<RESET><GREEN>y<RESET>\n<GREEN>x<RESET>|<RED>b<RESET>\n<RED>a<RESET><GREEN>y<RESET>\n<GREEN>x<RESET>&&<RED>b<RESET>\n<RED>a<RESET><GREEN>y<RESET>\n<GREEN>x<RESET>||<RED>b<RESET>\n<RED>a<RESET><GREEN>y<RESET>\n<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z\n<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>\n<RED>a<RESET><GREEN>y<RESET>\n<GREEN>x<RESET>,y\n<RED>a<RESET><GREEN>x<RESET>::<RED>b<RESET><GREEN>y<RESET>\n\nThat's does not just happens to cpp builtins, it happens to bibtex as well.\nIs it that I had missed some configuration since I have tested this on a\nfew machines?\n\nI have a workaround for that, which is to run log with --color-words=<regex>\nwith regex from the userdiff.c, does it automatically use the builtins diff?\n"},{"id":"315565","messageId":"CA+P7+xr+vJP=usEhnR2gZdNY+k8035sX9FgFvvrrL5j_xCu=Mg@mail.gmail.com","threadId":"45525","inReplyTo":"20170328104652.XsS8a6ysu%pickfire@riseup.net","subject":"Re: Microproject | Add more builtin patterns for userdiff","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2017-03-28T12:31:15Z","receivedAt":"2017-03-28T13:05:28Z","isPatch":false,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Tue, Mar 28, 2017 at 3:46 AM, Pickfire <pickfire@riseup.net> wrote:\n> While I was working buildins shell patterns for user diffs. I noticed that\n> the tests t4034 passes but I can reproduce it manually with:\n>\n>     mkdir cpp/ && cd cpp/ && git init\n>\n>     cat > pre <<EOF\n>     Foo():x(0&&1){}\n>     cout<<\"Hello World!\\n\"<<endl;\n>     1 -1e10 0xabcdef 'x'\n>     [a] a->b a.b\n>     !a ~a a++ a-- a*b a&b\n>     a*b a/b a%b\n>     a+b a-b\n>     a<<b a>>b\n>     a<b a<=b a>b a>=b\n>     a==b a!=b\n>     a&b\n>     a^b\n>     a|b\n>     a&&b\n>     a||b\n>     a?b:z\n>     a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b\n>     a,y\n>     a::b\n>     EOF\n>\n>     cat > post <<EOF\n>     Foo() : x(0&42) { bar(x); }\n>     cout<<\"Hello World?\\n\"<<endl;\n>     (1) (-1e10) (0xabcdef) 'y'\n>     [x] x->y x.y\n>     !x ~x x++ x-- x*y x&y\n>     x*y x/y x%y\n>     x+y x-y\n>     x<<y x>>y\n>     x<y x<=y x>y x>=y\n>     x==y x!=y\n>     x&y\n>     x^y\n>     x|y\n>     x&&y\n>     x||y\n>     x?y:z\n>     x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n>     x,y\n>     x::y\n>     EOF\n>\n>     echo '* diff=\"cpp\"' > .gitmodules\n>     git diff --no-index --color-words pre post > output\n>\n> Surprisingly, it shows (which is very different from the expected output):\n>\n\nThe diff test code uses \"test_decode_color\" function which decodes the\ncolor commands into human readable text. From the looks of it, you're\ntrying to reproduce the test outside the test suite. However, you're\nnot decoding the colors using the test library function, so it doesn't\nlook right.\n\nThanks,\nJake\n"},{"id":"315579","messageId":"20170328175356.1GG4n_Oas%pickfire@riseup.net","threadId":"45525","inReplyTo":"CA+P7+xr+vJP=usEhnR2gZdNY+k8035sX9FgFvvrrL5j_xCu=Mg@mail.gmail.com","subject":"Re: Re: Microproject | Add more builtin patterns for userdiff","fromName":"Pickfire","fromEmail":"pickfire@riseup.net","sentAt":"2017-03-28T17:53:56Z","receivedAt":"2017-03-28T17:54:21Z","isPatch":false,"sender":{"key":"pickfire@riseup.net","avatar":null},"body":"Jacob Keller <jacob.keller@gmail.com> wrote:\n\n> On Tue, Mar 28, 2017 at 3:46 AM, Pickfire <pickfire@riseup.net> wrote:\n> > While I was working buildins shell patterns for user diffs. I noticed that\n> > the tests t4034 passes but I can reproduce it manually with:\n> >\n> >     mkdir cpp/ && cd cpp/ && git init\n> >\n> >     cat > pre <<EOF\n> >     Foo():x(0&&1){}\n> >     cout<<\"Hello World!\\n\"<<endl;\n> >     1 -1e10 0xabcdef 'x'\n> >     [a] a->b a.b\n> >     !a ~a a++ a-- a*b a&b\n> >     a*b a/b a%b\n> >     a+b a-b\n> >     a<<b a>>b\n> >     a<b a<=b a>b a>=b\n> >     a==b a!=b\n> >     a&b\n> >     a^b\n> >     a|b\n> >     a&&b\n> >     a||b\n> >     a?b:z\n> >     a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b\n> >     a,y\n> >     a::b\n> >     EOF\n> >\n> >     cat > post <<EOF\n> >     Foo() : x(0&42) { bar(x); }\n> >     cout<<\"Hello World?\\n\"<<endl;\n> >     (1) (-1e10) (0xabcdef) 'y'\n> >     [x] x->y x.y\n> >     !x ~x x++ x-- x*y x&y\n> >     x*y x/y x%y\n> >     x+y x-y\n> >     x<<y x>>y\n> >     x<y x<=y x>y x>=y\n> >     x==y x!=y\n> >     x&y\n> >     x^y\n> >     x|y\n> >     x&&y\n> >     x||y\n> >     x?y:z\n> >     x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n> >     x,y\n> >     x::y\n> >     EOF\n> >\n> >     echo '* diff=\"cpp\"' > .gitmodules\n> >     git diff --no-index --color-words pre post > output\n> >\n> > Surprisingly, it shows (which is very different from the expected output):\n> >\n> \n> The diff test code uses \"test_decode_color\" function which decodes the\n> color commands into human readable text. From the looks of it, you're\n> trying to reproduce the test outside the test suite. However, you're\n> not decoding the colors using the test library function, so it doesn't\n> look right.\n\nYes, I can't reproduce it outside the test suite. I have added the builtin\nand yet the test fails. test_decode_color gets same output as expect but\nstill it fails, should I send in the patch?\n"},{"id":"315581","messageId":"CA+P7+xrYKE1JOhmVQLVB1RKPnkGNsPPaW+-t8=PqcVpRDcZ=Nw@mail.gmail.com","threadId":"45525","inReplyTo":"20170328175356.1GG4n_Oas%pickfire@riseup.net","subject":"Re: Re: Microproject | Add more builtin patterns for userdiff","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2017-03-28T18:10:27Z","receivedAt":"2017-03-28T18:11:10Z","isPatch":false,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Tue, Mar 28, 2017 at 10:53 AM, Pickfire <pickfire@riseup.net> wrote:\n>\n> Yes, I can't reproduce it outside the test suite. I have added the builtin\n> and yet the test fails. test_decode_color gets same output as expect but\n> still it fails, should I send in the patch?\n\nYou also need to ensure you have the exact same color settings as used\nby the test scripts.\n\nThanks,\nJake\n"},{"id":"315582","messageId":"CAGZ79kaLB3w1dkr-_+zTPTJ8Zs2POOVFcnuJ_CDT6sJi1TxMHg@mail.gmail.com","threadId":"45525","inReplyTo":"20170328104652.XsS8a6ysu%pickfire@riseup.net","subject":"Re: Microproject | Add more builtin patterns for userdiff","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2017-03-28T18:11:15Z","receivedAt":"2017-03-28T18:11:40Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Tue, Mar 28, 2017 at 3:46 AM, Pickfire <pickfire@riseup.net> wrote:\n\n>     EOF\n>\n>     echo '* diff=\"cpp\"' > .gitmodules\n\nDid you mean .gitattributes?\n"},{"id":"315644","messageId":"20170329015409.tla6yx-2k%pickfire@riseup.net","threadId":"45525","inReplyTo":"CAGZ79kaLB3w1dkr-_+zTPTJ8Zs2POOVFcnuJ_CDT6sJi1TxMHg@mail.gmail.com","subject":"Re: Re: Microproject | Add more builtin patterns for userdiff","fromName":"Pickfire","fromEmail":"pickfire@riseup.net","sentAt":"2017-03-29T01:54:09Z","receivedAt":"2017-03-29T01:55:21Z","isPatch":false,"sender":{"key":"pickfire@riseup.net","avatar":null},"body":"Stefan Beller <sbeller@google.com> wrote:\n\n> On Tue, Mar 28, 2017 at 3:46 AM, Pickfire <pickfire@riseup.net> wrote:\n> \n> >     EOF\n> >\n> >     echo '* diff=\"cpp\"' > .gitmodules\n> \n> Did you mean .gitattributes?\n\nYeah, that's a spelling error.\n"},{"id":"315645","messageId":"20170329015532.R50BRdAbP%pickfire@riseup.net","threadId":"45525","inReplyTo":"CA+P7+xrYKE1JOhmVQLVB1RKPnkGNsPPaW+-t8=PqcVpRDcZ=Nw@mail.gmail.com","subject":"Re: Re: Re: Microproject | Add more builtin patterns for userdiff","fromName":"Pickfire","fromEmail":"pickfire@riseup.net","sentAt":"2017-03-29T01:55:32Z","receivedAt":"2017-03-29T01:55:42Z","isPatch":false,"sender":{"key":"pickfire@riseup.net","avatar":null},"body":"Jacob Keller <jacob.keller@gmail.com> wrote:\n\n> On Tue, Mar 28, 2017 at 10:53 AM, Pickfire <pickfire@riseup.net> wrote:\n> >\n> > Yes, I can't reproduce it outside the test suite. I have added the builtin\n> > and yet the test fails. test_decode_color gets same output as expect but\n> > still it fails, should I send in the patch?\n> \n> You also need to ensure you have the exact same color settings as used\n> by the test scripts.\n> \n> Thanks,\n> Jake\n\nYes, I used the same color, looks like the block that are failing is:\n\n    test_must_fail git diff --no-index \"$@\" pre post >output\n"}]}