Skip to content

Commit

Permalink
feat: easy::Commit::time() to access the committers time convenient…
Browse files Browse the repository at this point in the history
…ly. (#293)
  • Loading branch information
Byron committed Feb 2, 2022
1 parent b339b41 commit 9f5663e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions git-repository/src/easy/object/commit.rs
Expand Up @@ -31,6 +31,12 @@ impl<'repo> Commit<'repo> {
pub fn message_raw(&self) -> Result<&'_ BStr, git_object::decode::Error> {
Ok(self.decode()?.message)
}
/// 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<git_actor::Time, git_object::decode::Error> {
Ok(self.decode()?.committer.time)
}

/// Decode the entire commit object and return it for accessing all commit information.
///
Expand Down

0 comments on commit 9f5663e

Please sign in to comment.