nicegit 0.0.1

A collection of common higher-level abstractions over git2.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use git2::{Branch, Commit};

/// A set of extension methods for the `Branch` type in git2.
pub trait BranchExt {
    /// Gets the `Commit` at the tip of this `Branch`.
    fn tip_commit(&self) -> Option<Commit>;
}

impl<'repo> BranchExt for Branch<'repo> {
    fn tip_commit(&self) -> Option<Commit> {
        self.get().peel_to_commit().ok()
    }
}