Re: [PATCH v19 2/2] status: show comparison with push remote tracking branch
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 10, 2026, 02:21 UTC
- Message-ID
- <xmqq7btqtdgy.fsf@gitster.g>
- In-Reply-To
- <dc8ab23158e5b43cf650f71ef5c2b3a094f54129.1767984037.git.gitgitgadget@gmail.com>
"Harald Nordgren via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 20 quoted lines
> @@ -2303,6 +2369,11 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb,
> const char *full_base;
> char *base;
> int upstream_is_gone = 0;
> + unsigned base_branch_modes = BRANCH_MODE_PULL | BRANCH_MODE_PUSH;
> + int push_ours, push_theirs, push_sti;
> + char *full_push = NULL;
> + char *push = NULL;
> + unsigned push_branch_modes = 0;
>
> sti = stat_tracking_info(branch, &ours, &theirs, &full_base, 0, abf);
> if (sti < 0) {
> @@ -2314,6 +2385,16 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb,
> base = refs_shorten_unambiguous_ref(get_main_ref_store(the_repository),
> full_base, 0);
>
> + push = get_remote_push_branch(branch, &full_push);
> + if (push && strcmp(base, push)) {
> + push_sti = stat_branch_pair(branch->refname, full_push,
> + &push_ours, &push_theirs, abf);Why is this variable called "push_sti"? Calling the return value of stat_tracking_info() "sti" was klumsy but understandable. It would have been much easier to follow the code if the variable were named after what it _means_ in this particular caller's code flow, like "cmp_fetch" (comparison on the fetching side, by convention negative signals an error, and zero signals 'the same'). Perhaps rename "sti" and "push_sti" at the same time to make them more symmetric?
Other than this minor nit, this step looks nicely done (and the previous one is also good).
Thanks.