mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-11-11 14:10:35 +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>
794 B
794 B
Let's start by creating a draft patch.
$ git checkout -b feature/1 -q
$ git commit --allow-empty -q -m "First change"
$ git push -o patch.draft rad HEAD:refs/patches
✓ Patch 8dfb4dcafc4346158c8160410dd3f2b0616ad4fe drafted
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
* [new reference] HEAD -> refs/patches
$ git checkout master -q
$ git merge feature/1
$ git push rad master
✓ Patch 8dfb4dcafc4346158c8160410dd3f2b0616ad4fe merged
✓ Canonical reference refs/heads/master updated to target commit 20aa5dde6210796c3a2f04079b42316a31d02689
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
f2de534..20aa5dd master -> master