diff options
author | Hugues Hiegel <hugues.hiegel@openwide.fr> | 2009-06-05 11:11:05 +0200 |
---|---|---|
committer | Hugues Hiegel <hugues.hiegel@openwide.fr> | 2009-06-05 11:11:05 +0200 |
commit | 480e555229ff44478b9b3bdc3d2eee78c9ca8130 (patch) | |
tree | da85dcbc90d383262f576348bf9673cd9eb3bc58 /01_Functions.zsh | |
parent | 8865b771cf355eb00466e9b0f501c14f9979e144 (diff) | |
parent | bcd0823d15c93d0c6ec404860bb45aa8b4e6d283 (diff) |
Merge branch 'master' of maison:/git/zdotdir
Diffstat (limited to '01_Functions.zsh')
-rw-r--r-- | 01_Functions.zsh | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/01_Functions.zsh b/01_Functions.zsh index ad4c10a..3b7a517 100644 --- a/01_Functions.zsh +++ b/01_Functions.zsh @@ -106,7 +106,17 @@ get_git_branch () fi else # Initial commit - my_git_branch="$(basename $GIT_DIR/$(cat $GIT_DIR/HEAD | sed 's/^\([0-9a-f]\{2\}\)\([0-9a-f]\{38\}\)$/objects\/\1\/\2/;s/^ref: //'))" + if [ -L $GIT_DIR/HEAD -a ! -f $GIT_DIR/HEAD ] + then + my_git_branch="$(basename $GIT_DIR/$(stat --printf="%N\n" $GIT_DIR/HEAD | tr '`' "'" | cut -d\' -f4))" + else + my_git_branch="$(basename $GIT_DIR/$(cat $GIT_DIR/HEAD | sed 's/^\([0-9a-f]\{2\}\)\([0-9a-f]\{38\}\)$/objects\/\1\/\2/;s/^ref: //'))" + fi + fi + + if [ "$(git-status 2>&- | grep "new file" | head -n1)" != "" ] ; then + # ADDED FILES + my_git_branch=$my_git_branch" (+)" fi echo $my_git_branch @@ -131,7 +141,7 @@ get_git_status () if [ "$(git-diff --cached 2>&- | grep '^diff ' | head -n1 )" != "" ] ; then cached="yes" fi - if [ "$(git-ls-files -m 2>&-)" != "" ] ; then + if [ "$(git-ls-files -m 2>&- | head -n1)" != "" ] ; then not_up_to_date="yes" fi |