Subject: [PATCH v19 0/2] status: show comparison with push remote tracking branch

From: "Harald Nordgren via GitGitGadget" <[email-masked]>
Date: Fri, 09 Jan 2026 18:40:35 +0000

cc: Chris Torek [email-masked] cc: Yee Cheng Chin
[email-masked] cc: "brian m. carlson" [email-masked]
cc: Ben Knoble [email-masked] cc: "Kristoffer Haugsbakk"
[email-masked] cc: Phillip Wood [email-masked]
cc: Nico Williams [email-masked] cc: Patrick Steinhardt [email-masked]

Harald Nordgren (2):
  refactor format_branch_comparison in preparation
  status: show comparison with push remote tracking branch

 remote.c                 | 174 ++++++++++++++++++++------
 t/t6040-tracking-info.sh | 262 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 401 insertions(+), 35 deletions(-)

base-commit: d529f3a197364881746f558e5652f0236131eb86
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2138%2FHaraldNordgren%2Fahead_of_main_status-v19
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2138/HaraldNordgren/ahead_of_main_status-v19
Pull-Request: https://github.com/git/git/pull/2138

Range-diff vs v18:

 1:  451d7a4986 = 1:  451d7a4986 refactor format_branch_comparison in preparation
 2:  02476eb8e6 ! 2:  dc8ab23158 status: show comparison with push remote tracking branch
     @@ remote.c
       
       enum map_direction { FROM_SRC, FROM_DST };
       
     -+enum branch_mode_flags {
     ++enum {
      +	BRANCH_MODE_PULL = (1 << 0),
      +	BRANCH_MODE_PUSH = (1 << 1),
      +};
     @@ remote.c: int stat_tracking_info(struct branch *branch, int *num_ours, int *num_
       				     int ours, int theirs,
       				     const char *branch_name,
       				     enum ahead_behind_flags abf,
     -+				     enum branch_mode_flags advice_flags,
     ++				     unsigned flags,
       				     bool show_divergence_advice)
       {
     -+	bool want_push_advice = (advice_flags & BRANCH_MODE_PUSH) &&
     ++	bool want_push_advice = (flags & BRANCH_MODE_PUSH) &&
      +		advice_enabled(ADVICE_STATUS_HINTS);
     -+	bool want_pull_advice = (advice_flags & BRANCH_MODE_PULL) &&
     ++	bool want_pull_advice = (flags & BRANCH_MODE_PULL) &&
      +		advice_enabled(ADVICE_STATUS_HINTS);
     -+	bool want_divergence_advice = (advice_flags & BRANCH_MODE_PULL) &&
     ++	bool want_divergence_advice = (flags & BRANCH_MODE_PULL) &&
      +		show_divergence_advice &&
      +		advice_enabled(ADVICE_STATUS_HINTS);
      +
     @@ remote.c: int format_tracking_info(struct branch *branch, struct strbuf *sb,
       	const char *full_base;
       	char *base;
       	int upstream_is_gone = 0;
     -+	enum branch_mode_flags base_branch_modes = BRANCH_MODE_PULL | BRANCH_MODE_PUSH;
     ++	unsigned base_branch_modes = BRANCH_MODE_PULL | BRANCH_MODE_PUSH;
      +	int push_ours, push_theirs, push_sti;
      +	char *full_push = NULL;
      +	char *push = NULL;
     -+	enum branch_mode_flags push_branch_modes = 0;
     ++	unsigned push_branch_modes = 0;
       
       	sti = stat_tracking_info(branch, &ours, &theirs, &full_base, 0, abf);
       	if (sti < 0) {

-- 
gitgitgadget