From 4ebb0164d2e15645866de50b3b1f024729e37831 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Fri, 17 Oct 2008 14:46:15 +0200 Subject: Adds a "Rebasing" info in git-rev. --- 01_Functions.zsh | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/01_Functions.zsh b/01_Functions.zsh index 75be2a3..b5b0fce 100644 --- a/01_Functions.zsh +++ b/01_Functions.zsh @@ -57,28 +57,27 @@ preprint() get_git_branch () { - local my_git_branch + local my_git_branch REBASE [ "$( ( git-ls-tree HEAD . 2>&- ; git-ls-files . 2>&- ) | head -n 1)" == "" ] && return + # Rebase in progress ? + REBASE=""; + [ -e $(git-rev-parse --git-dir)/../.dotest/rebasing ] && REBASE="rebase:" + # Get current working GIT branch - my_git_branch="$(git-branch 2>&- | grep -E '^\* ' | cut -c3-)" + my_git_branch="$REBASE$(git-branch 2>&- | grep -E '^\* ' | cut -c3-)" - if [ "$my_git_branch" != "" ] + if [ "$my_git_branch" != "$REBASE" ] then # If not on a working GIT branch, get the named current commit-ish inside parenthesis - [ "$my_git_branch" == "(no branch)" ] &&\ - my_git_branch="($(git-name-rev HEAD 2>&- | awk '{ print $2 }' | sed 's,^tags/,,;s,^remotes/,,'))" + [ "$my_git_branch" == "$REBASE(no branch)" ] &&\ + my_git_branch="($REBASE$(git-name-rev HEAD 2>&- | awk '{ print $2 }' | sed 's,^tags/,,;s,^remotes/,,'))" # If neither on a named commit-ish, show commit-id - if [ "$my_git_branch" == "(undefined)" ] + if [ "$my_git_branch" == "(${REBASE}undefined)" ] then - if [ -e $(git-rev-parse --git-dir)/.dotest-merge/git-rebase-todo ] - then - my_git_branch="(rebase: $(git-rev-parse HEAD 2>&-))" - else - my_git_branch="($(git-rev-parse HEAD 2>&-))" - fi + my_git_branch="($REBASE$(git-rev-parse HEAD 2>&-))" fi fi -- cgit v1.2.3