Skip to content

Commit

Permalink
current_branch_name() refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
demidko committed Mar 28, 2024
1 parent 2fe1622 commit 9da6c75
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/mygit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ impl MyGit {
pub fn current_branch_name(&self) -> String {
let repo = &self.repo;
let head = repo.head().unwrap();
let name = head.name().unwrap();
let name = name.trim_start_matches("refs/heads/");
let name = head.shorthand().unwrap();
name.to_string()
}

Expand Down

0 comments on commit 9da6c75

Please sign in to comment.