From cbd65134a8afb2b1fc28419fd95f257287f81e89 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Wed, 7 Aug 2013 15:43:20 +0200 Subject: [Git] Updates… MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- net:foret/Prompts.zsh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'net:foret') 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 + +} -- cgit v1.2.3