[−][src]Function built::util::get_repo_head
pub fn get_repo_head(
root: &Path
) -> Result<Option<(Option<String>, String)>, Error>
Retrieves the branch name and hash of HEAD.
The returned value is a tuple of head's reference name and long hash. The
branch name will be None
if the head is detached, or it's not valid UTF-8.
If a valid git-repo can't be discovered at or above the given path,
Ok(None)
is returned instead of an Err
-value.
Errors
Errors from git2
are returned if the repository does exists at all.