From: Jeff King <peff@peff.net>
To: Knittl <knittl89@googlemail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Show branch information in short output of git status
Date: Wed, 5 May 2010 01:06:40 -0400 [thread overview]
Message-ID: <20100505050640.GC8779@coredump.intra.peff.net> (raw)
In-Reply-To: <AANLkTikM3B-9wFBuUzwpP2j9FpT34p9yysX-oLg5hZRj@mail.gmail.com>
On Sun, May 02, 2010 at 11:13:41AM +0200, Knittl wrote:
> This patch adds a first line in the output of `git status -s`, showing
> which branch the user is currently on, and in case of tracking branches
> the number of commits on each branch.
I don't generally use "git status -s", so I don't have a strong opinion,
but should this perhaps be optional? I imagine people using it fall
into one of two categories:
1. They want to waste less vertical screen real estate than "git
status" does.
2. They prefer to see files in a single list with status marked,
rather than in separate lists based on status.
Your patch will probably annoy people in group (1) unless they have some
way to turn it off.
A few other comments on the patch itself:
> + color_fprintf(s->fp, color(WT_STATUS_HEADER, s), "## ");
I thought the doubled '##' looked funny at first, but the more I look at
it, I think lining it up with the filenames looks good.
> + if(!s->branch) return;
Style nits. This should be:
if (!s->branch)
return;
> + branch = branch_get(s->branch + 11);
> + if (!stat_tracking_info(branch, &num_ours, &num_theirs)) {
> +
> + if(s->is_initial) {
> + color_fprintf(s->fp,
> + color(WT_STATUS_HEADER, s),
> + "Initial commit ... ");
> + }
> + color_fprintf_ln(s->fp, branch_color,
> + "%s", branch_name);
> + return;
> + }
Why do we only mention it as an initial commit if there is no tracking?
We get if it is an initial commit and no tracking:
## Initial commit ... master
but if there is a tracking branch setup, we get no "Initial commit" at
all. And the use of "..." is confusing, as it usually implies symmetric
difference, which doesn't really make sense here.
> + base = branch->merge[0]->dst;
> + base = shorten_unambiguous_ref(base, 0);
> + color_fprintf_ln(s->fp, branch_color,
> + "%s (%d) ... %s (%d)",
> + branch_name, num_ours,
> + base, num_theirs);
> +}
Here we get:
## master (1) ... origin/master (1)
which kind of makes sense. The "..." implies symmetric difference. But
in other spots, like "git fetch" and "git push" output, we usually try
to make it cut-and-pastable in case one wants to view the actual
history. So maybe something like:
## master...origin/master [ahead 1, behind 1]
The latter matches how "git branch -v" prints it. I dunno. I guess this
is just bikeshedding really, so maybe others will chime in with
suggestions and you can pick the one you like best.
-Peff
next prev parent reply other threads:[~2010-05-05 5:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-02 9:13 [PATCH] Show branch information in short output of git status Knittl
2010-05-05 5:06 ` Jeff King [this message]
2010-05-06 12:24 ` Knittl
2010-05-07 16:05 ` Knittl
2010-05-12 13:35 ` Jeff King
2010-05-14 6:54 ` Knittl
2010-05-23 9:23 ` Jeff King
2010-05-25 7:19 ` Michael J Gruber
2010-05-25 7:22 ` Jeff King
2010-05-25 8:10 ` Michael J Gruber
2010-05-25 8:30 ` [PATCH] Documentation/SubmittingPatches: clarify GMail section and SMTP Michael J Gruber
2010-05-25 9:25 ` Jeff King
2010-05-25 9:47 ` Ævar Arnfjörð Bjarmason
-- strict thread matches above, loose matches on Subject: below --
2010-05-02 10:10 [PATCH] Show branch information in short output of git status Knittl
[not found] <AANLkTinNYcuiyRpgMGpQAEaStj2MDg9UooozooLPwv_0@mail.gmail.com>
2010-05-25 13:45 ` Michael J Gruber
2010-05-25 14:03 ` Michael J Gruber
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=20100505050640.GC8779@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=knittl89@googlemail.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;
as well as URLs for NNTP newsgroup(s).