Merge pull request #111 from ldidry/108

Issue #108 - Zsh:error in git dir if there is new files
This commit is contained in:
nojhan 2013-03-12 12:44:08 -07:00
commit f23bac5325

View File

@ -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]}