New blog post: https://mergiraf.org, a syntax-aware merge driver for #Git.
Supports #Java, #Rust, #Golang, #javascript, #cpp, #csharp, #html, #json, #yaml and #xml so far, and it's quite easy to add support for more thanks to #treesitter.
https://antonin.delpeuch.eu/posts/mergiraf-a-syntax-aware-merge-driver-for-git/
Get it on #Codeberg: https://codeberg.org/mergiraf/mergiraf
@pintoch Nice! I made the switch to Helix from Emacs, and the one thing I really missed was Emacs' killer Git integration (Magit magic!). I gave GitUI and LazyGit a try, both are decent, but they don't quite live up to Magit. As a diff tool, I wasn't impressed with either, so I’ve been using Meld for now. Was looking for a TUI option that could do better than those, so I’ll definitely give this a try 🙂
@triskelion thanks - but Mergiraf isn't really an alternative to those, which I would call "merge tools". Mergiraf is a "merge driver", so it changes the automated merging heuristics used by Git, not the way the results are presented to you.
@pintoch Gotcha, I don’t usually run into the need for Git merge driver or strategy in my workflow, but when I do, this may come in handy
@wilfredh it's very similar to #difftastic in spirit so I'm curious what you think of it :)
@pintoch I love it! I really enjoyed reading the manual, see the discussion of the design, and reading your comments on the HN announcement too :)
I've long wondered whether something like this was possible in principle, but I've always been intimidated by the problem. I'm super impressed by your solution.
@pintoch Were you influenced by difftastic at all? Your manual structure feels very similar to mine, and you have 'atomic_nodes' in a pretty similar fashion to difftastic :)
@pintoch I've only lightly skimmed the architecture discussion, I'm looking forward to reading it more deeply.
The only suggestion I'd make is that your home page deserves a few screenshots. The screencasts are nice but screenshots help readers decide to watch the screencast. I'm sure you have some super compelling examples that would make great screenshots.
@wilfredh thanks a lot for the kind words!
Yes, screenshots would be great, but I am not clear on how to present the effect of the tool. For difftastic it's much more direct: you see a screenshot of the diff, and that's it, you're convinced. Showing the outcome of a merge is harder. The best way I found so far is to show difftastic's output, comparing the file with conflicts and the resolved merge, but that's still pretty hard to grasp visually.
@wilfredh and yes of course difftastic was an inspiration in many ways. One big question I had recently was whether to also immitate you for the vendoring of the parsers. So far I have been trying to stick to official versions for simplicity, but I don't know how viable it is, particularly given some issues in the grammars which don't look very actively maintained either.
@wilfredh of course it feels like sticking to official versions would be a good way to mutualize work on those grammars - but I don't know how realistic it is, and perhaps we have different requirements…
@pintoch I regret vendoring using git submodules: GitHub handles them badly, and I now have a git repository that's over 1GiB. It's also contributed to Debian not packaging difftastic I think.
That said, being able to pull in parser bugfixes easily has been helpful for working with upstream.
If I did it over, I'd probably just manually vendor the parsers and write a dumb bash script to check for new versions.
@pintoch The other challenge I have is the large size of the compiled binary (over 50MiB) due to all the parsers.
Even the source tarballs are pretty big. I had to ask crates.io to increase my upload limit (they kindly said yes, I think difftastic is the biggest project on crates.io).
This also makes me less willing to accept new languages. Diffsitter uses dynamic library loading for this, which is an interesting solution.
@pintoch FWIW I'd write the first paragraph of the manual like this (see screenshot). Show a conflict with an obvious solution, show how to invoke mergiraf, then show the result.
Also, I've only just realised that "mergiraf" is probably supposed to be pronounced like "giraffe"? That wasn't at all obvious to me.
@pintoch I also hit a bug when trying this, filed as https://codeberg.org/mergiraf/mergiraf/issues/37 :)