Find the repo even in a subdir

This commit is contained in:
Jonathan Turner 2019-06-02 11:38:28 +12:00
parent d6cd0df232
commit 9122042998

View File

@ -1,7 +1,9 @@
use git2::Repository; use git2::{Repository, RepositoryOpenFlags};
use std::ffi::OsString;
pub fn current_branch() -> Option<String> { pub fn current_branch() -> Option<String> {
match Repository::open(".") { let v: Vec<OsString> = vec![];
match Repository::open_ext(".", RepositoryOpenFlags::empty(), v) {
Ok(repo) => { Ok(repo) => {
let r = repo.head(); let r = repo.head();
match r { match r {