From 0e21e89f3a32c9967f84a3b2ace761544094e9de Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Thu, 17 Nov 2022 02:27:46 +1300 Subject: [PATCH] Speed up and simplify parse_git_branch --- lib/git/repo_index.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git/repo_index.sh b/lib/git/repo_index.sh index 4ec8dd1..fa60797 100644 --- a/lib/git/repo_index.sh +++ b/lib/git/repo_index.sh @@ -171,7 +171,7 @@ function is_git_dirty { [[ $($GIT_BINARY status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" } function parse_git_branch { - $GIT_BINARY branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1/" + git rev-parse --abbrev-ref HEAD 2> /dev/null } # If the working directory is clean, update the git repository. Otherwise, show changes.