From f176f894daa2ef723248b32807a234c26b718a24 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Mon, 3 Mar 2008 17:53:55 +0100 Subject: Show abbreviated commit-id instead of "(no branch)" in prompt. --- 01_Functions.zsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 () -- cgit v1.2.3