summaryrefslogtreecommitdiff
path: root/12_Prompts.zsh
diff options
context:
space:
mode:
authorHugues Hiegel <hugues.hiegel@openwide.fr>2009-07-09 11:16:11 +0200
committerHugues Hiegel <hugues.hiegel@openwide.fr>2009-07-09 11:16:11 +0200
commitb26616140d397b756bbccb5ae295b0af6bc788dd (patch)
tree8917b61d4877fe75460337b608eda3280c4868a1 /12_Prompts.zsh
parentea88a545c99d45d467748b86d89c57cb6e44baf5 (diff)
[Prompt] better size calculation for git-rebase, and better cvs name guess
Diffstat (limited to '12_Prompts.zsh')
-rw-r--r--12_Prompts.zsh33
1 files changed, 21 insertions, 12 deletions
diff --git a/12_Prompts.zsh b/12_Prompts.zsh
index 890cee1..e350980 100644
--- a/12_Prompts.zsh
+++ b/12_Prompts.zsh
@@ -233,7 +233,7 @@ update_prompt()
[ "$DEBUG" = "yes" ] && echo -n " CVS status..."
if [ -d CVS ]
then
- CVSTAG=$(cat CVS/Tag)
+ CVSTAG=$(test -e CVS/Tag && cat CVS/Tag || basename $(cat CVS/Root 2>&- || echo "HEAD") )
CVSTAG=${CVSTAG:+ $C_$prompt_colors[up_to_date]$_C$CVSTAG}
fi
@@ -278,19 +278,28 @@ update_prompt()
if [ $spaceleft -lt $(( $PATHSIZE + $GITBRANCHSIZE )) ]
then
local unbreakablegittail
- # reduce the git-branch until it is shrinked to $minimalgitsize characters max.
-
- if [ $GITBRANCH[-1] = ")" ]
- then
- unbreakablegittail=${${(M)GITBRANCH%\~*}}
- [ "$unbreakablegittail" = "" -a $GITBRANCHSIZE -gt $minimalgitsize ] && unbreakablegittail=")"
- fi
- if [ $GITBRANCHSIZE -gt $minimalgitsize ]
+ if [ "$(echo $GITBRANCH | grep "^\[rebase ")" = "" ]
then
- GITBRANCHSIZE=$(( $spaceleft - $PATHSIZE ))
- [ $GITBRANCHSIZE -lt $minimalgitsize ] && GITBRANCHSIZE=$minimalgitsize
+ # reduce the git-branch until it is shrinked to $minimalgitsize characters max.
+
+ if [ $GITBRANCH[-1] = ")" ]
+ then
+ unbreakablegittail=${${(M)GITBRANCH%\~*}}
+ [ "$unbreakablegittail" = "" -a $GITBRANCHSIZE -gt $minimalgitsize ] && unbreakablegittail=")"
+ fi
+ if [ $GITBRANCHSIZE -gt $minimalgitsize ]
+ then
+ GITBRANCHSIZE=$(( $spaceleft - $PATHSIZE ))
+ [ $GITBRANCHSIZE -lt $minimalgitsize ] && GITBRANCHSIZE=$minimalgitsize
+ fi
+ GITBRANCH=`print -Pn "%"$(($GITBRANCHSIZE - ${#unbreakablegittail}))">..>"${GITBRANCH%\~*}${unbreakablegittail:+"%"${#unbreakablegittail}"<<"$GITBRANCH}`
+ else
+
+ #
+ # TODO : réduire la taille du hash, s'il y en a un.
+ #
+
fi
- GITBRANCH=`print -Pn "%"$(($GITBRANCHSIZE - ${#unbreakablegittail}))">..>"${GITBRANCH%\~*}${unbreakablegittail:+"%"${#unbreakablegittail}"<<"$GITBRANCH}`
fi
fi
# then we reduce the path until it reaches the last path element,