From: Matthias Kestenholz <mk@spinlock.ch>
To: gitster@pobox.com
Cc: git@vger.kernel.org, Matthias Kestenholz <matthias@spinlock.ch>
Subject: [PATCH 3/4] status and commit: Use color configuration infrastructure
Date: Sat, 5 Jan 2008 15:11:38 +0100 [thread overview]
Message-ID: <1199542299-12082-3-git-send-email-mk@spinlock.ch> (raw)
In-Reply-To: <1199542299-12082-2-git-send-email-mk@spinlock.ch>
From: Matthias Kestenholz <matthias@spinlock.ch>
Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch>
---
builtin-commit.c | 8 +++++---
wt-status.c | 7 +++----
wt-status.h | 1 -
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index 73f1e35..e442b5f 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -7,6 +7,7 @@
#include "cache.h"
#include "cache-tree.h"
+#include "color.h"
#include "dir.h"
#include "builtin.h"
#include "diff.h"
@@ -435,10 +436,10 @@ static int prepare_log_message(const char *index_file, const char *prefix)
if (only_include_assumed)
fprintf(fp, "# %s\n", only_include_assumed);
- saved_color_setting = wt_status_use_color;
- wt_status_use_color = 0;
+ saved_color_setting = git_use_color;
+ git_use_color = 0;
commitable = run_status(fp, index_file, prefix, 1);
- wt_status_use_color = saved_color_setting;
+ git_use_color = saved_color_setting;
fclose(fp);
@@ -639,6 +640,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
int commitable;
git_config(git_status_config);
+ git_color_config();
argc = parse_and_validate_options(argc, argv, builtin_status_usage);
diff --git a/wt-status.c b/wt-status.c
index c0c2472..ebcbe5a 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -9,7 +9,6 @@
#include "diffcore.h"
int wt_status_relative_paths = 1;
-int wt_status_use_color = 0;
static char wt_status_colors[][COLOR_MAXLEN] = {
"", /* WT_STATUS_HEADER: normal */
"\033[32m", /* WT_STATUS_UPDATED: green */
@@ -40,7 +39,7 @@ static int parse_status_slot(const char *var, int offset)
static const char* color(int slot)
{
- return wt_status_use_color ? wt_status_colors[slot] : "";
+ return git_use_color > 0 ? wt_status_colors[slot] : "";
}
void wt_status_prepare(struct wt_status *s)
@@ -397,7 +396,7 @@ void wt_status_print(struct wt_status *s)
int git_status_config(const char *k, const char *v)
{
if (!strcmp(k, "status.color") || !strcmp(k, "color.status")) {
- wt_status_use_color = git_config_colorbool(k, v, -1);
+ git_use_color = git_config_colorbool(k, v, -1);
return 0;
}
if (!prefixcmp(k, "status.color.") || !prefixcmp(k, "color.status.")) {
@@ -409,5 +408,5 @@ int git_status_config(const char *k, const char *v)
wt_status_relative_paths = git_config_bool(k, v);
return 0;
}
- return git_default_config(k, v);
+ return git_color_default_config(k, v);
}
diff --git a/wt-status.h b/wt-status.h
index 02afaa6..05b05ba 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -28,7 +28,6 @@ struct wt_status {
};
int git_status_config(const char *var, const char *value);
-int wt_status_use_color;
int wt_status_relative_paths;
void wt_status_prepare(struct wt_status *s);
void wt_status_print(struct wt_status *s);
--
1.5.4.rc2.1104.gec8ae5-dirty
next prev parent reply other threads:[~2008-01-05 14:19 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-04 8:35 [PATCH] add--interactive: allow diff colors without interactive colors Jeff King
2008-01-05 0:20 ` Junio C Hamano
2008-01-05 3:37 ` Jeff King
2008-01-05 8:01 ` Junio C Hamano
2008-01-05 8:51 ` Jeff King
2008-01-05 9:28 ` Junio C Hamano
2008-01-05 9:57 ` Jeff King
2008-01-05 10:58 ` [PATCH/resend] " Matthias Kestenholz
2008-01-05 11:11 ` Junio C Hamano
2008-01-05 14:10 ` Matthias Kestenholz
2008-01-05 14:11 ` [PATCH 1/4] Add infrastructure for a single color config variable Matthias Kestenholz
2008-01-05 14:11 ` [PATCH 2/4] git branch: Use color configuration infrastructure Matthias Kestenholz
2008-01-05 14:11 ` Matthias Kestenholz [this message]
2008-01-05 14:11 ` [PATCH 4/4] diff and log: " Matthias Kestenholz
2008-01-08 11:23 ` [PATCH 2/4] git branch: " Jeff King
2008-01-08 12:52 ` Matthias Kestenholz
2008-01-05 11:37 ` [PATCH/resend] add--interactive: allow diff colors without interactive colors Jakub Narebski
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=1199542299-12082-3-git-send-email-mk@spinlock.ch \
--to=mk@spinlock.ch \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=matthias@spinlock.ch \
/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).