From: Knittl <knittl89@googlemail.com>
To: git@vger.kernel.org
Subject: Re: [PATCH] Show branch information in short output of git status
Date: Fri, 7 May 2010 18:05:51 +0200 [thread overview]
Message-ID: <AANLkTilQZQzijU_xMz34eajpD05ogK01GRByDddoGGmI@mail.gmail.com> (raw)
In-Reply-To: <AANLkTikDkrNrzPmIhmcBRKtLKV70f4Kp8wTw6I6ctB4O@mail.gmail.com>
hi all,
here's the second part of the branch, so it will only show branch
information in `git status -s` if the additional option `-b` is given.
open for suggestions,
daniel
----------8<-------------
From 00d7aa6872a8aaf98c7e5550ba64ec6e093ca897 Mon Sep 17 00:00:00 2001
From: Daniel Knittl-Frank <knittl89+git@googlemail.com>
Date: Tue, 20 Apr 2010 22:40:54 +0200
Subject: [PATCH 2/2] Hide branch information per default in short
output of status
Branch information remains hidden, unless the command line option `-b`
is given to `git status -s`. This way the command does not change from
older versions.
Also hide branch information in `--porcelain` output
Signed-off-by: Daniel Knittl-Frank <knittl89+git@googlemail.com>
---
builtin/commit.c | 8 ++++++--
wt-status.c | 7 ++++---
wt-status.h | 2 +-
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/builtin/commit.c b/builtin/commit.c
index c5ab683..b058e66 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -92,6 +92,7 @@ static enum {
STATUS_FORMAT_SHORT,
STATUS_FORMAT_PORCELAIN,
} status_format = STATUS_FORMAT_LONG;
+static int status_show_branch;
static int opt_parse_m(const struct option *opt, const char *arg, int unset)
{
@@ -133,6 +134,7 @@ static struct option builtin_commit_options[] = {
OPT_BOOLEAN(0, "dry-run", &dry_run, "show what would be committed"),
OPT_SET_INT(0, "short", &status_format, "show status concisely",
STATUS_FORMAT_SHORT),
+ OPT_BOOLEAN(0, "branch", &status_show_branch, "show branch information"),
OPT_SET_INT(0, "porcelain", &status_format,
"show porcelain output format", STATUS_FORMAT_PORCELAIN),
OPT_BOOLEAN('z', "null", &null_termination,
@@ -417,7 +419,7 @@ static int run_status(FILE *fp, const char
*index_file, const char *prefix, int
switch (status_format) {
case STATUS_FORMAT_SHORT:
- wt_shortstatus_print(s, null_termination);
+ wt_shortstatus_print(s, null_termination, status_show_branch);
break;
case STATUS_FORMAT_PORCELAIN:
wt_porcelain_print(s, null_termination);
@@ -1022,6 +1024,8 @@ int cmd_status(int argc, const char **argv,
const char *prefix)
OPT__VERBOSE(&verbose),
OPT_SET_INT('s', "short", &status_format,
"show status concisely", STATUS_FORMAT_SHORT),
+ OPT_BOOLEAN('b', "branch", &status_show_branch,
+ "show branch information"),
OPT_SET_INT(0, "porcelain", &status_format,
"show porcelain output format",
STATUS_FORMAT_PORCELAIN),
@@ -1063,7 +1067,7 @@ int cmd_status(int argc, const char **argv,
const char *prefix)
switch (status_format) {
case STATUS_FORMAT_SHORT:
- wt_shortstatus_print(&s, null_termination);
+ wt_shortstatus_print(&s, null_termination, status_show_branch);
break;
case STATUS_FORMAT_PORCELAIN:
wt_porcelain_print(&s, null_termination);
diff --git a/wt-status.c b/wt-status.c
index f7f1269..e1b8188 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -781,11 +781,12 @@ static void wt_shortstatus_print_tracking(struct
wt_status *s)
color_fprintf_ln(s->fp, header_color, "]");
}
-void wt_shortstatus_print(struct wt_status *s, int null_termination)
+void wt_shortstatus_print(struct wt_status *s, int null_termination,
int show_branch)
{
int i;
- wt_shortstatus_print_tracking(s);
+ if(show_branch)
+ wt_shortstatus_print_tracking(s);
for (i = 0; i < s->change.nr; i++) {
struct wt_status_change_data *d;
@@ -811,5 +812,5 @@ void wt_porcelain_print(struct wt_status *s, int
null_termination)
s->use_color = 0;
s->relative_paths = 0;
s->prefix = NULL;
- wt_shortstatus_print(s, null_termination);
+ wt_shortstatus_print(s, null_termination, 0);
}
diff --git a/wt-status.h b/wt-status.h
index ca5db99..4272539 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -61,7 +61,7 @@ void wt_status_prepare(struct wt_status *s);
void wt_status_print(struct wt_status *s);
void wt_status_collect(struct wt_status *s);
-void wt_shortstatus_print(struct wt_status *s, int null_termination);
+void wt_shortstatus_print(struct wt_status *s, int null_termination,
int show_branch);
void wt_porcelain_print(struct wt_status *s, int null_termination);
#endif /* STATUS_H */
--
1.7.1.12.g82b44.dirty
next prev parent reply other threads:[~2010-05-07 16: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
2010-05-06 12:24 ` Knittl
2010-05-07 16:05 ` Knittl [this message]
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=AANLkTilQZQzijU_xMz34eajpD05ogK01GRByDddoGGmI@mail.gmail.com \
--to=knittl89@googlemail.com \
--cc=git@vger.kernel.org \
/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).