diff --git a/crates/radicle-git-metadata/src/commit.rs b/crates/radicle-git-metadata/src/commit.rs index e33a21a5..7d64a1d0 100644 --- a/crates/radicle-git-metadata/src/commit.rs +++ b/crates/radicle-git-metadata/src/commit.rs @@ -85,6 +85,11 @@ impl CommitData { 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`. diff --git a/crates/radicle-git-metadata/src/commit/headers.rs b/crates/radicle-git-metadata/src/commit/headers.rs index 9dc5c7d2..def1c659 100644 --- a/crates/radicle-git-metadata/src/commit/headers.rs +++ b/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)]