Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Sixt <j6t@kdbg.org>
Cc: "Shlok Kulshreshtha" <diy2903@gmail.com>,
	"D. Ben Knoble" <ben.knoble@gmail.com>,
	"René Scharfe" <l.s.r@web.de>,
	"Eric Sunshine" <sunshine@sunshineco.com>,
	"Scott L. Burson" <Scott@sympoiesis.com>,
	git@vger.kernel.org
Subject: Re: [PATCH] userdiff: add support for Swift
Date: Sun, 19 Jul 2026 21:55:02 -0700	[thread overview]
Message-ID: <xmqqldb6i7kp.fsf@gitster.g> (raw)
In-Reply-To: <2a3a73c5-5e90-44a3-bf6a-6e98ce5e5a59@kdbg.org> (Johannes Sixt's message of "Sat, 18 Jul 2026 20:11:30 +0200")

Johannes Sixt <j6t@kdbg.org> writes:

> Am 17.07.26 um 16:02 schrieb Shlok Kulshreshtha:
>> Add a built-in userdiff driver for the Swift programming language so that
>> diff hunk headers and word diffs work out of the box for ".swift" files.
>> 
>> The funcname pattern is built for Swift's own declaration grammar: an
>> optional run of attributes ("@objc", "@available(iOS 13, *)", ...),
>> followed by an optional run of lowercase modifiers ("public", "static",
>> "final", ...), followed by a declaration keyword (func, class, struct,
>> enum, protocol, extension, actor, init, deinit, subscript). The keyword
>> is followed by a boundary that allows whitespace, "(" (init/subscript),
>> "?" or "!" (failable init), or "<" (generics), while still acting as a
>> word boundary so e.g. "initialize(" does not match.
>> 
>> The word regex recognizes Swift identifiers, hexadecimal, octal, binary,
>> integer and floating-point literals, and the language's operators.
>> 
>> Signed-off-by: Shlok Kulshreshtha <diy2903@gmail.com>
>> ---
>> This addresses the "add a userdiff driver for a language" microproject.
>
> I am mildly surprised that userdiff drivers can count as microproject.
> At a minimum, they are on the challenging side of the spectrum.

I am, too ;-)  It is hard to get them right, even though thanks to
your earlier work long time ago, writing a test that demonstrates
what is expected of the patterns is fairly easy to write.

  reply	other threads:[~2026-07-20  4:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17 14:02 [PATCH] userdiff: add support for Swift Shlok Kulshreshtha
2026-07-17 16:27 ` Junio C Hamano
2026-07-18 18:11 ` Johannes Sixt
2026-07-20  4:55   ` Junio C Hamano [this message]
2026-07-20  8:49   ` Johannes Sixt
2026-07-20  9:52   ` Shlok Kulshreshtha
2026-07-21  6:57 ` [PATCH v2] " Shlok Kulshreshtha
2026-07-21 19:33   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqldb6i7kp.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=Scott@sympoiesis.com \
    --cc=ben.knoble@gmail.com \
    --cc=diy2903@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=l.s.r@web.de \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox