Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: don't override existing seeding scope in `rad clone`
✗ CI failure Defelo committed 3 months ago
commit 9a4bdbc4cae1c00b3b54a18c1130d80f7270f006
parent b04f487b3ae2efcd23f52f8138abe32e73a718fd
1 failed (1 total) View logs
2 files changed +14 -4
modified crates/radicle-cli/src/commands/clone.rs
@@ -9,8 +9,8 @@ use thiserror::Error;
use radicle::git::raw;
use radicle::identity::doc;
use radicle::identity::doc::RepoId;
-
use radicle::node;
use radicle::node::policy::Scope;
+
use radicle::node::{self, policy};
use radicle::node::{Handle as _, Node};
use radicle::prelude::*;
use radicle::rad;
@@ -121,6 +121,8 @@ enum CloneError {
    NoSeeds(RepoId),
    #[error("fetch: {0}")]
    Fetch(#[from] sync::FetchError),
+
    #[error("policy store: {0}")]
+
    PolicyStore(#[from] policy::store::Error),
}

struct Checkout {
@@ -203,12 +205,21 @@ impl Checkout {
fn clone(
    id: RepoId,
    directory: Option<PathBuf>,
-
    scope: Scope,
+
    scope: Option<Scope>,
    settings: SyncSettings,
    node: &mut Node,
    profile: &Profile,
    bare: bool,
) -> Result<CloneResult, CloneError> {
+
    let scope = match scope {
+
        Some(scope) => scope,
+
        None => profile
+
            .policies()?
+
            .seed_policy(&id)?
+
            .scope()
+
            .unwrap_or(Scope::Followed),
+
    };
+

    // Seed repository.
    if node.seed(id, scope)? {
        term::success!(
modified crates/radicle-cli/src/commands/clone/args.rs
@@ -62,10 +62,9 @@ pub struct Args {
    /// Follow scope
    #[arg(
        long,
-
        default_value_t = Scope::Followed,
        value_parser = terminal::args::ScopeParser
    )]
-
    pub(super) scope: Scope,
+
    pub(super) scope: Option<Scope>,

    #[clap(flatten)]
    pub(super) sync: SyncArgs,