diff options
author | Jeff King <peff@peff.net> | 2011-08-17 22:05:35 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-08-19 15:51:38 -0700 |
commit | c9bfb953489e559d513c1627150aa16f8d42d6c5 (patch) | |
tree | 2c12de73bcf6ecdb5f2c28aff6cbb3aba91f182a /builtin/commit.c | |
parent | 3e1dd17a8958cc5fe47a7ca01c9da8f6fae9cb0b (diff) | |
download | git-c9bfb953489e559d513c1627150aa16f8d42d6c5.tar.gz git-c9bfb953489e559d513c1627150aa16f8d42d6c5.tar.xz |
want_color: automatically fallback to color.ui
All of the "do we want color" flags default to -1 to
indicate that we don't have any color configured. This value
is handled in one of two ways:
1. In porcelain, we check early on whether the value is
still -1 after reading the config, and set it to the
value of color.ui (which defaults to 0).
2. In plumbing, it stays untouched as -1, and want_color
defaults it to off.
This works fine, but means that every porcelain has to check
and reassign its color flag. Now that want_color gives us a
place to put this check in a single spot, we can do that,
simplifying the calling code.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit.c')
-rw-r--r-- | builtin/commit.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/builtin/commit.c b/builtin/commit.c index 295803a26..9763146b6 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1237,10 +1237,6 @@ int cmd_status(int argc, const char **argv, const char *prefix) if (s.relative_paths) s.prefix = prefix; - if (s.use_color == -1) - s.use_color = git_use_color_default; - if (diff_use_color_default == -1) - diff_use_color_default = git_use_color_default; switch (status_format) { case STATUS_FORMAT_SHORT: @@ -1394,15 +1390,10 @@ int cmd_commit(int argc, const char **argv, const char *prefix) git_config(git_commit_config, &s); determine_whence(&s); - if (s.use_color == -1) - s.use_color = git_use_color_default; argc = parse_and_validate_options(argc, argv, builtin_commit_usage, prefix, &s); - if (dry_run) { - if (diff_use_color_default == -1) - diff_use_color_default = git_use_color_default; + if (dry_run) return dry_run_commit(argc, argv, prefix, &s); - } index_file = prepare_index(argc, argv, prefix, 0); /* Set up everything for writing the commit object. This includes |