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:
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)]
|
||||
|
|
|
|||
Loading…
Reference in New Issue