<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/t/t4034, branch master</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=master</id>
<link rel='self' href='https://git.shady.money/git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2026-04-15T15:43:33Z</updated>
<entry>
<title>userdiff: extend Scheme support to cover other Lisp dialects</title>
<updated>2026-04-15T15:43:33Z</updated>
<author>
<name>Scott L. Burson</name>
<email>Scott@sympoiesis.com</email>
</author>
<published>2026-04-15T02:27:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b79f7a3ad3ffde16b2cbc2457561669f4833f861'/>
<id>urn:sha1:b79f7a3ad3ffde16b2cbc2457561669f4833f861</id>
<content type='text'>
Common Lisp has top-level forms, such as 'defun' and 'defmacro', that
are not matched by the current Scheme pattern.  Also, it is more
common in CL, when defining user macros intended as top-level forms,
to prefix their names with "def" instead of "define"; such forms are
also not matched.  And some top-level forms don't even begin with
"def".

On the other hand, it is an established formatting convention in the
Lisp community that only top-level forms start at the left margin.  So
matching any unindented line starting with an open parenthesis is an
acceptable heuristic; false positives will be rare.

However, there are also cases where notionally top-level forms are
grouped together within some containing form.  At least in the Common
Lisp community, it is conventional to indent these by two spaces, or
sometimes one.  But matching just an open parenthesis indented by two
spaces would be too broad; so the pattern added by this commit
requires an indented form to start with "(def".  It is believed that
this strikes a good balance between potential false positives and
false negatives.

Signed-off-by: Scott L. Burson &lt;Scott@sympoiesis.com&gt;
Acked-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>userdiff: tighten word-diff test case of the scheme driver</title>
<updated>2026-04-15T15:43:33Z</updated>
<author>
<name>Johannes Sixt</name>
<email>j6t@kdbg.org</email>
</author>
<published>2026-04-15T02:27:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=955c88fbc5ac916f8dababa458a963ebbeba9b41'/>
<id>urn:sha1:955c88fbc5ac916f8dababa458a963ebbeba9b41</id>
<content type='text'>
The scheme driver separates identifiers only at parentheses of all
sorts and whitespace, except that vertical bars act as brackets that
enclose an identifier.

The test case attempts to demonstrate the vertical bars with a change
from 'some-text' to '|a greeting|'. However, this misses the goal
because the same word coloring would be applied if '|a greeting|'
were parsed as two words.

Have an identifier between vertical bars with a space in both the pre-
and the post-image and change only one side of the space to show that
the single word exists between the vertical bars.

Also add cases that change parentheses of all kinds in a sequence of
parentheses to show that they are their own word each.

Signed-off-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Scott L. Burson &lt;Scott@sympoiesis.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>userdiff: extend Bash pattern to cover more shell function forms</title>
<updated>2025-05-16T18:52:41Z</updated>
<author>
<name>Moumita Dhar</name>
<email>dhar61595@gmail.com</email>
</author>
<published>2025-05-16T14:45:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ea8a71b40d3fdc91180b951c829cdf41bb6f7da0'/>
<id>urn:sha1:ea8a71b40d3fdc91180b951c829cdf41bb6f7da0</id>
<content type='text'>
The previous function regex required explicit matching of function
bodies using `{`, `(`, `((`, or `[[`, which caused several issues:

- It failed to capture valid functions where `{` was on the next line
  due to line continuation (`\`).
- It did not recognize functions with single  command body, such as
  `x () echo hello`.

Replacing the function body matching logic with `.*$`, ensures
that everything on the function definition line is captured.

Additionally, the word regex is refined to better recognize shell
syntax, including additional parameter expansion operators and
command-line options.

Signed-off-by: Moumita Dhar &lt;dhar61595@gmail.com&gt;
Acked-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>userdiff: add builtin diff driver for kotlin language.</title>
<updated>2022-03-13T02:15:47Z</updated>
<author>
<name>Jaydeep P Das</name>
<email>jaydeepjd.8914@gmail.com</email>
</author>
<published>2022-03-12T04:48:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=09188ed930bcb08e56d1846fbf9f5cb972a2d188'/>
<id>urn:sha1:09188ed930bcb08e56d1846fbf9f5cb972a2d188</id>
<content type='text'>
The xfuncname pattern finds func/class declarations
in diffs to display as a hunk header. The word_regex
pattern finds individual tokens in Kotlin code to generate
appropriate diffs.

This patch adds xfuncname regex and word_regex for Kotlin
language.

Signed-off-by: Jaydeep P Das &lt;jaydeepjd.8914@gmail.com&gt;
Acked-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: 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='https://git.shady.money/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='https://git.shady.money/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='https://git.shady.money/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: prepare test cases with yet unsupported features</title>
<updated>2021-10-10T22:24:21Z</updated>
<author>
<name>Johannes Sixt</name>
<email>j6t@kdbg.org</email>
</author>
<published>2021-10-10T17:03:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bfaaf191a5470cb81ce327bc3b9ef9e277c9767b'/>
<id>urn:sha1:bfaaf191a5470cb81ce327bc3b9ef9e277c9767b</id>
<content type='text'>
We are going to add support for C++'s digit-separating single-quote and
the spaceship operator. By adding the test cases in this separate
commit, the effect on the word highlighting will become more obvious
as the features are implemented and the file cpp/expect is updated.

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='https://git.shady.money/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>t4034: add tests showing problematic cpp tokenizations</title>
<updated>2021-10-08T20:04:07Z</updated>
<author>
<name>Johannes Sixt</name>
<email>j6t@kdbg.org</email>
</author>
<published>2021-10-08T19:09:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3e063de46e6270606e058b96bfcc0baebc4aea81'/>
<id>urn:sha1:3e063de46e6270606e058b96bfcc0baebc4aea81</id>
<content type='text'>
The word regex is too loose and matches long streaks of characters
that should actually be separate tokens.  Add these problematic test
cases. Separate the lines with text that will remain identical in the
pre- and post-image so that the diff algorithm will not lump removals
and additions of consecutive lines together. This makes the expected
output easier to read.

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