[][src]Struct clgit::commit::Commit

pub struct Commit {
    pub hash: Hash,
    pub tree: Hash,
    pub parents: Vec<Hash>,
    // some fields omitted
}

A parsed git commit

Example

// The initial commit of this project's git repository
let repository  = Repository::from_path(".").unwrap();
let hcommit     = commit::Hash::from_str("02c4f0499bcf979ad86d9ef5b61ffc51b1394bef").unwrap();
let htree       = tree  ::Hash::from_str("88824f5315abd219d2f6f5f68fe69f32386ffc00").unwrap();

let commit = Commit::read(&repository, &hcommit).unwrap();
assert_eq!(commit.hash, hcommit);
assert_eq!(commit.tree, htree);
assert_eq!(commit.parents.len(), 0); // initial commit

Fields

hash: Hash

The Hash representing this Commit

tree: Hash

The Hash referencing the root directory / Tree of this Commit

parents: Vec<Hash>

The Hashes of the 0 or more parent Commits of this Commit

Initial Commits have 0 parents. Merge Commits have multiple parents. Vanilla boring Commits have 1 parent, the previous commit.

Implementations

impl Commit[src]

pub fn read(repository: &Repository, hash: &Hash) -> Result<Self>[src]

Read a local Commit from a given Repository

Auto Trait Implementations

impl RefUnwindSafe for Commit

impl Send for Commit

impl Sync for Commit

impl Unpin for Commit

impl UnwindSafe for Commit

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.