summaryrefslogtreecommitdiff
path: root/01_Functions.zsh
diff options
context:
space:
mode:
authorHugues Hiegel <hugues.hiegel@openwide.fr>2009-06-23 17:52:00 +0200
committerHugues Hiegel <hugues.hiegel@openwide.fr>2009-06-23 17:52:00 +0200
commit8af8fa8a110aa80c7570d6c13ab014c3f5ee085d (patch)
tree1094ce2b8b748d2cd385dd03d56b8cd90f5e7fb3 /01_Functions.zsh
parent1ee1dbd679c01d08b0a9db0b99080281a5471339 (diff)
[Funcs/GIT] rebasing, discards awk by using --name-only, removed (+)
Diffstat (limited to '01_Functions.zsh')
-rw-r--r--01_Functions.zsh20
1 files changed, 11 insertions, 9 deletions
diff --git a/01_Functions.zsh b/01_Functions.zsh
index 84a55e1..c0d1f2d 100644
--- a/01_Functions.zsh
+++ b/01_Functions.zsh
@@ -73,7 +73,7 @@ preprint()
get_git_branch ()
{
- local my_git_branch
+ local my_git_branch checkouted_branch="yes"
if [ ! -z "$DO_NOT_CHECK_GIT_BRANCH" ]
then
@@ -91,12 +91,13 @@ get_git_branch ()
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/,,'))"
+ checkouted_branch="" && \
+ my_git_branch="$(git-name-rev --name-only HEAD 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" = "undefined" ]
then
- my_git_branch="($(git-rev-parse --verify HEAD 2>&-))"
+ my_git_branch="$(git-rev-parse --verify HEAD 2>&-)"
fi
else
# Initial commit
@@ -132,14 +133,15 @@ get_git_branch ()
fi
# Then the result
- rebase="[rebase $current/$last: "$(git-name-rev $(cat $REBASE_DIR/onto) | awk '{ print $2 }')".."$(basename $(cat $REBASE_DIR/head-name))"]"
-
- [ $current -gt 1 ] && my_git_branch=$rebase" "$my_git_branch || my_git_branch=$rebase
+ my_git_branch="[rebase $current/$last: "$(git-name-rev --name-only $(cat $REBASE_DIR/onto))".."$my_git_branch"] "$(basename $(cat $REBASE_DIR/head-name))
+ else
+ # No rebase in progress, put '(' ')' if needed
+ [ ! "$checkouted_branch" ] && my_git_branch="($my_git_branch)"
fi
if [ "$(git-status 2>&- | grep "new file" | head -n1)" != "" ] ; then
# ADDED FILES
- my_git_branch=$my_git_branch" (+)"
+ my_git_branch=$my_git_branch
fi
echo $my_git_branch
@@ -156,7 +158,7 @@ get_git_status ()
then return
fi
- if [ "$(git-rev-parse --is-inside-git-dir)" = "true" ] ; then
+ if [ "$(git-rev-parse --is-inside-git-dir)" = "true" -o "$(git-config --get core.bare)" = "true" ] ; then
echo "$git_colors[managment_folder]"
return
fi