From 22cf1aaafbc8c8841e2d24e6582750d7a87da8c6 Mon Sep 17 00:00:00 2001 From: Luc Didry Date: Tue, 12 Mar 2013 20:00:36 +0100 Subject: [PATCH] Issue #108 - Zsh:error in git dir if there is new files It was a problem with local declaration and assignation in the same time. Don't ask me why zsh complains, but it did. Also, I took the liberty to make a similar change en bzr part, just a precaution. --- liquidprompt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/liquidprompt b/liquidprompt index 0785fc5..4557e67 100755 --- a/liquidprompt +++ b/liquidprompt @@ -657,9 +657,11 @@ _lp_are_vcs_disabled() _lp_git_branch() { [[ "$LP_ENABLE_GIT" != 1 ]] && return - local gitdir="$(git rev-parse --git-dir 2>/dev/null)" + local gitdir + gitdir="$(git rev-parse --git-dir 2>/dev/null)" [[ $? -ne 0 || "${gitdir##*/}" != .git ]] && return - local branch="$(git symbolic-ref HEAD 2>/dev/null)" + local branch + branch="$(git symbolic-ref HEAD 2>/dev/null)" [[ $? -ne 0 || -z "$branch" ]] && return echo "${branch#refs/heads/}" } @@ -686,14 +688,16 @@ _lp_git_branch_color() git diff --cached --quiet >/dev/null 2>&1 GDC=$? - local has_untracked=$(git status 2>/dev/null | grep '\(# Untracked\)') + local has_untracked + has_untracked=$(git status 2>/dev/null | grep '\(# Untracked\)') if [[ -z "$has_untracked" ]] ; then has_untracked="" else has_untracked="$LP_COLOR_CHANGES$LP_MARK_UNTRACKED" fi - local has_stash=$(git stash list 2>/dev/null) + local has_stash + has_stash=$(git stash list 2>/dev/null) if [[ -z "$has_stash" ]] ; then has_stash="" else @@ -893,7 +897,8 @@ _lp_fossil_branch_color() _lp_bzr_branch() { [[ "$LP_ENABLE_BZR" != 1 ]] && return - local output=$(bzr nick 2> /dev/null) + local output + output=$(bzr nick 2> /dev/null) [[ $? -ne 0 ]] && return echo "$output" } @@ -908,7 +913,8 @@ _lp_bzr_branch() _lp_bzr_branch_color() { [[ "$LP_ENABLE_BZR" != 1 ]] && return - local output=$(bzr version-info --check-clean --custom --template='{branch_nick} {revno} {clean}' 2> /dev/null) + local output + output=$(bzr version-info --check-clean --custom --template='{branch_nick} {revno} {clean}' 2> /dev/null) local tuple=($output) local branch=${tuple[0]} local revno=${tuple[1]}