In a sibling comment, I was wondering about projects that are trying ASTs. I haven't read deeply about it, but I recalled that [pijul][1] might be a way forward.
[1]: https://pijul.com/manual/why_pijul.html#comparisons-with-oth...
[1]: https://pijul.com/manual/why_pijul.html#comparisons-with-oth...