Git-plugin: Get the remote branch manually
The remote branch's name should be obtained manually, not with git status
This commit is contained in:
parent
f41485a296
commit
3ed6f12591
1 changed files with 17 additions and 17 deletions
|
@ -172,6 +172,7 @@ function git-info() {
|
||||||
local git_info_var
|
local git_info_var
|
||||||
local -A git_info_vars
|
local -A git_info_vars
|
||||||
local status_cmd
|
local status_cmd
|
||||||
|
local remote_cmd
|
||||||
local ignore_submodule
|
local ignore_submodule
|
||||||
local ignore_submodule_when
|
local ignore_submodule_when
|
||||||
|
|
||||||
|
@ -205,6 +206,8 @@ function git-info() {
|
||||||
|
|
||||||
# Use short status for easy parsing.
|
# Use short status for easy parsing.
|
||||||
status_cmd='git status --short --branch'
|
status_cmd='git status --short --branch'
|
||||||
|
# Get remote's name.
|
||||||
|
remote_cmd='git rev-parse --verify HEAD@{upstream} --symbolic-full-name'
|
||||||
|
|
||||||
# Ignore submodule status.
|
# Ignore submodule status.
|
||||||
zstyle -b \
|
zstyle -b \
|
||||||
|
@ -290,12 +293,8 @@ function git-info() {
|
||||||
zformat -f branch_formatted "$branch_format" "b:$branch"
|
zformat -f branch_formatted "$branch_format" "b:$branch"
|
||||||
|
|
||||||
# Format remote.
|
# Format remote.
|
||||||
if [[ -z "$remote" ]]; then
|
remote=${$(${(z)remote_cmd} 2>/dev/null)##refs/remotes/}
|
||||||
remote="${$( \
|
if [[ -n "$remote" ]]; then
|
||||||
git rev-parse \
|
|
||||||
--verify ${branch}@{upstream} \
|
|
||||||
--symbolic-full-name 2>/dev/null)#refs/remotes/}"
|
|
||||||
fi
|
|
||||||
zstyle -s ':omz:plugin:git:prompt' remote 'remote_format'
|
zstyle -s ':omz:plugin:git:prompt' remote 'remote_format'
|
||||||
zformat -f remote_formatted "$remote_format" "R:$remote"
|
zformat -f remote_formatted "$remote_format" "R:$remote"
|
||||||
fi
|
fi
|
||||||
|
@ -311,6 +310,7 @@ function git-info() {
|
||||||
zstyle -s ':omz:plugin:git:prompt' behind 'behind_format'
|
zstyle -s ':omz:plugin:git:prompt' behind 'behind_format'
|
||||||
zformat -f behind_formatted "$behind_format" "B:$behind"
|
zformat -f behind_formatted "$behind_format" "B:$behind"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Format added.
|
# Format added.
|
||||||
if (( $added > 0 )); then
|
if (( $added > 0 )); then
|
||||||
|
|
Loading…
Add table
Reference in a new issue