Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: Fix `rad patch show` with merged patches
Alexis Sellier committed 3 years ago
commit f72b448114753222985c1574461f1ee0e7062dfd
parent a9c0152a99539653819beec0b80ecae2aac4ce21
2 files changed +11 -3
modified radicle-cli/src/commands/patch/show.rs
@@ -30,9 +30,7 @@ fn show_patch_diff(patch: &patch::Patch, storage: &Repository) -> anyhow::Result
}

fn patch_commits(patch: &patch::Patch, stored: &Repository) -> anyhow::Result<Vec<term::Line>> {
-
    let target_head = patch_merge_target_oid(patch.target(), stored)?;
-
    let base_oid = stored.raw().merge_base(target_head, **patch.head())?;
-
    let range = format!("{}..{}", base_oid, patch.head());
+
    let range = format!("{}..{}", patch.base(), patch.head());

    let mut revwalk = stored.revwalk(*patch.head())?;
    let mut lines = Vec::new();
modified radicle/src/cob/patch.rs
@@ -262,6 +262,16 @@ impl Patch {
            .oid
    }

+
    /// Get the commit of the target branch on which this patch is based.
+
    /// This can change via a patch update.
+
    pub fn base(&self) -> &git::Oid {
+
        &self
+
            .latest()
+
            .map(|(_, r)| r)
+
            .expect("Patch::base: at least one revision is present")
+
            .base
+
    }
+

    /// Index of latest revision in the revisions list.
    pub fn version(&self) -> RevisionIx {
        self.revisions