gps 7.3.3

Official CLI & library for Git Patch Stack
Documentation
1
2
3
4
5
6
7
8
9
use git2;

pub fn get_current_branch(repo: &git2::Repository) -> Option<String> {
    // https://stackoverflow.com/questions/12132862/how-do-i-get-the-name-of-the-current-branch-in-libgit2
    match repo.head() {
        Ok(head_ref) => return head_ref.name().map(String::from),
        Err(_) => None,
    }
}