Gerrit support for structural diff (difftastic)

130 views
Skip to first unread message

Paul Jolly

unread,
Sep 30, 2022, 1:07:25 AM9/30/22
to Repo and Gerrit Discussion
difftastic is a structural diff that understands syntax:


I would like to understand whether it would be possible for structural diff (via difftastic) support to be added to Gerrit.

I understand ~nothing about the internals of Gerrit, but did get the following response on Twitter:


Is there a way in which gerrit could shell out to difftastic for diff results?

Starting this discussion in any case in the hope that others are interested in adding structural diff (via difftastic) as a solution in Gerrit!

Thanks

Martin Fick

unread,
Oct 13, 2022, 10:48:12 AM10/13/22
to Paul Jolly, Repo and Gerrit Discussion
On 9/29/22 11:07 PM, Paul Jolly wrote:
> difftastic is a structural diff that understands syntax:
>
> https://github.com/wilfred/difftastic
>
> I would like to understand whether it would be possible for structural
> diff (via difftastic) support to be added to Gerrit.

Gerrit core implementations are in Java and difftastic is Rust, so this
is not something that would be implemented in core. It would be possible
to make the diff algorithm in core pluggable, and then someone could
potentially provide a diffstatic implementation. This would be quite a
challenge also because Gerrit doesn't perform diffs directly on files,
it operates on git blobs via the jgit APIs, so likely any other diff
implementation would also need some translation layer to work with jgit.
I think this is quite a challenge, for a result that does not likely
align well with most Gerrit maintainer's objectives, so it would take a
fairly motivated other individual/team to make this happen,

-Martin

Han-Wen Nienhuys

unread,
Oct 13, 2022, 12:57:15 PM10/13/22
to Martin Fick, Paul Jolly, Repo and Gerrit Discussion
to add to that: JGit supports multiple diff algorithms; conceivably you could add a structural diff algorithm to JGit. However, JGit is pure Java and is conservative with its dependencies. You'd likely have to reimplement difftastic in Java to start with.


--
Han-Wen Nienhuys - Google Munich
I work 80%. Don't expect answers from me on Fridays.
--

Google Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg

Geschäftsführer: Paul Manicle, Liana Sebastian

Paul Jolly

unread,
Oct 21, 2022, 8:39:00 AM10/21/22
to Han-Wen Nienhuys, Martin Fick, Repo and Gerrit Discussion
>> Gerrit core implementations are in Java and difftastic is Rust, so this
>> is not something that would be implemented in core.

...

> to add to that: JGit supports multiple diff algorithms; conceivably you could add a structural diff algorithm to JGit. However, JGit is pure Java and is conservative with its dependencies. You'd likely have to reimplement difftastic in Java to start with.

Thanks very much for your responses!
Reply all
Reply to author
Forward
0 new messages