From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH v3 3/8] wt-status: move wt_status_colors[] into wt_status structure
Date: Mon, 10 Aug 2009 01:54:20 -0700 [thread overview]
Message-ID: <1249894465-11018-4-git-send-email-gitster@pobox.com> (raw)
In-Reply-To: <1249894465-11018-3-git-send-email-gitster@pobox.com>
The benefit of this one alone is somewhat iffy, but for completeness this
moves the wt_status_colors[] color palette to the wt_status structure to
complete what the previous commit started.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
wt-status.c | 9 +++++----
wt-status.h | 2 ++
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/wt-status.c b/wt-status.c
index c84a18a..a2a7257 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1,6 +1,5 @@
#include "cache.h"
#include "wt-status.h"
-#include "color.h"
#include "object.h"
#include "dir.h"
#include "commit.h"
@@ -11,7 +10,7 @@
#include "run-command.h"
#include "remote.h"
-static char wt_status_colors[][COLOR_MAXLEN] = {
+static char default_wt_status_colors[][COLOR_MAXLEN] = {
GIT_COLOR_NORMAL, /* WT_STATUS_HEADER */
GIT_COLOR_GREEN, /* WT_STATUS_UPDATED */
GIT_COLOR_RED, /* WT_STATUS_CHANGED */
@@ -40,7 +39,7 @@ static int parse_status_slot(const char *var, int offset)
static const char *color(int slot, struct wt_status *s)
{
- return s->wt_status_use_color > 0 ? wt_status_colors[slot] : "";
+ return s->wt_status_use_color > 0 ? s->wt_status_colors[slot] : "";
}
void wt_status_prepare(struct wt_status *s)
@@ -49,6 +48,8 @@ void wt_status_prepare(struct wt_status *s)
const char *head;
memset(s, 0, sizeof(*s));
+ memcpy(s->wt_status_colors, default_wt_status_colors,
+ sizeof(default_wt_status_colors));
s->show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;
s->wt_status_use_color = -1;
s->wt_status_relative_paths = 1;
@@ -613,7 +614,7 @@ int git_status_config(const char *k, const char *v, void *cb)
int slot = parse_status_slot(k, 13);
if (!v)
return config_error_nonbool(k);
- color_parse(v, k, wt_status_colors[slot]);
+ color_parse(v, k, s->wt_status_colors[slot]);
return 0;
}
if (!strcmp(k, "status.relativepaths")) {
diff --git a/wt-status.h b/wt-status.h
index 3d7fe30..f22c3c1 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -3,6 +3,7 @@
#include <stdio.h>
#include "string-list.h"
+#include "color.h"
enum color_wt_status {
WT_STATUS_HEADER,
@@ -37,6 +38,7 @@ struct wt_status {
int wt_status_relative_paths;
int wt_status_submodule_summary;
enum untracked_status_type show_untracked_files;
+ char wt_status_colors[6][COLOR_MAXLEN];
/* These are computed during processing of the individual sections */
int commitable;
--
1.6.4.173.g72959
next prev parent reply other threads:[~2009-08-10 8:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-10 8:54 [PATCH v3 0/8] shortstatus updates Junio C Hamano
2009-08-10 8:54 ` [PATCH v3 1/8] commit: --dry-run Junio C Hamano
2009-08-10 8:54 ` [PATCH v3 2/8] wt-status: move many global settings to wt_status structure Junio C Hamano
2009-08-10 8:54 ` Junio C Hamano [this message]
2009-08-10 8:54 ` [PATCH v3 4/8] Make git_status_config() file scope static to builtin-commit.c Junio C Hamano
2009-08-10 8:54 ` [PATCH v3 5/8] wt-status: collect untracked files in a separate "collect" phase Junio C Hamano
2009-08-10 8:54 ` [PATCH v3 6/8] git stat: the beginning Junio C Hamano
2009-08-10 8:54 ` [PATCH v3 7/8] git stat: pathspec limits, unlike traditional "git status" Junio C Hamano
2009-08-10 8:54 ` [PATCH v3 8/8] git stat -s: short status output Junio C Hamano
2009-08-10 9:12 ` [PATCH v3 3/8] wt-status: move wt_status_colors[] into wt_status structure Jeff King
2009-08-10 9:10 ` [PATCH v3 2/8] wt-status: move many global settings to " Jeff King
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=1249894465-11018-4-git-send-email-gitster@pobox.com \
--to=gitster@pobox.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).