cli: don't override existing seeding scope in `rad clone`

This commit is contained in:
Defelo 2026-02-23 17:37:43 +01:00 committed by Fintan Halpenny
parent b04f487b3a
commit e9245b630d
2 changed files with 14 additions and 3 deletions

View File

@ -10,6 +10,7 @@ use radicle::git::raw;
use radicle::identity::doc;
use radicle::identity::doc::RepoId;
use radicle::node;
use radicle::node::policy;
use radicle::node::policy::Scope;
use radicle::node::{Handle as _, Node};
use radicle::prelude::*;
@ -121,6 +122,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 +206,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!(

View File

@ -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,