summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Hiegel <hugues.hiegel@qosmos.com>2013-08-07 18:12:54 +0200
committerHugues Hiegel <hugues.hiegel@qosmos.com>2013-08-07 18:12:54 +0200
commitf1dfc84848519c79dd69abbb0c425d51698c628d (patch)
treea6ac2e29203140ad3047b7ee46765d0fc9c6c03b
parent1df7b732d6c8cfebe4029c6a56b9ffee706d577f (diff)
[Git] bisect prompt
-rw-r--r--01_Internal.zsh49
-rw-r--r--11_Colors.zsh2
2 files changed, 51 insertions, 0 deletions
diff --git a/01_Internal.zsh b/01_Internal.zsh
index 8403483..4bcaacd 100644
--- a/01_Internal.zsh
+++ b/01_Internal.zsh
@@ -209,6 +209,55 @@ __get_git_branch ()
my_git_branch="→"$my_git_branch"←"
+ __debug -n " bisect..."
+ # Bisect in progress ?
+ if [ -e $GIT_DIR/BISECT_LOG ]
+ then
+ local bisect bisect_good bisect_bad bisect_start
+ # ▶ ▷ ▸ ▹ ► ▻ ◀ ◁ ◂ ◃ ◄ ◅
+
+ eval $(awk '
+ BEGIN {
+ good=""
+ bad=""
+ }
+ /^git bisect good/ { good=$4 }
+ /^git bisect bad/ { bad=$4 }
+ END {
+ print "bisect_good="good
+ print "bisect_bad="bad
+ }' $GIT_DIR/BISECT_LOG)
+
+ bisect=""
+
+ if [ "$bisect_good" ]
+ then
+ bisect_good=$(( $(git log --oneline $bisect_good..$commit_ish | wc -l) - 1))
+ bisect+="$C_$_gcl_colors[bisect-good]$_C"
+ [ $bisect_good -ge 1 ] && bisect+="₊"$(echo $bisect_good | _subscript_number)
+ bisect+="▸"
+ fi
+
+ #bisect+="→"$commit_ish"←"
+ bisect+=$my_git_branch
+
+ if [ "$bisect_bad" ]
+ then
+ bisect_bad=$(git log --oneline $commit_ish..$bisect_bad | wc -l)
+ bisect+="$C_$_gcl_colors[bisect-bad]$_C"
+ bisect+="◂"
+ [ $bisect_bad -ge 1 ] && bisect+="₊"$(echo $bisect_bad | _subscript_number)
+ fi
+
+ bisect+="$C_$_prompt_colors[soft_generic]$_C ("
+ bisect+=$C_$color[magenta]$_C$(cat $GIT_DIR/BISECT_START)
+ bisect+=$C_$_prompt_colors[soft_generic]$_C")"
+
+ echo $bisect
+ return
+ fi
+ __debug
+
__debug -n " rebase..."
# Rebase in progress ?
if [ -d $GIT_DIR/rebase-merge -o -d $GIT_DIR/rebase-apply ]
diff --git a/11_Colors.zsh b/11_Colors.zsh
index 110c8c6..0e4d293 100644
--- a/11_Colors.zsh
+++ b/11_Colors.zsh
@@ -88,6 +88,8 @@ __set_prompt_colors ()
_gcl_colors[stashes]="$color[white]"
_gcl_colors[ffwd]="$color[red];$color[bold]"
_gcl_colors[untracked]="$color[black];$color[bold]"
+ _gcl_colors[bisect-good]="$color[blue]"
+ _gcl_colors[bisect-bad]="$color[red];$color[bold]"
_guilt_colors[applied]=$_gcl_colors[cached]
_guilt_colors[unapplied]=$color[black]