Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
git-metadata: Add `CommitData::strip_signatures`
Fintan Halpenny committed 1 month ago
commit 58624148d465d0547581a27a93b9a9ada4fe9edf
parent 60871de
2 files changed +9 -0
modified crates/radicle-git-metadata/src/commit.rs
@@ -85,6 +85,11 @@ impl<Tree, Parent> CommitData<Tree, Parent> {
        self.headers.signatures()
    }

+
    pub fn strip_signatures(mut self) -> Self {
+
        self.headers.strip_signatures();
+
        self
+
    }
+

    /// The [`Headers`] found in this commit.
    ///
    /// Note: these do not include `tree`, `parent`, `author`, and `committer`.
modified crates/radicle-git-metadata/src/commit/headers.rs
@@ -70,6 +70,10 @@ impl Headers {
    pub fn push(&mut self, name: &str, value: &str) {
        self.0.push((name.to_owned(), value.trim().to_owned()));
    }
+

+
    pub(crate) fn strip_signatures(&mut self) {
+
        self.0.retain(|(key, _)| key != "gpgsig");
+
    }
}

#[derive(Debug, thiserror::Error)]