bash prompt: return early from __git_ps1() when not in a git repository

... to gain one level of indentation for the bulk of the function.

(The patch looks quite unreadable, you'd better check it with 'git
diff -w'.)

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
maint
SZEDER Gábor 2011-09-05 20:53:37 +02:00
parent e8f21caf94
commit 96ea404757
1 changed files with 107 additions and 106 deletions

View File

@ -341,7 +341,9 @@ __git_ps1 ()
#In PC mode PS1 always needs to be set
PS1="$ps1pc_start$ps1pc_end"
fi
else
return
fi

local r=""
local b=""
local step=""
@ -457,5 +459,4 @@ __git_ps1 ()
# NO color option unless in PROMPT_COMMAND mode
printf -- "$printf_format" "$c${b##refs/heads/}${f:+$z$f}$r$p"
fi
fi
}