From: Junio C Hamano Date: Mon, 05 Jan 2026 12:28:25 GMT Subject: Re: Another look? Message-ID: In-Reply-To: <20260105091517.86301-1-haraldnordgren@gmail.com> Harald Nordgren 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!". > > Agreed! This change was done to get rid of sti as a parameter. Maybe I > misunderstood your previous comment around the sti. > > I will bring back sti as a parameter to ’format_branch_comparison’ now, > I don’t see any other way to solve this. Please don't. Unless my assumption, which is that in the old code "!sti" and "!ours && !theirs" is equivalent, is wrong, all you need to do around that part is to first check "if (!ours && !theirs)" and say "your branch is up to date with...", and then have the check "else if (abf == ABQ)" next. That way, when we check abf we know the branches are different.