1
0
Fork 0

Git-plugin: Get the remote branch manually

The remote branch's name should be obtained manually, not with git status
pull/40/head
Colin Hebert 13 years ago
parent f41485a296
commit 3ed6f12591

@ -172,6 +172,7 @@ function git-info() {
local git_info_var
local -A git_info_vars
local status_cmd
local remote_cmd
local ignore_submodule
local ignore_submodule_when
@ -205,6 +206,8 @@ function git-info() {
# Use short status for easy parsing.
status_cmd='git status --short --branch'
# Get remote's name.
remote_cmd='git rev-parse --verify HEAD@{upstream} --symbolic-full-name'
# Ignore submodule status.
zstyle -b \
@ -290,12 +293,8 @@ function git-info() {
zformat -f branch_formatted "$branch_format" "b:$branch"
# Format remote.
if [[ -z "$remote" ]]; then
remote="${$( \
git rev-parse \
--verify ${branch}@{upstream} \
--symbolic-full-name 2>/dev/null)#refs/remotes/}"
fi
remote=${$(${(z)remote_cmd} 2>/dev/null)##refs/remotes/}
if [[ -n "$remote" ]]; then
zstyle -s ':omz:plugin:git:prompt' remote 'remote_format'
zformat -f remote_formatted "$remote_format" "R:$remote"
fi
@ -311,6 +310,7 @@ function git-info() {
zstyle -s ':omz:plugin:git:prompt' behind 'behind_format'
zformat -f behind_formatted "$behind_format" "B:$behind"
fi
fi
# Format added.
if (( $added > 0 )); then

Loading…
Cancel
Save