mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-12 08:50:08 +00:00
Only calling git symbolic-ref HEAD when we are in a .git directory
This commit is contained in:
parent
97cf1871ca
commit
a26cb28de4
1 changed files with 2 additions and 3 deletions
5
git.zsh
5
git.zsh
|
@ -1,9 +1,8 @@
|
||||||
# get the name of the branch we are on
|
# get the name of the branch we are on
|
||||||
function git_prompt_info() {
|
function git_prompt_info() {
|
||||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
|
|
||||||
branch=${ref#refs/heads/}
|
|
||||||
|
|
||||||
if [[ -d .git ]]; then
|
if [[ -d .git ]]; then
|
||||||
|
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
|
||||||
|
branch=${ref#refs/heads/}
|
||||||
CURRENT_BRANCH="%{$fg[red]%}git:(%{$fg[green]${branch}%{$fg[red])"
|
CURRENT_BRANCH="%{$fg[red]%}git:(%{$fg[green]${branch}%{$fg[red])"
|
||||||
else
|
else
|
||||||
CURRENT_BRANCH=''
|
CURRENT_BRANCH=''
|
||||||
|
|
Loading…
Reference in a new issue