From 3ecde00d94ef8b1b3fa9e7f5acbca14e76eda95b Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Mon, 23 Nov 2026 07:09:30 +1300 Subject: [PATCH] fix(mortalscumbag): compare against the tracked branch, not origin (#14265) The ahead/behind markers compared HEAD with `origin/`, so in a fork where the branch tracks a different remote they reported the difference to `origin` instead of to the branch's own upstream. Use `@{upstream}`, like `git_commits_ahead`/`git_commits_behind` in lib/git.zsh do. A branch without an upstream shows no marker. --- themes/mortalscumbag.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/mortalscumbag.zsh-theme b/themes/mortalscumbag.zsh-theme index 80c2d70db..c4d90f76c 100644 --- a/themes/mortalscumbag.zsh-theme +++ b/themes/mortalscumbag.zsh-theme @@ -5,12 +5,12 @@ function my_git_prompt() { STATUS="" # is branch ahead? - if $(echo "$(git log origin/$(git_current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then + if $(echo "$(git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" fi # is branch behind? - if $(echo "$(git log HEAD..origin/$(git_current_branch) 2> /dev/null)" | grep '^commit' &> /dev/null); then + if $(echo "$(git log HEAD..@{upstream} 2> /dev/null)" | grep '^commit' &> /dev/null); then STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_BEHIND" fi