From 4a7cc2fdf39c90e6eff84d30b86490cac2c33705 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Mon, 7 Dec 2009 00:17:15 -0500 Subject: [PATCH] status: disable color for porcelain format The porcelain format is identical to the shortstatus format, except that it should not respect any user configuration, including color. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- builtin-commit.c | 4 ++-- wt-status.c | 6 ++++++ wt-status.h | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/builtin-commit.c b/builtin-commit.c index 07cc76c04a..ded58984ac 100644 --- a/builtin-commit.c +++ b/builtin-commit.c @@ -382,7 +382,7 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix, int wt_shortstatus_print(s, null_termination); break; case STATUS_FORMAT_PORCELAIN: - wt_shortstatus_print(s, null_termination); + wt_porcelain_print(s, null_termination); break; case STATUS_FORMAT_LONG: wt_status_print(s); @@ -975,7 +975,7 @@ int cmd_status(int argc, const char **argv, const char *prefix) wt_shortstatus_print(&s, null_termination); break; case STATUS_FORMAT_PORCELAIN: - wt_shortstatus_print(&s, null_termination); + wt_porcelain_print(&s, null_termination); break; case STATUS_FORMAT_LONG: s.verbose = verbose; diff --git a/wt-status.c b/wt-status.c index 696c6b0bf1..756defea1a 100644 --- a/wt-status.c +++ b/wt-status.c @@ -688,3 +688,9 @@ void wt_shortstatus_print(struct wt_status *s, int null_termination) wt_shortstatus_untracked(null_termination, it, s); } } + +void wt_porcelain_print(struct wt_status *s, int null_termination) +{ + s->use_color = 0; + wt_shortstatus_print(s, null_termination); +} diff --git a/wt-status.h b/wt-status.h index 39c9aef7a5..a4bddcf8db 100644 --- a/wt-status.h +++ b/wt-status.h @@ -57,5 +57,6 @@ 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_porcelain_print(struct wt_status *s, int null_termination); #endif /* STATUS_H */