summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d249b09)
raw | patch | inline | side by side (parent: d249b09)
author | Junio C Hamano <gitster@pobox.com> | |
Mon, 10 Aug 2009 06:08:40 +0000 (23:08 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 10 Aug 2009 19:54:07 +0000 (12:54 -0700) |
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 the libification started by the previous commit.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
moves the wt_status_colors[] color palette to the wt_status structure to
complete the libification started by the previous commit.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
wt-status.c | patch | blob | history | |
wt-status.h | patch | blob | history |
diff --git a/wt-status.c b/wt-status.c
index af93bb52db9e1f0fb88b88975af169b5037d7ce4..cfbaf309ad1716a820a1d73b9fba889a1e530285 100644 (file)
--- a/wt-status.c
+++ b/wt-status.c
#include "cache.h"
#include "wt-status.h"
-#include "color.h"
#include "object.h"
#include "dir.h"
#include "commit.h"
#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 */
static const char *color(int slot, struct wt_status *s)
{
- return s->use_color > 0 ? wt_status_colors[slot] : "";
+ return s->use_color > 0 ? s->color_palette[slot] : "";
}
void wt_status_prepare(struct wt_status *s)
const char *head;
memset(s, 0, sizeof(*s));
+ memcpy(s->color_palette, default_wt_status_colors,
+ sizeof(default_wt_status_colors));
s->show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;
s->use_color = -1;
s->relative_paths = 1;
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->color_palette[slot]);
return 0;
}
if (!strcmp(k, "status.relativepaths")) {
diff --git a/wt-status.h b/wt-status.h
index cd06a4d955208962de6df37cfe1ff452918d12f1..0297fabdc199c5e369674d564c9c1404156e1a11 100644 (file)
--- a/wt-status.h
+++ b/wt-status.h
#include <stdio.h>
#include "string-list.h"
+#include "color.h"
enum color_wt_status {
- WT_STATUS_HEADER,
+ WT_STATUS_HEADER = 0,
WT_STATUS_UPDATED,
WT_STATUS_CHANGED,
WT_STATUS_UNTRACKED,
int relative_paths;
int submodule_summary;
enum untracked_status_type show_untracked_files;
+ char color_palette[WT_STATUS_UNMERGED+1][COLOR_MAXLEN];
/* These are computed during processing of the individual sections */
int commitable;