cli: use Doc::canonical in rad inspect

A project may exist within storage without the local operator not
having a fork of the project.

Use Doc::canonical in rad inspect to retrieve the canonical identity
document for use during inspection.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
Fintan Halpenny 2023-04-19 11:31:09 +01:00 committed by Alexis Sellier
parent 327ebd4d2a
commit 92a14b671f
No known key found for this signature in database
1 changed files with 4 additions and 3 deletions

View File

@ -8,7 +8,7 @@ use anyhow::{anyhow, Context as _};
use chrono::prelude::*;
use json_color::{Color, Colorizer};
use radicle::crypto::Unverified;
use radicle::crypto::{Unverified, Verified};
use radicle::identity::Untrusted;
use radicle::identity::{Doc, Id};
use radicle::storage::{ReadRepository, ReadStorage};
@ -120,9 +120,10 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
let profile = ctx.profile()?;
let storage = &profile.storage;
let signer = term::signer(&profile)?;
let project = storage
.get(signer.public_key(), id)?
let repo = storage
.repository(id)
.context("No project with the given RID exists")?;
let project = Doc::<Verified>::canonical(&repo)?;
match options.target {
Target::Refs => {