Merge branch 'fix-git-integration' of https://github.com/jonasb/liquidprompt into develop
This commit is contained in:
commit
38b041de06
18
liquidprompt
18
liquidprompt
@ -674,6 +674,10 @@ _lp_git_branch()
|
|||||||
local gitdir="$(git rev-parse --git-dir 2>/dev/null)"
|
local gitdir="$(git rev-parse --git-dir 2>/dev/null)"
|
||||||
[[ $? -ne 0 || "${gitdir##*/}" != .git ]] && return
|
[[ $? -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
|
||||||
|
branch="$(git rev-parse --short HEAD 2>/dev/null)"
|
||||||
|
fi
|
||||||
[[ $? -ne 0 || -z "$branch" ]] && return
|
[[ $? -ne 0 || -z "$branch" ]] && return
|
||||||
echo "${branch#refs/heads/}"
|
echo "${branch#refs/heads/}"
|
||||||
}
|
}
|
||||||
@ -714,10 +718,18 @@ _lp_git_branch_color()
|
|||||||
has_stash="$LP_COLOR_COMMITS$LP_MARK_STASH"
|
has_stash="$LP_COLOR_COMMITS$LP_MARK_STASH"
|
||||||
fi
|
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
|
local has_commit
|
||||||
has_commit=$(git rev-list --no-merges --count origin/${branch}..${branch} 2>/dev/null)
|
has_commit=0
|
||||||
if [[ -z "$has_commit" ]] ; then
|
if [[ -n "$remote" && -n "$remote_branch" ]] ; then
|
||||||
has_commit=0
|
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
|
fi
|
||||||
if [[ "$GD" -eq 1 || "$GDC" -eq "1" ]] ; then
|
if [[ "$GD" -eq 1 || "$GDC" -eq "1" ]] ; then
|
||||||
local has_line
|
local has_line
|
||||||
|
Loading…
x
Reference in New Issue
Block a user