From ed45817b77154fd4bd03a23f39d5b92a59aef218 Mon Sep 17 00:00:00 2001 From: Nathan Stilwell Date: Fri, 29 Nov 2013 23:57:03 -0500 Subject: [PATCH] My work machine has a problem with tail --- lib/git.zsh | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index df0fcedbb..488a70648 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -8,26 +8,11 @@ function git_prompt_info() { # Checks if working tree is dirty parse_git_dirty() { - local SUBMODULE_SYNTAX='' - local GIT_STATUS='' - local CLEAN_MESSAGE='nothing to commit (working directory clean)' - if [[ "$(command git config --get oh-my-zsh.hide-status)" != "1" ]]; then - if [[ $POST_1_7_2_GIT -gt 0 ]]; then - SUBMODULE_SYNTAX="--ignore-submodules=dirty" - fi - if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then - GIT_STATUS=$(command git status -s ${SUBMODULE_SYNTAX} -uno 2> /dev/null | tail -n1) - else - GIT_STATUS=$(command git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1) - fi - if [[ -n $GIT_STATUS ]]; then - echo "$ZSH_THEME_GIT_PROMPT_DIRTY" - else - echo "$ZSH_THEME_GIT_PROMPT_CLEAN" - fi - else - echo "$ZSH_THEME_GIT_PROMPT_CLEAN" - fi + if [[ -n $(git diff ${SUBMODULE_SYNTAX} HEAD 2> /dev/null) ]]; then + echo "$ZSH_THEME_GIT_PROMPT_DIRTY" + else + echo "$ZSH_THEME_GIT_PROMPT_CLEAN" + fi } # get the difference between the local and remote branches