Merge branch 'fix-git-integration' of https://github.com/jonasb/liquidprompt into develop
This commit is contained in:
commit
38b041de06
14
liquidprompt
14
liquidprompt
@ -674,6 +674,10 @@ _lp_git_branch()
|
||||
local gitdir="$(git rev-parse --git-dir 2>/dev/null)"
|
||||
[[ $? -ne 0 || "${gitdir##*/}" != .git ]] && return
|
||||
local branch="$(git symbolic-ref HEAD 2>/dev/null)"
|
||||
if [[ $? -ne 0 || -z "$branch" ]] ; then
|
||||
# In detached head state, use commit instead
|
||||
branch="$(git rev-parse --short HEAD 2>/dev/null)"
|
||||
fi
|
||||
[[ $? -ne 0 || -z "$branch" ]] && return
|
||||
echo "${branch#refs/heads/}"
|
||||
}
|
||||
@ -714,11 +718,19 @@ _lp_git_branch_color()
|
||||
has_stash="$LP_COLOR_COMMITS$LP_MARK_STASH"
|
||||
fi
|
||||
|
||||
local remote
|
||||
remote="$(git config --get branch.${branch}.remote 2>/dev/null)"
|
||||
local remote_branch
|
||||
remote_branch="$(git config --get branch.${branch}.merge 2>/dev/null)"
|
||||
|
||||
local has_commit
|
||||
has_commit=$(git rev-list --no-merges --count origin/${branch}..${branch} 2>/dev/null)
|
||||
has_commit=0
|
||||
if [[ -n "$remote" && -n "$remote_branch" ]] ; then
|
||||
has_commit=$(git rev-list --no-merges --count $remote/${remote_branch}..${branch} 2>/dev/null)
|
||||
if [[ -z "$has_commit" ]] ; then
|
||||
has_commit=0
|
||||
fi
|
||||
fi
|
||||
if [[ "$GD" -eq 1 || "$GDC" -eq "1" ]] ; then
|
||||
local has_line
|
||||
has_lines=$(git diff --numstat 2>/dev/null | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d/-%d\n", plus, minus)}')
|
||||
|
Loading…
Reference in New Issue
Block a user