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@xxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxx> --- 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 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html