git: check the correct remote branch for has_commit
Previously it was always checking against origin/$branch, but the remote branch can have any name and the remote branch can also have any name.
This commit is contained in:
parent
e8649fc440
commit
6da70cc63d
14
liquidprompt
14
liquidprompt
@ -704,10 +704,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…
Reference in New Issue
Block a user