summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Hiegel <hugues.hiegel@qosmos.com>2013-08-07 15:43:20 +0200
committerHugues Hiegel <hugues.hiegel@qosmos.com>2013-08-07 15:43:20 +0200
commitcbd65134a8afb2b1fc28419fd95f257287f81e89 (patch)
tree25e8eeff68716834bf80b1a48cc515dacb2c665b
parent5cef725a76808a81e58248f79e1404ca8a7e008a (diff)
[Git] Updates…
-rw-r--r--01_Internal.zsh37
-rw-r--r--11_Colors.zsh2
-rw-r--r--12_Prompts.zsh2
-rw-r--r--net:foret/Prompts.zsh22
4 files changed, 44 insertions, 19 deletions
diff --git a/01_Internal.zsh b/01_Internal.zsh
index 4f02855..2582785 100644
--- a/01_Internal.zsh
+++ b/01_Internal.zsh
@@ -154,7 +154,7 @@ __get_git_fullstatus ()
__get_git_branch ()
{
- local my_git_branch checkouted_branch="yes"
+ local my_git_branch checkouted_branch
__debug
__debug -n " repo..."
@@ -178,7 +178,8 @@ __get_git_branch ()
# Get current working GIT branch
my_git_branch="$(git branch 2>&- | grep -E '^\* ' | cut -c3-)"
-
+ # for future use
+ checkouted_branch=$my_git_branch
if [ "$my_git_branch" != "" ]
then
@@ -190,7 +191,7 @@ __get_git_branch ()
# If neither on a named commit-ish, show commit-id
if [ "$my_git_branch" = "undefined" ]
then
- my_git_branch="$(git rev-parse --verify HEAD 2>&-)"
+ my_git_branch="$(git rev-parse --verify HEAD 2>&- | cut -c-7)…"
fi
else
# Initial commit
@@ -223,20 +224,32 @@ __get_git_branch ()
then
current=$(< $REBASE_DIR/done wc -l)
last=$(( $current + $(< $REBASE_DIR/git-rebase-todo grep -v "^#\|^[[:blank:]]*$" | wc -l) ))
- rebase=$rebase$rebase_in_progress": "
else
current=$(cat $REBASE_DIR/next)
last=$(cat $REBASE_DIR/last)
fi
- my_git_branch="[$current/$last: "$(git name-rev --name-only "$(cat $REBASE_DIR/onto 2>/dev/null)" 2>/dev/null | __cleanup_git_branch_name)".."$(echo $my_git_branch)"]"
- [ -r $REBASE_DIR/head-name ] && my_git_branch=$my_git_branch" "$(< $REBASE_DIR/head-name sed 's/^refs\///;s/^heads\///')
+ rebase="["$C_$_prompt_colors[bold_generic]$_C
+ #while [ $current -gt 0 ] ; do rebase+=$T_"a"$_T ; current=$(( $current - 1 )) ; done
+ #while [ $last -gt 0 ] ; do rebase+=$T_"|"$_T ; last=$(( $last - 1 )) ; done
+ rebase+=$current"/"$last
+ rebase+=$C_$_prompt_colors[soft_generic]$_C": "$(git name-rev --name-only "$(cat $REBASE_DIR/onto 2>/dev/null)" 2>/dev/null | __cleanup_git_branch_name)".."$my_git_branch"]"
+ [ -r $REBASE_DIR/head-name ] && rebase+=" ("$(< $REBASE_DIR/head-name sed 's/^refs\///;s/^heads\///')")"
+ my_git_branch=$rebase
else
# No rebase in progress, put '(' ')' if needed
[ ! "$checkouted_branch" ] && my_git_branch="($my_git_branch)"
fi
__debug
+ __debug -n " tracking..."
+ if [ ! "$checkouted_branch" -o ! "$(git config --get branch.$checkouted_branch.remote)" ]
+ then
+ my_git_branch+=$C_$_gcl_colors[untracked]$_C
+ my_git_branch+=" ✖"
+ fi
+ __debug
+
__debug -n " stashes..."
# Show number of stashed commits by appending '+' signs for each
if [ "$(git rev-parse --is-inside-git-dir)" != "true" -a "$(git config --get core.bare)" != "true" ]
@@ -274,11 +287,6 @@ __get_git_branch ()
[ $(($_ahead + $_behind)) -gt 0 ] && my_git_branch+=" "
- if [ $_ahead -gt 0 -a $_behind -gt 0 ]
- then
- my_git_branch+=$C_$_gcl_colors[diverged]$_C
- my_git_branch+="✖ "
- fi
if [ $_behind -gt 0 ]
then
my_git_branch+=$C_$_gcl_colors[ffwd]$_C
@@ -402,13 +410,6 @@ __get_git_branch_status ()
__debug
- __debug -n " diverged..."
- if [ $(git status . | sed -n '2{/have diverged/p;q}' | wc -l) -gt 0 ]
- then
- my_git_branch_status+=";$color[standout]"
- fi
- __debug
-
__debug -n " merges..."
if [ $(git ls-files --unmerged | wc -l) -gt 0 ]
then
diff --git a/11_Colors.zsh b/11_Colors.zsh
index dd26149..110c8c6 100644
--- a/11_Colors.zsh
+++ b/11_Colors.zsh
@@ -87,7 +87,7 @@ __set_prompt_colors ()
_gcl_colors[mixed]="$color[green];$color[bold]"
_gcl_colors[stashes]="$color[white]"
_gcl_colors[ffwd]="$color[red];$color[bold]"
- _gcl_colors[diverged]="$color[black];$color[bold]"
+ _gcl_colors[untracked]="$color[black];$color[bold]"
_guilt_colors[applied]=$_gcl_colors[cached]
_guilt_colors[unapplied]=$color[black]
diff --git a/12_Prompts.zsh b/12_Prompts.zsh
index dc6ffdc..c45aab9 100644
--- a/12_Prompts.zsh
+++ b/12_Prompts.zsh
@@ -232,7 +232,9 @@ __subvcsbranches () {
if [ -d $(dirname $GIT_DIR)/$SUBMODULE ]
then
GITBRANCH+=${GITBRANCH:+$(tput cuf1)}
+ GITBRANCH+=$C_$_prompt_colors[bar]$_C"["
GITBRANCH+=$(__get_git_fullstatus $(dirname $GIT_DIR)/$SUBMODULE)
+ GITBRANCH+=$C_$_prompt_colors[bar]$_C"]"
fi
done
echo $GITBRANCH
diff --git a/net:foret/Prompts.zsh b/net:foret/Prompts.zsh
index 8a6f2b7..fc8962c 100644
--- a/net:foret/Prompts.zsh
+++ b/net:foret/Prompts.zsh
@@ -83,3 +83,25 @@ __makeflags ()
PS1_TASKBAR+=(__makeflags __verbose_compilation __nproc_compilation)
PS1_EXTRA_INFO+=(__static_dynamic __compilation_os __compilation_arch __compilation_target)
+__subvcsbranches () {
+ local GITBRANCH
+
+ GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
+ [ "$( ( git ls-files ; git ls-tree HEAD . ) 2>&- | head -n1)" = "" -a \
+ \( ! -d .git -o -z "$GIT_DIR" \) -a \
+ "$(git rev-parse --is-inside-git-dir 2>&-)" != "true" ] && return
+
+ # Get recursive submodules statuses
+ for SUBMODULE in $(git config --get zsh.recurse-dirs)
+ do
+ if [ -d $(dirname $GIT_DIR)/$SUBMODULE ]
+ then
+ GITBRANCH+=${GITBRANCH:+$(tput cuf1)}
+ GITBRANCH+=$C_$_prompt_colors[bar]$_C"["
+ GITBRANCH+=$(__get_git_fullstatus $(dirname $GIT_DIR)/$SUBMODULE | sed 's/_for_\(ixm\|df\)/’/g')
+ GITBRANCH+=$C_$_prompt_colors[bar]$_C"]"
+ fi
+ done
+ echo $GITBRANCH
+
+}