Merge branch 'jk/color-and-pager'

* jk/color-and-pager:
  want_color: automatically fallback to color.ui
  diff: don't load color config in plumbing
  config: refactor get_colorbool function
  color: delay auto-color decision until point of use
  git_config_colorbool: refactor stdout_is_tty handling
  diff: refactor COLOR_DIFF from a flag into an int
  setup_pager: set GIT_PAGER_IN_USE
  t7006: use test_config helpers
  test-lib: add helper functions for config
  t7006: modernize calls to unset

Conflicts:
	builtin/commit.c
	parse-options.c
This commit is contained in:
Junio C Hamano
2011-08-28 21:19:16 -07:00
21 changed files with 176 additions and 147 deletions

View File

@ -1141,7 +1141,7 @@ static int git_status_config(const char *k, const char *v, void *cb)
return 0;
}
if (!strcmp(k, "status.color") || !strcmp(k, "color.status")) {
s->use_color = git_config_colorbool(k, v, -1);
s->use_color = git_config_colorbool(k, v);
return 0;
}
if (!prefixcmp(k, "status.color.") || !prefixcmp(k, "color.status.")) {
@ -1234,10 +1234,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:
@ -1393,8 +1389,6 @@ 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;
if (get_sha1("HEAD", sha1))
current_head = NULL;
else {
@ -1404,11 +1398,8 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
}
argc = parse_and_validate_options(argc, argv, builtin_commit_usage,
prefix, current_head, &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, current_head, &s);
}
index_file = prepare_index(argc, argv, prefix, current_head, 0);
/* Set up everything for writing the commit object. This includes