Subject: Re: [PATCH v16 1/2] refactor format_branch_comparison in preparation

From: Junio C Hamano <[email-masked]>
Date: Mon, 05 Jan 2026 11:05:22 +0900

"Harald Nordgren via GitGitGadget" <[email-masked]> writes:

> -	} else if (!sti) {
> -		strbuf_addf(sb,
> -			_("Your branch is up to date with '%s'.\n"),
> -			base);
> -	} else if (abf == AHEAD_BEHIND_QUICK) {
> +	if (abf == AHEAD_BEHIND_QUICK) {
>  		strbuf_addf(sb,
>  			    _("Your branch and '%s' refer to different commits.\n"),
> -			    base);
> +			    branch_name);
>  		if (advice_enabled(ADVICE_STATUS_HINTS))
>  			strbuf_addf(sb, _("  (use \"%s\" for details)\n"),
>  				    "git status --ahead-behind");
> +	} else if (!ours && !theirs) {
> +		strbuf_addf(sb,
> +			_("Your branch is up to date with '%s'.\n"),
> +			branch_name);

We used to check if there is nothing to report (i.e., !sti is a
signal from stat_tracking_info() that there are no differences
between the branches) and reported that first, so when abf was
checked, we knew that there are some differences.  Now, your patch
reverses the order so whether there is or is not a change, abf
codepath will always report "you have differences!".

This smells iffy.