mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-10-24 22:00:36 +08:00
The rules for checking the quorum of the remote helper, when pushing to the canonical branch, can prevent the operator from even attempting to try converge to a state of agreeance. Instead, the checking of the quorum rules are relaxed. It is still the case that if the peer is pushing a diverging commit while in a working state they are warned and the push does not go through. However, there are two cases where it is fine to force push a change: 1. When pushing a new tip, as a delegate, there is still a canonical tip and the new tip still converges with the history, i.e. it is equal to, behind, or ahead of another delegate tip. 2. If there is no quorum in the current state, for example there were multiple concurrent pushes, then the peer is free to continue to push to their default branch in attempt to converge with the other peers. The example tests ensure that these cases are covered, while also preserving the old behaviour. Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett
2.0 KiB
2.0 KiB
In this scenario, we will explore being able to rollback to a previous commit.
First we add a second delegate, Bob, to our repo. We also change the threshold to 2:
$ rad id update --title "Add Bob" --delegate did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --threshold 2 -q
069e7d58faa9a7473d27f5510d676af33282796f
Bob then syncs these changes and adds a new commit:
$ rad sync --fetch
✓ Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from z6MknSL…StBU8Vi..
✓ Fetched repository from 1 seed(s)
$ git commit -m "Third commit" --allow-empty -q
$ git push rad
$ git branch -arv
alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master f2de534 Second commit
rad/master 319a7dc Third commit
Alice merges these changes and pushes them, which updates the canonical head:
$ rad remote add did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --name bob --fetch --no-sync
✓ Remote bob added
✓ Remote-tracking branch bob/master created for z6Mkt67…v4N1tRk
$ git merge bob/master
Updating f2de534..319a7dc
Fast-forward
$ git push rad
✓ Canonical head updated to 319a7dc3b195368ded4b099f8c90bbb80addccd3
✓ Synced with 1 node(s)
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
f2de534..319a7dc master -> master
Alice decides that she changes her mind about these changes and rolls back to the previous commit:
$ git reset --hard f2de534
HEAD is now at f2de534 Second commit
Since the canonical head is still decidable from this commit she is allowed to push and the new canonical head becomes the previous commit again:
$ git push rad -f
✓ Canonical head updated to f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354
✓ Synced with 1 node(s)
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
+ 319a7dc...f2de534 master -> master (forced update)