From 827272edc8297b13d12e1138d72f5c171b5a0f24 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Wed, 11 Aug 2010 12:06:15 -0700 Subject: [PATCH] Only alias to git status -sb on supported git version --- zsh/zshrc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/zsh/zshrc b/zsh/zshrc index 84752d4..0100877 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -247,7 +247,15 @@ alias pob='git-pull-origin-branches' alias r='git remote' alias rbi='git rebase -i' alias ra='git remote add' -alias s='git status -sb' +GIT_VERSION="$(git --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')" +GIT_VERSION_MAJOR="${GIT_VERSION%%.*}" +GIT_VERSION_MINOR="${${GIT_VERSION%.*}#*.}" +GIT_VERSION_REVISION="${GIT_VERSION##*.}" +if [ $GIT_VERSION_MINOR -ge 7 ] && [ $GIT_VERSION_REVISION -ge 1 ]; then + alias s='git status -sb' +else + alias s='git status' +fi git-branch-track-origin() { git branch --track "$1" origin/"$1" }