git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Microproject | Add more builtin patterns for userdiff

From
Jacob Keller <jacob.keller@gmail.com>
Date
Mar 28, 2017, 12:31 UTC
Message-ID
<CA+P7+xr+vJP=usEhnR2gZdNY+k8035sX9FgFvvrrL5j_xCu=Mg@mail.gmail.com>
In-Reply-To
<20170328104652.XsS8a6ysu%pickfire@riseup.net>
On Tue, Mar 28, 2017 at 3:46 AM, Pickfire <pickfire@riseup.net> wrote:
Show 54 quoted lines
> 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

Previous: PickfireNext: Pickfire
Message 2 of 7 in “Microproject | Add more builtin patterns for userdiff”
  1. PickfireMar 28, 2017
  2. Jacob KellerMar 28, 2017
  3. PickfireMar 28, 2017
  4. Jacob KellerMar 28, 2017
  5. PickfireMar 29, 2017
  6. Stefan BellerMar 28, 2017
  7. PickfireMar 29, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.