News for hackers. Stuff that matters.
Re:Anu: A sound, distributed version control systema by consultutah on Thursday November 05, 2020 @04:06PM (#25001980)
I’m excited to see there is still work being done on new VCS. Git will be hard to beat, but it looks like Anu is hitting on some of its weak points.
Re:Anu: A sound, distributed version control systema by alquemist on Thursday November 05, 2020 @04:26PM (#25002159)
What are those weak points and how does Anu fix them? I found a technical example in https://anu.dev/documentation/associativity.html, but it was unconvincing. In their example, three way merge should produce a conflict for a human to resolve it. Which is good, we don't want a 'smart' tool to do the wrong thing and silently introduce bugs. If the argument is that pijul/anu reduce the number of conflicts by exploiting history, is there a quantization of this benefit for practical workloads, e.g. popular git repos?
Re:Anu: A sound, distributed version control systema by andolanra on Thursday November 05, 2020 @05:15PM (#25002666)
That example, while technically correct, is a little bit misleading. From a practical point of view, the thing that Pijul/Anu both do is not "automatically resolve conflicts" but rather "allow repo operations to happen even in the presence of conflicts". In Git, if you've got a conflict, Git will require you to fix it before doing anything else. In Pijul or Anu, you can continue applying changes—possibly creating more conflicts!—in a way that's guaranteed to never throw away changes. At the end of that, a human still needs to resolve those merges manually.

But there are scenarios in which this avoids tedious human merges. Consider that I'm applying a series of patches which make changes in a file and later on walk those changes back, and run into a merge conflict there. In Git, I could squash those changes to avoid dealing with the conflict, but then I've lost history. I could apply the changes, skipping the relevant patches, but if those patches still contained useful work elsewhere, then I'd have to go in and resolve those problems manually.

In contrast, this same scenario in Pijul and Anu would just trivially work in a way that didn't produce conflicts. I would apply the sequence of patches, and one patch would produce a conflict… but because they can keep doing work in the presence of conflicts, then they could keep applying subsequent patches and apply the patches which walk back the changes, and in that resolve the conflict automatically, but unlike the Git approach where I flattened the changes first, I would still have the full commit history associated with that sequence.

Now, that doesn't mean that Pijul or Anu will automatically fix all merges. If you have two separate code edits to reconcile, you might still need a human in the loop to reconcile them. But the fact that they can keep making changes in the presence of conflicts allows them to avoid a certain kind of "busywork" that comes with managing git history.

Re:Anu: A sound, distributed version control systema by apostacy on Thursday November 05, 2020 @07:16PM (#25003563)
> That example, while technically correct, is a little bit misleading. From a practical point of view, the thing that Pijul/Anu both do is not "automatically resolve conflicts" but rather "allow repo operations to happen even in the presence of conflicts". In Git, if you've got a conflict, Git will require you to fix it before doing anything else. In Pijul or Anu, you can continue applying changes—possibly creating more conflicts!—in a way that's guaranteed to never throw away changes. At the end of that, a human still needs to resolve those merges manually.

I don't think it is really true that git requires you to fix conflicts before continuing. There are strategies that can let you emulate deferred merging. I rarely let merging hold me back.

If I don't have time to merge into master, just do git push server master:synced/master.

Re:Anu: A sound, distributed version control systema by ricardobeat on Friday November 06, 2020 @06:05AM (#25006738)
Git requires you to fix conflicts to continue in that branch, as commits will not have been applied until you resolve them. You can work around that, but the longer you postpone the harder it becomes to resolve them, and the result will depend on the order you decide to merge / rebase everything.
Re:Anu: A sound, distributed version control systema by merijnv on Friday November 06, 2020 @08:12AM (#25007348)
Lemme give you one example of one workflow I've encountered a bunch of times that's super annoying with git.

I port/test a project to a new OS. I run into a bunch of issues, like linkers, environments, etc. that are broken that I need to fix. I try and make clean commits tackling one issue at a time, so we get 1 commit for the linker issues, 1 for the docs, 1 for the environment, etc. eventually I have 5 commits of fixes.

These fixes are all orthogonal, so ideally I want to make separate PRs and separate reviews for them. But locally they're all tied together (in chronological order), since I need all of them there to continue development.

In git I can either open 1 big PR including all fixes at once (annoying) or I can make a PR for one commit, wait until it's merged, then PR the next, etc. The only way to get them nicely separate is if I take all those 5 commits, rebase each of them onto master in its own branch and PR those 5 branches. But that ruins my ability to work locally.

The associativity of (non-conflicting) patches in a patch based VCS like Anu/Pijul means that this "ordering" of patches doesn't exist. I have 5 patches you don't, I can PR each of them independently without needing to manipulate history or anything, because fundamentally the patches aren't related and therefore there's no reason for an ordering like the git DAG forces upon you.

Of course this is a fairly niche (but hopefully concrete enough) example of how this enforced ordering of commits can actively harm workflows/collaboration.

Re:Anu: A sound, distributed version control systema by gnufx on Friday November 06, 2020 @05:10PM (#25011647)
Yes, except that I don't think that's niche. With darcs, I have a collection of patches available from developments/contributions, and a release is a set I'm happy with on top of the previous release tag. If one of them causes trouble during testing, it can typically just be removed from the set. (Obviously it doesn't always work that cleanly, but it typically does.) When happy, tag and release. It's a pleasant model that's straightforward enough for someone who's only been maintaining large projects since the early days of networked CVS.
Re:Anu: A sound, distributed version control systema by rvdginste on Saturday November 07, 2020 @12:33AM (#25013380)
Personally, with git, I would work on one "work" branch with the 5 orthogonal commits in succession. For each commit that is finished, I would create a new branch and cherry-pick that specific commit on it. I would create a PR for those branches.

Once the PR (possibly with some changes still) is approved and merged, I would rebase my "work" branch on top of the updated master. Since it was an orthogonal commit, you'll typically see that the merged work just disappears from your branch during the rebase. If it really was orthogonal work, you'll not have any conflicts.

This is an approach I've used whenever I need to work on something that depends on other work that was not merged yet. You have a work branch that includes all the work, since you depend on it, but you want to offer smaller pieces as PR to make the review process more efficient.

Re:Anu: A sound, distributed version control systema by rmtech on Tuesday November 17, 2020 @06:22PM (#25131244)
Yeah I think this is actually pretty important. I wonder whether associativity of unrelated changes generalizes to other git problems?
Re:Anu: A sound, distributed version control systema by alquemist on Friday November 06, 2020 @10:18AM (#25008176)
Thanks for the example. History manipulation is a nono. While I'm not a git/diff3 expert, could one say 'make patch K from commit triple K0,K1,K2', meaning 'all changes between commits K1 and K2, with respect to origin K0', then make independent PRs out of them? Maybe will be only 95% correct, but that's what tests are for.
Re:Anu: A sound, distributed version control systema by cutemonster on Wednesday November 11, 2020 @02:25PM (#25061878)
> History manipulation is a nono

(He means on his private computer)

Re:Anu: A sound, distributed version control systema by pmeunier on Friday November 06, 2020 @02:05AM (#25005619)
No, 3-way merge does not produce a conflict in that case, nor shouldn't it. Alice adds lines at the very beginning of the file, Bob adds line at the end, and 3-way-merge merges Bob's lines into Alice's new line.

That is incorrect and is not a conflict.

Re:Anu: A sound, distributed version control systema by alquemist on Friday November 06, 2020 @10:03AM (#25008052)
You are correct, thanks for the clarification. From https://www.gnu.org/software/diffutils/manual/diffutils.html...

> You can think of this as subtracting older from yours and adding the result to mine, or as merging into mine the changes that would turn older into yours.

The point stands: taking history in account is unconvincing, as it assumes intent where none is explicitly given. In the example, if the top branch had a single commit, AB => ABGAB, then there is no way to reliably infer that A 'intended' [+ABG]AB, vs. AB[+GAB]. Even with the given history, maybe the author of the top branch really intended AB => AB[+GAB], but made an error, corrected in the 2nd commit. The problem is fundamentally ambiguous. We can argue which of the diff3 or anu/pijul heuristics are better. In practice I suspect the difference is not that large.

For completeness, here's a guess of what diff3 does, assuming merging top into bottom, following https://blog.jcoglan.com/2017/05/08/merging-with-diff3.

    [bottom] => A [+X] B
    [top] => AB [+GAB]

    B    O    T

    A    A    A

    +X 

    B    B    B

              +G
              +A  
              +B
Resulting in A[+X]B[+GAB] without conflicts.
Re:Anu: A sound, distributed version control systema by pmeunier on Friday November 06, 2020 @02:05AM (#25005623)
> Which is good, we don't want a 'smart' tool to do the wrong thing and silently introduce bugs

Then that example you link means that you should stop using 3-way merge / git / svn / mercurial.

Re:Anu: A sound, distributed version control systema by alquemist on Friday November 06, 2020 @10:31AM (#25008288)
You are correct, there are no diff3 conflicts, thanks again for the clarification. The problem is fundamentally ambiguous, and the argument a bit more subtle. As a rule of thumb, when two heuristics are available, pick the simplest one (e.g. the one requiring fewer inputs), especially if a human needs to wrap their head around the rare cases where the heuristic goes wrong.
Re:Anu: A sound, distributed version control systema by IshKebab on Thursday November 05, 2020 @05:14PM (#25002662)
I agree. Also in their example they lose a nice property of git - invariance to squashing. If Alice squashes her two changes then the final merge behaves differently to if she hadn't. Very confusing!

Git definitely could be much smart about merge conflicts, but it's a hard research problem so I'm not surprised it isn't.

Re:Anu: A sound, distributed version control systema by 5d749d7da7d5 on Thursday November 05, 2020 @07:13PM (#25003540)
> Git will be hard to beat

If I were the Anu people, I would focus on having a seamless compatibility layer that could manage Git <-> Anu repositories (there are undoubtedly many headaches that would occur synchronizing the two different models). This would allow developers to silently interact with ongoing git repos using the "better" tool. Getting wholesale migration to a new platform seems a significant challenge, but allowing developers to slowly build mind share with an improved workflow would be possible.

Disclaimer: I hate git.

Re:Anu: A sound, distributed version control systema by pmeunier on Friday November 06, 2020 @02:07AM (#25005631)
`cargo install anu --version 1.0.0-alpha --features git` gives you a one-way incremental import, with the command `anu git`.
Re:Anu: A sound, distributed version control systema by jhvkjhk on Thursday November 05, 2020 @07:36PM (#25003683)
Compatible with old projects is the main reason why modern software suck, look at zsh, c++. Some times we need to shift to a brand new paradigm.
Re:Anu: A sound, distributed version control systema by HelloNurse on Friday November 06, 2020 @06:30AM (#25006868)
Git (and less popular competitors that are close in age and design principles, like Mercurial, Darcs and Fossil) is what everyone is using and therefore what needs compatibility, not an "old project" holding back progress.

That role is filled by Subversion, CVS, VSS etc. with their tragic anti-features.

Re:Anu: A sound, distributed version control systema by gnufx on Friday November 06, 2020 @05:20AM (#25006551)
For what it's worth, darcs can consume and produce git import/export streams. I've synced a darcs repo with git and mercurial mirrors with cron (to avoid slowing down commits by doing it in a hook).
Re:Anu: A sound, distributed version control systema by minerjoe on Thursday November 05, 2020 @04:24PM (#25002135)
> Git will be hard to beat.

With the latest kurfuffle at Github, I've started moving to fossil. Having everything, wiki, pull requests, etc. as part of the repo is looking like a good move.

Why let yet another corporation have control over something they should have never been given?

https://fossil-scm.org

Re:Anu: A sound, distributed version control systema by andrewzah on Thursday November 05, 2020 @04:33PM (#25002229)
github != git ... I'm not sure why people strongly conflate these two so much.

It would be equally as valid to self-host gitea/gogs/sourcehut/gitlab and/or an issue tracker of your choice, which arguably is preferable to adopting a completely different tool over what is a provider issue.

Re:Anu: A sound, distributed version control systema by dan-robertson on Thursday November 05, 2020 @05:48PM (#25002939)
I think all git has going for it is its existing inertia and GitHub. I think the foundations were a bigger deal when git was newer. Other DVCSes have decent foundations.

Going against git is an atrocious user interface (if it were good then [1] would be neither funny nor sad). Most people just memorise a few commands and if they stop working they transfer their changes elsewhere, delete the repo, and start again. Sometimes a team will have a “git expert” who has merely memorised a few more commands and is better able to get a repo out of a broken state. Git fails badly at an important for a developer tool: largely getting out of the way.

[1] https://git-man-page-generator.lokaltog.net/

Re:Anu: A sound, distributed version control systema by dreamcompiler on Friday November 06, 2020 @12:31AM (#25005189)
The light finally came on for me when I bit the bullet and dug into git's internals. It's a beautifully simple model. Git's internals are much easier to learn than its dumpster fire UI, and once you understand the internals, the UI can be understood as something that started out reflecting the internals but then had a boatload of edge case convenience features glued on without an overall design plan.
Re:Anu: A sound, distributed version control systema by rvdginste on Saturday November 07, 2020 @12:58AM (#25013431)
This! I did the same thing: read about the model for the commits, the blobs and the hashes. When you know that (just the basic data model, which is really simple), it's a lot easier to understand and memorise the different git commands.

In fact I often work with git using the tools that come with it: git on the commandline, gitk for the visualization of the history and 'git gui' for committing work. They might look outdated, but they work really well and are really fast.

There are a lot of modern graphical tools to work with git repos, but some of them introduce their own vocabulary in an attempt to make using git 'simpler', but this just ends up making everything more confusing.

My impression is that a lot of people want powerful tools, but do not want to invest the time to learn how to handle them. The Pro Git book is available to read for free online and after reading the first 3 chapters, you should know about the most important things for day-to-day use. Some people would do anything to avoid reading the documentation: they'd rather spend a whole day checking different guis that make things look easy and familiar instead of spending that time reading the documentation.

Re:Anu: A sound, distributed version control systema by merijnv on Friday November 06, 2020 @08:14AM (#25007365)
Can you enlighten me how git's internal model is more beautiful than, say, Mercurial? Which has the added bonus of having a UI which isn't a dumpster fire...
Re:Anu: A sound, distributed version control systema by dreamcompiler on Friday November 06, 2020 @12:00PM (#25009094)
I haven't studied Hg's internals. I much prefer Hg to git (because its UI makes sense) but I no longer have the happy option of using it. So rather than continue to fight a battle that was already lost, I decided to embrace git.
Re:Anu: A sound, distributed version control systema by merijnv on Monday November 09, 2020 @05:32AM (#25033334)
For what it's worth, I've been using Mercurial + hg-git to interact with git repos since 2010 and I still do with all my git and github using colleagues.
Re:Anu: A sound, distributed version control systema by reificator on Thursday November 05, 2020 @05:56PM (#25003009)
You'll never hear me say that git's interface is good, but this seems to be blowing things way out of proportion. I haven't seen someone blow up and recreate a git repo in maybe a decade.

I've definitely pulled out the BFG here and there to clean up credentials but that's an issue in any VCS.

Maybe I'm biased because I'm "better able to get a repo out of a broken state", but for the record it's definitely not because I've "memorised a few more commands".

Re:Anu: A sound, distributed version control systema by theon144 on Thursday November 05, 2020 @06:25PM (#25003237)
Your attitude seems to mirror this xkcd https://xkcd.com/1597/ and I honestly never understood it.

I'm by no means a git expert (I've actually just recently learned about bisect for instance), but I have never in my entire career been in a state where I'd just delete the repo and recreate it from scratch.

I've only ever used a handful of commands, the most advanced of which could be probably considered `reflog` when I wanted to revert some changes; or `rebase` (because strictly speaking, it is more complex than merge I guess), but I never ran a command I did not understand or had to memorize.

I actually do share the sentiment about the tool getting out of your way, and my knee-jerk reaction to learning about git internals is just repulsion, because you're right! I'm not there to tinker around with version control, I'm there to solve problems. That said, I've never felt like Git got in my way.

Re:Anu: A sound, distributed version control systema by andrewzah on Friday November 06, 2020 @04:40PM (#25011448)
I find the vast majority of complaints come from people who refuse to put any time into learning a mildly complex tool, and thus I have no sympathy for them. The documentation is right there in your terminal, in addition to many websites, videos, and books.

The one and only time I messed up a repo beyond repair was when I deleted some git pack files while trying to delete some binary files from the git history. This is known as user error.

In my day to day use I find that I rarely have to venture beyond rebase, bisect, reflog, cherry-pick, and the standard commands.

Re:Anu: A sound, distributed version control systema by sterlind on Thursday November 05, 2020 @11:48PM (#25005002)
I nearly did once, because I couldn't stage a file. Git's content-hash store had gotten corrupted, so the object for the staged blob had a bunch of zeros in it and didn't match its sha. That was more the filesystem's fault than Git's, though.
Re:Anu: A sound, distributed version control systema by reificator on Thursday November 05, 2020 @04:43PM (#25002335)
While that's a common conflation I don't think the GP was doing that. While I tend to self-host git, I can see the value they're claiming fossil has.

Whether self-hosted git or hosting on Github, your issue trackers and such are typically separate from your main repository. Most platforms offer wikis as a side-by-side repository so that should be easy to move, but the rest is at the whims of the platform.

The GP is claiming they moved to fossil because the one repository contains all of this data.

Re:Anu: A sound, distributed version control systema by wtracy on Thursday November 05, 2020 @04:46PM (#25002374)
I think minerjoe is trying to emphasize that fossil has all the features of GitHub included in the VCS itself, eliminating the need for any of the tools you listed above.

I haven't followed Fossil, so hearing that it includes things like a wiki is news to me.

Re:Anu: A sound, distributed version control systema by badsectoracula on Thursday November 05, 2020 @11:10PM (#25004813)
minerjoe is mentioning Fossil specifically because unlike Git it also provides the features (in a broad sense) that GitHub provides (wiki, bug tracker, discussion forum, news/blog, "released" files and of course version control) while remaining fully distributed - these are stored and versioned as part of the repository itself.

As a nice bonus Fossil is a single executable/binary file you can drop anywhere and can act as both the CLI for working with the repository and as the web backend with a bunch of ways to access it including CGI, it's own web server or even as a fake script parser (you can upload the linux binary to any shared host that supports custom script parsers -many do- and use a "script" with a shebang that calls the binary with the path to the repository file, thus allowing you to use Fossil with shared hosting services that do not even know about it).

Re:Anu: A sound, distributed version control systema by swiley on Friday November 06, 2020 @08:54AM (#25007589)
>Why let yet another corporation have control over something they should have never been given?

I'm pretty sure github doesn't control git.

Re:Anu: A sound, distributed version control systema by minerjoe on Friday November 06, 2020 @01:11PM (#25009747)
That's not what I was implying. They have control over the pull-requests, the wiki, and all the other meta information.