Bypass shell aliases on the 'git' command. Closes #213
This commit is contained in:
parent
635285fbc4
commit
bf8ef5b513
22
liquidprompt
22
liquidprompt
@ -708,13 +708,13 @@ _lp_git_branch()
|
||||
{
|
||||
[[ "$LP_ENABLE_GIT" != 1 ]] && return
|
||||
local gitdir
|
||||
gitdir="$([ $(git ls-files . 2>/dev/null | wc -l) -gt 0 ] && git rev-parse --git-dir 2>/dev/null)"
|
||||
gitdir="$([ $(\git ls-files . 2>/dev/null | wc -l) -gt 0 ] && \git rev-parse --git-dir 2>/dev/null)"
|
||||
[[ $? -ne 0 || ! $gitdir =~ (.*\/)?\.git.* ]] && return
|
||||
local branch="$(git symbolic-ref HEAD 2>/dev/null)"
|
||||
local branch="$(\git symbolic-ref HEAD 2>/dev/null)"
|
||||
if [[ $? -ne 0 || -z "$branch" ]] ; then
|
||||
# In detached head state, use commit instead
|
||||
# No escape needed
|
||||
git rev-parse --short HEAD 2>/dev/null
|
||||
\git rev-parse --short HEAD 2>/dev/null
|
||||
else
|
||||
_lp_escape "${branch#refs/heads/}"
|
||||
fi
|
||||
@ -735,33 +735,33 @@ _lp_git_branch_color()
|
||||
if [[ -n "$branch" ]] ; then
|
||||
|
||||
local end="$NO_COL"
|
||||
if git status 2>/dev/null | grep -q '\(# Untracked\)'; then
|
||||
if \git status 2>/dev/null | grep -q '\(# Untracked\)'; then
|
||||
end="$LP_COLOR_CHANGES$LP_MARK_UNTRACKED$end"
|
||||
fi
|
||||
|
||||
if [[ -n "$(git stash list 2>/dev/null)" ]]; then
|
||||
if [[ -n "$(\git stash list 2>/dev/null)" ]]; then
|
||||
end="$LP_COLOR_COMMITS$LP_MARK_STASH$end"
|
||||
fi
|
||||
|
||||
local remote
|
||||
remote="$(git config --get branch.${branch}.remote 2>/dev/null)"
|
||||
remote="$(\git config --get branch.${branch}.remote 2>/dev/null)"
|
||||
|
||||
local has_commit
|
||||
has_commit=0
|
||||
if [[ -n "$remote" ]] ; then
|
||||
local remote_branch
|
||||
remote_branch="$(git config --get branch.${branch}.merge)"
|
||||
remote_branch="$(\git config --get branch.${branch}.merge)"
|
||||
if [[ -n "$remote_branch" ]] ; then
|
||||
has_commit="$(git rev-list --no-merges --count ${remote_branch/refs\/heads/refs\/remotes\/$remote}..HEAD 2>/dev/null)"
|
||||
has_commit="$(\git rev-list --no-merges --count ${remote_branch/refs\/heads/refs\/remotes\/$remote}..HEAD 2>/dev/null)"
|
||||
if [[ -z "$has_commit" ]] ; then
|
||||
has_commit=0
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
local shortstat="$(LANG=C git diff --shortstat 2>/dev/null)"
|
||||
local shortstat="$(LANG=C \git diff --shortstat 2>/dev/null)"
|
||||
if [[ -n "$shortstat" ]] ; then
|
||||
#has_lines=$(git diff --numstat 2>/dev/null | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d/-%d\n", plus, minus)}')
|
||||
#has_lines=$(\git diff --numstat 2>/dev/null | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d/-%d\n", plus, minus)}')
|
||||
local has_lines=${shortstat/*changed, /}
|
||||
has_lines=${has_lines/ inser*, /\/-}
|
||||
has_lines=${has_lines/ del*/}
|
||||
@ -1531,7 +1531,7 @@ _lp_set_prompt()
|
||||
LP_VCS_TYPE="git"
|
||||
if [[ -n "$LP_VCS" ]]; then
|
||||
# If this is a git-svn repository
|
||||
if [[ -d "$(git rev-parse --git-dir 2>/dev/null)/svn" ]]; then
|
||||
if [[ -d "$(\git rev-parse --git-dir 2>/dev/null)/svn" ]]; then
|
||||
LP_VCS_TYPE="git-svn"
|
||||
fi # git-svn
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user