mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-10-18 19:10:30 +08:00
git-metadata: Add CommitData::strip_signatures
To allow for the verification of a commit signature, the signature needs to be stripped before converting the commit data to bytes.
This commit is contained in:
committed by
Lorenz Leutgeb
parent
60871de89d
commit
58624148d4
@@ -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`.
|
||||
|
||||
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user