pub struct Commit<'repo> {
pub id: ObjectId,
pub data: Vec<u8>,
/* private fields */
}
Expand description
A decoded commit object with access to its owning repository.
Fields§
§id: ObjectId
The id of the commit
data: Vec<u8>
The fully decoded commit data
Implementations§
source§impl<'repo> Commit<'repo>
impl<'repo> Commit<'repo>
sourcepub fn detached(&self) -> ObjectDetached
pub fn detached(&self) -> ObjectDetached
Create an owned instance of this object, copying our data in the process.
sourcepub fn detach(self) -> ObjectDetached
pub fn detach(self) -> ObjectDetached
Sever the connection to the Repository
and turn this instance into a standalone object.
source§impl<'repo> Commit<'repo>
impl<'repo> Commit<'repo>
sourcepub fn short_id(&self) -> Result<Prefix, Error>
pub fn short_id(&self) -> Result<Prefix, Error>
Turn this objects id into a shortened id with a length in hex as configured by core.abbrev
.
sourcepub fn message(&self) -> Result<MessageRef<'_>, Error>
pub fn message(&self) -> Result<MessageRef<'_>, Error>
Parse the commits message into a MessageRef
sourcepub fn message_raw(&self) -> Result<&BStr, Error>
pub fn message_raw(&self) -> Result<&BStr, Error>
Decode the commit object until the message and return it.
sourcepub fn message_raw_sloppy(&self) -> &BStr
pub fn message_raw_sloppy(&self) -> &BStr
Obtain the message by using intricate knowledge about the encoding, which is fastest and can’t fail at the expense of error handling.
sourcepub fn time(&self) -> Result<Time, Error>
pub fn time(&self) -> Result<Time, Error>
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
.
sourcepub fn decode(&self) -> Result<CommitRef<'_>, Error>
pub fn decode(&self) -> Result<CommitRef<'_>, Error>
Decode the entire commit object and return it for accessing all commit information.
It will allocate only if there are more than 2 parents.
Note that the returned commit object does make lookup easy and should be used for successive calls to string-ish information to avoid decoding the object more than once.
sourcepub fn iter(&self) -> CommitRefIter<'_>
pub fn iter(&self) -> CommitRefIter<'_>
Return an iterator over tokens, representing this commit piece by piece.
Return the commits author, with surrounding whitespace trimmed.
sourcepub fn committer(&self) -> Result<SignatureRef<'_>, Error>
pub fn committer(&self) -> Result<SignatureRef<'_>, Error>
Return the commits committer. with surrounding whitespace trimmed.
sourcepub fn parent_ids(&self) -> impl Iterator<Item = Id<'repo>> + '_
pub fn parent_ids(&self) -> impl Iterator<Item = Id<'repo>> + '_
Decode this commits parent ids on the fly without allocating.
sourcepub fn tree(&self) -> Result<Tree<'repo>, Error>
pub fn tree(&self) -> Result<Tree<'repo>, Error>
Parse the commit and return the tree object it points to.
sourcepub fn tree_id(&self) -> Result<Id<'repo>, Error>
pub fn tree_id(&self) -> Result<Id<'repo>, Error>
Parse the commit and return the tree id it points to.
sourcepub fn ancestors(&self) -> Platform<'repo>
pub fn ancestors(&self) -> Platform<'repo>
Obtain a platform for traversing ancestors of this commit.