Skip to content
Browse files

remove extraneous spaces

  • Loading branch information...
1 parent d1d5ac8 commit 2c741fc4465b45bf4759adc3e84529270ffd1ca0 Thomas Vander Stichele committed Mar 29, 2012
Showing with 19 additions and 4 deletions.
  1. +19 −4 git
View
23 git
@@ -21,13 +21,28 @@ function is_submodule() {
}
function parse_git_branch {
- ref=$(git symbolic-ref HEAD 2> /dev/null) || return
+ git show > /dev/null 2>&1 || return
+ P=
+
+ SM=
submodule=$(is_submodule)
if [[ $? -eq 0 ]]; then
- SM="s:$submodule "
+ SM="s:$submodule"
+ fi
+ P=$P${SM:+${P:+ }${SM}}
+
+ BRANCH=
+ ref=$(git symbolic-ref HEAD 2> /dev/null)
+ if [[ $? -eq 0 ]]; then
+ BRANCH="b:${ref#refs/heads/}"
fi
- DESC=" d:"$(git describe 2> /dev/null) || DESC=""
- echo "("${SM}"b:"${ref#refs/heads/}${DESC}") "
+ P=$P${BRANCH:+${P:+ }${BRANCH}}
+
+
+ DESC="d:"$(git describe 2> /dev/null) || DESC=""
+ P=$P${DESC:+${P:+ }${DESC}}
+
+ echo "(${P}) "
}
# add to prompt by adding to .bashrc somewhere:

0 comments on commit 2c741fc

Please sign in to comment.
Something went wrong with that request. Please try again.