mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-30 02:44:42 +01:00
lib/git.zsh: Avoid calling current_branch()
The original code hard-coded 'origin' as the remote and called
current_branch() to get the corresponding remote branch name,
which may not necessarily be the correct upstream branch.
Use the the built-in @{upstream} syntax instead of calling
current_branch().
This improves performance and fixes a bug when the local and
remote branches do not have the same name.
This commit is contained in:
parent
fd44dfd03f
commit
2bb066eed5
1 changed files with 1 additions and 1 deletions
|
|
@ -57,7 +57,7 @@ git_remote_status() {
|
|||
|
||||
# Checks if there are commits ahead from remote
|
||||
function git_prompt_ahead() {
|
||||
if [[ -n $(git rev-list -1 origin/$(current_branch)..HEAD 2>/dev/null) ]]; then
|
||||
if [[ -n $(git rev-list -1 --first-parent @{upstream}..HEAD 2>/dev/null) ]]; then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue