mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-10-27 15:20:33 +08:00
The logic for computing canonical references conflated the semantics of annotated and lighweight tags, yielding confusing/wrong results. The main culprit was the call to `peel_to_commit` in `impl ReadRepository for Repository`, peeling tag objects away. To resolve this, we separate out quroum computation per object type: one implementation for commits, and one for tags. Also move move canonical error types and methods into their own module to have a cleaner file structure for the main logic. Capture the `BTreeMap<Oid, u8>` type into a `Votes` struct, with its own API. We were getting the objects from the repository twice – once in `Canonical::new` and once again in `ensure_commit_or_tag` – so the latter was removed. Use an `enum CanonicalObject` to specify which object types the canonical process supports. During `converges`, separate commits and tags, and ensure that we are only looking at objects of one type. Note, that Fintan think this is actually the *wrong* place to do it because we already filter the objects – so we should keep track of that information higher up the callstack. Co-authored-by: Fintan Halpenny <fintan.halpenny@gmail.com>
914 B
914 B
$ rad id update --title "Add Bob" --delegate did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji -q
c036c0d89ce26aef3ad7da402157dba16b5163b4
$ rad sync --fetch
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s).
✓ Target met: 1 seed(s)
🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
$ git commit -m "New changes" --allow-empty -q
$ git push rad master -o no-sync
$ git commit --amend -m "Neue Änderungen" --allow-empty -q
$ git push rad master -f
✓ Canonical reference refs/heads/master updated to target commit 9170c8795d3a78f0381a0ffafb20ea69fb0f5b6b
✓ Synced with 1 seed(s)
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
+ fb25886...9170c87 master -> master (forced update)