diff options
author | Mike Beattie <mike.beattie@downer.co.nz> | 2018-05-28 08:22:40 +1200 |
---|---|---|
committer | Mike Beattie <mike.beattie@downer.co.nz> | 2018-05-28 08:22:40 +1200 |
commit | d1759b44906fb6f2f1dca337ff3a61cebe0e9f46 (patch) | |
tree | 070dcfd49acc29ab1cc86c205aef4cb4f747ac27 | |
parent | 6db5936c26ad7b96fb4c38b43ac68d9ad0f55f38 (diff) |
ZSH: git check: check that origin hash isn't an empty string
Signed-off-by: Mike Beattie <mike@ethernal.org>
-rw-r--r-- | .zlogin | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -9,7 +9,7 @@ function () { if command -v git >|/dev/null && git -C $HOME rev-parse >|/dev/null 2>&1 ; then local local_head="$(git -C $HOME show-ref --hash --heads master)" local origin_head="$(GIT_SSH_COMMAND="ssh -o BatchMode=yes -o ConnectTimeout=1" git -C $HOME ls-remote --heads origin master 2>|/dev/null | cut -f1)" - if [ "$local_head" != "$origin_head" ];then + if [ "$local_head" != "$origin_head" -a -n "$origin_head" ];then print "$fg[blue]--= ${fg[red]}git repository differs from origin$fg[blue] =--$terminfo[sgr0]" fi fi |