From c23a457e72abe608715ac76f076f47dc42af07a5 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 20:31:44 +0200 Subject: Merging upstream version 1.74.1+dfsg1. Signed-off-by: Daniel Baumann --- vendor/gix/src/object/commit.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'vendor/gix/src/object/commit.rs') diff --git a/vendor/gix/src/object/commit.rs b/vendor/gix/src/object/commit.rs index 5a9dfd4f3..1fb9eff67 100644 --- a/vendor/gix/src/object/commit.rs +++ b/vendor/gix/src/object/commit.rs @@ -1,4 +1,4 @@ -use crate::{bstr, bstr::BStr, revision, Commit, ObjectDetached, Tree}; +use crate::{bstr, bstr::BStr, Commit, ObjectDetached, Tree}; mod error { use crate::object; @@ -65,7 +65,7 @@ impl<'repo> Commit<'repo> { /// Decode the commit and obtain the time at which the commit was created. /// /// For the time at which it was authored, refer to `.decode()?.author.time`. - pub fn time(&self) -> Result { + pub fn time(&self) -> Result { Ok(self.committer()?.time) } @@ -131,12 +131,13 @@ impl<'repo> Commit<'repo> { } /// Obtain a platform for traversing ancestors of this commit. - pub fn ancestors(&self) -> revision::walk::Platform<'repo> { + pub fn ancestors(&self) -> crate::revision::walk::Platform<'repo> { self.id().ancestors() } /// Create a platform to further configure a `git describe` operation to find a name for this commit by looking /// at the closest annotated tags (by default) in its past. + #[cfg(feature = "revision")] pub fn describe(&self) -> crate::commit::describe::Platform<'repo> { crate::commit::describe::Platform { id: self.id, @@ -147,6 +148,15 @@ impl<'repo> Commit<'repo> { max_candidates: 10, } } + + /// Extracts the PGP signature and the data that was used to create the signature, or `None` if it wasn't signed. + // TODO: make it possible to verify the signature, probably by wrapping `SignedData`. It's quite some work to do it properly. + pub fn signature( + &self, + ) -> Result, gix_object::commit::SignedData<'_>)>, gix_object::decode::Error> + { + gix_object::CommitRefIter::signature(&self.data) + } } impl<'r> std::fmt::Debug for Commit<'r> { -- cgit v1.2.3