Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: prevent identical revision for `rad patch update`
Fintan Halpenny committed 2 years ago
commit 9f9df6264ea48cedd4588e09e0fa103a2595c5cc
parent e4f06e9c9dea7b60bd8d565a4173873c0fa0d1c4
1 file changed +7 -3
modified radicle-cli/src/commands/patch/update.rs
@@ -30,12 +30,16 @@ pub fn run(
        None => storage.backend.merge_base(*target_oid, *head_oid)?,
    };

-
    let (_, revision) = patch.latest();
-
    // N.b. we don't update if both the head and base are the same
-
    if revision.head() == head_oid && **revision.base() == base_oid {
+
    // N.b. we don't update if both the head and base are the same as
+
    // any previous revision
+
    if patch
+
        .revisions()
+
        .any(|(_, revision)| revision.head() == head_oid && **revision.base() == base_oid)
+
    {
        return Ok(());
    }

+
    let (_, revision) = patch.latest();
    let message = term::patch::get_update_message(message, workdir, revision, &head_oid)?;
    let signer = term::signer(profile)?;
    let revision = patch.update(message, base_oid, *head_oid, &signer)?;