mirror of
https://github.com/nushell/nushell.git
synced 2025-07-12 12:26:05 +02:00
Find the repo even in a subdir
This commit is contained in:
@ -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 {
|
||||||
|
Reference in New Issue
Block a user