Git development
 help / color / mirror / Atom feed
From: Elia Pinto <gitter.spiros@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Harald Nordgren" <haraldnordgren@gmail.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: Re: [PATCH] status: reword message for a missing upstream branch
Date: Tue, 20 Oct 2026 09:29:24 +0200	[thread overview]
Message-ID: <20261020072924.42026-1-gitter.spiros@gmail.com> (raw)
In-Reply-To: <xmqqzew91i5g.fsf@gitster.g>

Junio C Hamano <gitster@pobox.com> writes:

> Ahh, "does not exist".  Clever.  That does cover both cases and
> reads reasonably natural.  If we wanted to have something short that
> we can reuse elsewhere (like inside [] in place of [gone]), we could
> say which is "missing", perhaps.

"missing" sounds good to me for the short form. I'd rather keep it
out of this patch, though; see below for why the bracketed label
needs a bit more care than the long message.

> Do we emit "git push" suggestion unconditionally (meaning, does "git
> push" immediately in this state always create the "upstream" that
> does not exist yet), or do we have to check if "git push" will
> create it before saying so?

We check, as the next paragraph of the log says: the hint is given
only when @{push} resolves to the upstream itself, and push.default
is not "matching".

The check errs on the side of not giving the hint. For example, with
push.default=matching but an explicit remote.<name>.push refspec,
"git push" uses the refspec and would create the upstream, but we
still do not suggest it, because push_creates() looks at push.default
without checking whether a refspec overrides it. I'll fix that in v2
by checking push.default only when the remote has no push refspec
and is not a mirror, which is the same order branch_get_push_1()
follows.

> Does this refer to what wt_shortstatus_print_tracking() says?  It is
> _(translated), so in a sense it is a fair game to be improved.

Yes, and you are right, the justification in the log message is
wrong for some of the commands it lists. Looking more closely:

 - "git status -sb" uses LABEL(N_("gone")) in
   wt_shortstatus_print_tracking(), so it is translated (e.g.
   "[sparito]" in Italian).

 - "git status --porcelain -b" goes through the same function, but
   wt_porcelain_print() sets s->no_gettext, so it always says
   "[gone]". That one has to stay.

 - "git status --porcelain=v2" never says "gone"; it prints
   "# branch.upstream" and omits the "# branch.ab" line.

 - "%(upstream:track)" in "git for-each-ref" uses the untranslated
   "gone" from ref-filter.c, which is documented in
   git-for-each-ref.adoc, so that one has to stay too. But "git
   branch" (and "git tag") call setup_ref_filter_porcelain_msg(),
   so "git branch -vv" and "git branch --format=%(upstream:track)"
   show the translated label.

So "scripts may depend on it" is true only for --porcelain and
for-each-ref. The other two are human-readable output and could be
changed.

I am still hesitant to change the label in "git branch -vv" as part
of this patch. Translated or not, under LC_ALL=C it says "gone", and

    git branch -vv | grep ': gone]'

is a very common recipe for finding branches whose upstream was
pruned. To keep the porcelain output as "gone" while changing the
human output, wt_shortstatus_print_tracking() also could not keep
using LABEL() with a single msgid.

So for v2 I plan to leave the bracketed label alone and correct the
log message to say what is really going on. If we want "[missing]"
in "git status -sb" and "git branch -vv", I'd do it as a separate
follow-up patch, where we can discuss the compatibility question
separately.

Thanks for the review.

      reply	other threads:[~2026-10-20  7:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19 17:57 [PATCH] status: reword message for a missing upstream branch Elia Pinto
2026-10-19 18:04 ` Harald Nordgren
2026-10-19 21:42 ` Junio C Hamano
2026-10-20  7:29   ` Elia Pinto [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261020072924.42026-1-gitter.spiros@gmail.com \
    --to=gitter.spiros@gmail.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=haraldnordgren@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox