1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-12-26 03:27:30 +00:00

revert: fix(git_branch,git_status): implement fallback branch_n… (#1092)

This reverts commit 8d90baf0eb.
This commit is contained in:
Thomas O'Donnell 2020-04-11 22:10:39 +02:00 committed by GitHub
parent 4551a20d0e
commit 391add767f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 8 deletions

View File

@ -30,10 +30,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
};
let repo = context.get_repo().ok()?;
// bare repos don't have a branch name, so `repo.branch.as_ref` would return None,
// but git treats "master" as the default branch name
let default_branch = String::from("master");
let branch_name = repo.branch.as_ref().unwrap_or(&default_branch);
let branch_name = repo.branch.as_ref()?;
let truncated_graphemes = get_graphemes(&branch_name, len);
// The truncation symbol should only be added if we truncated
let truncated_and_symbol = if len < graphemes_len(&branch_name) {

View File

@ -23,10 +23,7 @@ use std::collections::HashMap;
/// - `✘` — A file's deletion has been added to the staging area
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let repo = context.get_repo().ok()?;
// bare repos don't have a branch name, so `repo.branch.as_ref` would return None,
// but git treats "master" as the default branch name
let default_branch = String::from("master");
let branch_name = repo.branch.as_ref().unwrap_or(&default_branch);
let branch_name = repo.branch.as_ref()?;
let repo_root = repo.root.as_ref()?;
let mut repository = Repository::open(repo_root).ok()?;