summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2008-03-03 17:53:55 +0100
committerHugues Hiegel <hugues@hiegel.fr>2008-03-07 14:15:21 +0100
commitf176f894daa2ef723248b32807a234c26b718a24 (patch)
tree4bbda2b69eabc28f89984b3ac058547c4b34b98e
parent0909b9e00e1b559a25a706d9adc824f25a76a7df (diff)
Show abbreviated commit-id instead of "(no branch)" in prompt.
-rw-r--r--01_Functions.zsh5
1 files changed, 4 insertions, 1 deletions
diff --git a/01_Functions.zsh b/01_Functions.zsh
index a4aa38a..f6b300a 100644
--- a/01_Functions.zsh
+++ b/01_Functions.zsh
@@ -39,7 +39,10 @@ preprint()
get_git_branch ()
{
- echo $(git branch 2>&- | grep -E '^\* ' | cut -c3-)
+ my_git_branch="$(git branch 2>&- | grep -E '^\* ' | cut -c3-)"
+ [ $my_git_branch == "(no branch)" ] && my_git_branch="$(git-log HEAD~1..HEAD --pretty=format:%h)"
+
+ echo $my_git_branch
}
check_git_status ()