Bump to 0.18.2. Move starship external. (#2345)

* Bump to 0.18.2. Move starship external.

* Fix failing test
This commit is contained in:
Jonathan Turner
2020-08-14 07:02:45 +12:00
committed by GitHub
parent 22519c9083
commit da4d24d082
32 changed files with 212 additions and 430 deletions

View File

@ -1,41 +1,26 @@
use crate::prelude::*;
pub fn current_branch() -> Option<String> {
if let Ok(config) = crate::data::config::config(Tag::unknown()) {
let use_starship = config
.get("use_starship")
.map(|x| x.is_true())
.unwrap_or(false);
#[cfg(feature = "git2")]
{
use git2::{Repository, RepositoryOpenFlags};
use std::ffi::OsString;
if !use_starship {
#[cfg(feature = "git2")]
{
use git2::{Repository, RepositoryOpenFlags};
use std::ffi::OsString;
let v: Vec<OsString> = vec![];
match Repository::open_ext(".", RepositoryOpenFlags::empty(), v) {
Ok(repo) => {
let r = repo.head();
match r {
Ok(r) => match r.shorthand() {
Some(s) => Some(s.to_string()),
None => None,
},
_ => None,
}
}
let v: Vec<OsString> = vec![];
match Repository::open_ext(".", RepositoryOpenFlags::empty(), v) {
Ok(repo) => {
let r = repo.head();
match r {
Ok(r) => match r.shorthand() {
Some(s) => Some(s.to_string()),
None => None,
},
_ => None,
}
}
#[cfg(not(feature = "git2"))]
{
None
}
} else {
None
_ => None,
}
} else {
}
#[cfg(not(feature = "git2"))]
{
None
}
}