From: Jeff King <peff@peff.net>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: Felipe Contreras <felipe.contreras@gmail.com>,
git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] branch: make -v useful
Date: Sat, 5 Jun 2021 18:35:33 -0400 [thread overview]
Message-ID: <YLv8NWL7WfBRkiGe@coredump.intra.peff.net> (raw)
In-Reply-To: <87czt059sn.fsf@evledraar.gmail.com>
On Sat, Jun 05, 2021 at 10:18:14PM +0200, Ævar Arnfjörð Bjarmason wrote:
> As for the proposal, I don't use "branch -v" all that much much, so I
> don't have strong knee-jerk feelings on it, but just considering it now
> I'd think that the current default is a fundamentally better
> approximation of what most users would like as a default.
>
> I.e. I think it's fair to say that to the extent that most users have
> topic branches they're part of some pull-request workflow where they're
> always tracking the one upstream they always care about, usually
> origin/master.
I'm in the same boat. I don't use "branch -v" either, but showing the
upstream name wouldn't be at all helpful to me, since it they would all
just be "origin/master". (This will vary based on workflow, but the
other common workflow would probably just show "topic" being based on
"origin/topic").
> The -v output showing the ahead/behind relationship to that branch
> without naming it is thus the best use of the limited space we have, and
> with a bit more verbosity under -vv we'd show the (usually the same for
> all of those) upstream name.
The notion of what to show for a verbose format may depend on workflow,
or even what the user's currently interested in. These days we have
--format to give much more flexible output.
The "-v" and "-vv" options predate --format, but these days are
implemented on top of it (they literally build a format string that's
passed into ref-filter.c's interpreter).
So we could document them as: behave as if "--format=..." was given on
the command line (unfortunately "..." here is a complex set of %(if)
mechanisms, but it would mostly be for reference; nobody would need to
type it).
And then it is not a far leap to change that to: behave as if --format
was set to the value of branch.verboseFormat, and the default of that
config option is "...". And then anybody can make "branch -v" behave
however they like.
It would break scripts that parse "branch -v", of course, but we've been
pretty explicit that this is porcelain (and the plumbing option is
for-each-ref).
> For what it's worth I remember some past discussion where it was
> discussed to have some human-readable cut-off so instead of saying:
>
> ahead 2, behind 38741
>
> We'd just fall back on saying "behind lots" once your number of behind
> reached some limit (which could dynamically compute as a heuristic based
> on repo size, just like the abbrev length)..
There's some discussion in the sub-thread starting here:
https://lore.kernel.org/git/7b759564-5544-8845-0594-e8342a0b4ba5@gmail.com/
I do like that direction, but it sounds like there's some complexity
(maybe less these days if we can rely on having commit-graphs with
generation numbers). There is an AHEAD_BEHIND_QUICK flag, but I think it
can only be triggered via "git status --no-ahead-behind" (and it's kind
of unsatisfying, as it only tells you whether the two tips are identical
or not).
-Peff
next prev parent reply other threads:[~2021-06-05 22:35 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-05 1:13 [PATCH] branch: make -v useful Felipe Contreras
2021-06-05 20:18 ` Ævar Arnfjörð Bjarmason
2021-06-05 22:35 ` Jeff King [this message]
2021-06-07 15:57 ` Felipe Contreras
2021-06-08 6:13 ` Jeff King
2021-06-08 7:17 ` Felipe Contreras
2021-06-08 7:27 ` Jeff King
2021-06-08 8:28 ` Felipe Contreras
2021-06-08 9:06 ` Kerry, Richard
2021-06-08 9:22 ` Felipe Contreras
2021-06-08 11:32 ` Kerry, Richard
2021-06-10 3:26 ` Felipe Contreras
2021-06-25 15:03 ` Kerry, Richard
2021-06-25 16:03 ` Felipe Contreras
2021-06-07 15:28 ` Felipe Contreras
2021-06-07 16:05 ` Ævar Arnfjörð Bjarmason
2021-06-07 18:00 ` Felipe Contreras
2021-06-07 18:37 ` Felipe Contreras
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YLv8NWL7WfBRkiGe@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=avarab@gmail.com \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).