Trait RepositoryExt

Source
pub trait RepositoryExt {
    // Required methods
    fn branch_names(&self, branch_type: Option<BranchType>) -> Vec<String>;
    fn local_branches(&self) -> HashMap<String, Branch<'_>>;
    fn ref_dwim_local(&self, name: &str) -> Option<Reference<'_>>;
    fn current_branch_name(&self) -> Option<String>;
}
Expand description

A set of extension methods for the Repository type in git2.

Required Methods§

Source

fn branch_names(&self, branch_type: Option<BranchType>) -> Vec<String>

Gets a list of all branch names for the repository, with branch_type letting you filter by local, known remote, or all known branches.

Source

fn local_branches(&self) -> HashMap<String, Branch<'_>>

Gets a mapping of all local branches to their actual branch objects.

Source

fn ref_dwim_local(&self, name: &str) -> Option<Reference<'_>>

Do a “do what I mean” lookup on a refname - the ‘fuzzy’ sort you’re used to from the CLI. In order of priority, this becomes:

  • Symbolic names and commit hashes
  • Named refs
  • Tags by exact name
  • The HEAD of a named branch You need to exactly match one of the above, or this search will fail.
Source

fn current_branch_name(&self) -> Option<String>

Get the name of the currently checked out branch, if one is checked out.

Implementations on Foreign Types§

Source§

impl RepositoryExt for Repository

Implementors§