<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/userdiff.c, branch gitk-resize-error</title>
<subtitle>Fork of git SCM with my patches.</subtitle>
<id>http://git.kilabit.info/git/atom?h=gitk-resize-error</id>
<link rel='self' href='http://git.kilabit.info/git/atom?h=gitk-resize-error'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/'/>
<updated>2021-10-25T15:47:44Z</updated>
<entry>
<title>userdiff-cpp: back out the digit-separators in numbers</title>
<updated>2021-10-25T15:47:44Z</updated>
<author>
<name>Johannes Sixt</name>
<email>j6t@kdbg.org</email>
</author>
<published>2021-10-24T09:56:43Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=386076ec92c702104cb15bc23e4521dac10c7c2d'/>
<id>urn:sha1:386076ec92c702104cb15bc23e4521dac10c7c2d</id>
<content type='text'>
The implementation of digit-separating single-quotes introduced a
note-worthy regression: the change of a character literal with a
digit would splice the digit and the closing single-quote. For
example, the change from 'a' to '2' is now tokenized as
'[-a'-]{+2'+} instead of '[-a-]{+2+}'.

The options to fix the regression are:

- Tighten the regular expression such that the single-quote can only
  occur between digits (that would match the official syntax).

- Remove support for digit separators.

I chose to remove support, because

- I have not seen a lot of code make use of digit separators.

- If code does use digit separators, then the numbers are typically
  long. If a change in one of the segments occurs, it is actually
  better visible if only that segment is highlighted as the word
  that changed instead of the whole long number.

This choice does introduce another minor regression, though, which
is highlighted in the test case: when a change occurs in the second
or later segment of a hexadecimal number where the segment begins
with a digit, but also has letters, the segment is mistaken as
consisting of a number and an identifier. I can live with that.

Signed-off-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>userdiff-cpp: learn the C++ spaceship operator</title>
<updated>2021-10-10T22:24:21Z</updated>
<author>
<name>Johannes Sixt</name>
<email>j6t@kdbg.org</email>
</author>
<published>2021-10-10T17:03:04Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=c4fdba338355d80e40b84391af9f8c022d4f21af'/>
<id>urn:sha1:c4fdba338355d80e40b84391af9f8c022d4f21af</id>
<content type='text'>
Since C++20, the language has a generalized comparison operator &lt;=&gt;.
Teach the cpp driver not to separate it into &lt;= and &gt; tokens.

Signed-off-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>userdiff-cpp: permit the digit-separating single-quote in numbers</title>
<updated>2021-10-10T22:24:21Z</updated>
<author>
<name>Johannes Sixt</name>
<email>j6t@kdbg.org</email>
</author>
<published>2021-10-10T17:03:03Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=637b80cd6a2a73eb6723aec2f52aed1135d99de4'/>
<id>urn:sha1:637b80cd6a2a73eb6723aec2f52aed1135d99de4</id>
<content type='text'>
Since C++17, the single-quote can be used as digit separator:

   3.141'592'654
   1'000'000
   0xdead'beaf

Make it known to the word regex of the cpp driver, so that numbers are
not split into separate tokens at the single-quotes.

Signed-off-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>userdiff-cpp: tighten word regex</title>
<updated>2021-10-08T20:04:07Z</updated>
<author>
<name>Johannes Sixt</name>
<email>j6t@kdbg.org</email>
</author>
<published>2021-10-08T19:09:55Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=350b87cd658553598a269fdd320ca05ee4789a10'/>
<id>urn:sha1:350b87cd658553598a269fdd320ca05ee4789a10</id>
<content type='text'>
Generally, word regex can be written such that they match tokens
liberally and need not model the actual syntax because it can be assumed
that the regex will only be applied to syntactically correct text.

The regex for cpp (C/C++) is too liberal, though. It regards these
sequences as single tokens:

   1+2
   1.5-e+2+f

and the following amalgams as one token:

   .l      as in str.length
   .f      as in str.find
   .e      as in str.erase

Tighten the regex in the following way:

- Accept + and - only in one position in the exponent. + and - are no
  longer regarded as the sign of a number and are treated by the
  catcher-all that is not visible in the driver's regex.

- Accept a leading decimal point only when it is followed by a digit.

For readability, factor hex- and binary numbers into an own term.

As a drive-by, this fixes that floating point numbers such as 12E5
(with upper-case E) were split into two tokens.

Signed-off-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'uk/userdiff-php-enum'</title>
<updated>2021-09-10T18:46:27Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-09-10T18:46:27Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=6dbe1b4ee21bb52b2069fc0330915483ec020386'/>
<id>urn:sha1:6dbe1b4ee21bb52b2069fc0330915483ec020386</id>
<content type='text'>
Update the userdiff pattern for PHP.

* uk/userdiff-php-enum:
  userdiff: support enum keyword in PHP hunk header
</content>
</entry>
<entry>
<title>userdiff: support enum keyword in PHP hunk header</title>
<updated>2021-08-31T19:13:36Z</updated>
<author>
<name>USAMI Kenta</name>
<email>tadsan@zonu.me</email>
</author>
<published>2021-08-31T06:01:25Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=2c7f3aacd31b564beca3a3d93a98f4efded6af58'/>
<id>urn:sha1:2c7f3aacd31b564beca3a3d93a98f4efded6af58</id>
<content type='text'>
"enum" keyword will be introduced in PHP 8.1.
https://wiki.php.net/rfc/enumerations

Signed-off-by: USAMI Kenta &lt;tadsan@zonu.me&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'th/userdiff-more-java'</title>
<updated>2021-08-30T23:06:05Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-08-30T23:06:05Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=a8960868518aaee85da308f394503dada14bfcbc'/>
<id>urn:sha1:a8960868518aaee85da308f394503dada14bfcbc</id>
<content type='text'>
The userdiff pattern for "java" language has been updated.

* th/userdiff-more-java:
  userdiff: improve java hunk header regex
</content>
</entry>
<entry>
<title>Merge branch 'jc/userdiff-pattern-hint'</title>
<updated>2021-08-30T23:06:03Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-08-30T23:06:03Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=e1eb13347610bd5b062377f2e8d7f807c6e89d07'/>
<id>urn:sha1:e1eb13347610bd5b062377f2e8d7f807c6e89d07</id>
<content type='text'>
Remind developers that the userdiff patterns should be kept simple
and permissive, assuming that the contents they apply are always
syntactically correct.

* jc/userdiff-pattern-hint:
  userdiff: comment on the builtin patterns
</content>
</entry>
<entry>
<title>userdiff: improve java hunk header regex</title>
<updated>2021-08-11T18:11:30Z</updated>
<author>
<name>Tassilo Horn</name>
<email>tsdh@gnu.org</email>
</author>
<published>2021-08-11T17:51:04Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=a8cbc895893f4c244e54374d3bf937819fb6e2e9'/>
<id>urn:sha1:a8cbc895893f4c244e54374d3bf937819fb6e2e9</id>
<content type='text'>
Currently, the git diff hunk headers show the wrong method signature if the
method has a qualified return type, an array return type, or a generic return
type because the regex doesn't allow dots (.), [], or &lt; and &gt; in the return
type.  Also, type parameter declarations couldn't be matched.

Add several t4018 tests asserting the right hunk headers for different cases:

  - enum constant change
  - change in generic method with bounded type parameters
  - change in generic method with wildcard
  - field change in a nested class

Signed-off-by: Tassilo Horn &lt;tsdh@gnu.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>userdiff: comment on the builtin patterns</title>
<updated>2021-08-11T18:02:59Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-08-10T22:12:01Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=b6029b3279ef5997796de99ce9319a5f1499df21'/>
<id>urn:sha1:b6029b3279ef5997796de99ce9319a5f1499df21</id>
<content type='text'>
Remind developers that they do not need to go overboard to implement
patterns to prepare for invalid constructs.  They only have to be
sufficiently permissive, assuming that the payload is syntactically
correct, and that may allow them to be simpler.

Text stolen mostly from, and further improved by, Johannes Sixt.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
