1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-11 00:10:08 +00:00

Only calling git symbolic-ref HEAD when we are in a .git directory

This commit is contained in:
Robby Russell 2009-08-31 13:54:50 -07:00
parent 97cf1871ca
commit a26cb28de4

View file

@ -1,9 +1,8 @@
# get the name of the branch we are on
function git_prompt_info() {
if [[ -d .git ]]; then
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
branch=${ref#refs/heads/}
if [[ -d .git ]]; then
CURRENT_BRANCH="%{$fg[red]%}git:(%{$fg[green]${branch}%{$fg[red])"
else
CURRENT_BRANCH=''