summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 061d6b9)
raw | patch | inline | side by side (parent: 061d6b9)
author | Jeff King <peff@peff.net> | |
Fri, 4 Jan 2008 08:59:34 +0000 (03:59 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 5 Jan 2008 00:05:23 +0000 (16:05 -0800) |
The diff porcelain uses git_diff_ui_config to set
porcelain-ish config options, like automatically turning on
color. The plumbing specifically avoids calling this
function, since it doesn't want things like automatic color
or rename detection.
However, some diff options should be set for both plumbing
and porcelain. For example, one can still turn on color in
git-diff-files using the --color command line option. This
means we want the color config from color.diff.* (so that
once color is on, we use the user's preferred scheme), but
_not_ the color.diff variable.
We split the diff config into "ui" and "basic", where
"basic" is suitable for use by plumbing (so _most_ things
affecting the output should still go into the "ui" part).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
porcelain-ish config options, like automatically turning on
color. The plumbing specifically avoids calling this
function, since it doesn't want things like automatic color
or rename detection.
However, some diff options should be set for both plumbing
and porcelain. For example, one can still turn on color in
git-diff-files using the --color command line option. This
means we want the color config from color.diff.* (so that
once color is on, we use the user's preferred scheme), but
_not_ the color.diff variable.
We split the diff config into "ui" and "basic", where
"basic" is suitable for use by plumbing (so _most_ things
affecting the output should still go into the "ui" part).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-diff-files.c | patch | blob | history | |
builtin-diff-index.c | patch | blob | history | |
builtin-diff-tree.c | patch | blob | history | |
diff.c | patch | blob | history | |
diff.h | patch | blob | history |
diff --git a/builtin-diff-files.c b/builtin-diff-files.c
index 9c0411165691bb1c3a581e9927e124e55fbd7bfd..4abe3c28fbf98542db35c13f618b7088225740e9 100644 (file)
--- a/builtin-diff-files.c
+++ b/builtin-diff-files.c
prefix = setup_git_directory_gently(&nongit);
init_revisions(&rev, prefix);
- git_config(git_default_config); /* no "diff" UI options */
+ git_config(git_diff_basic_config); /* no "diff" UI options */
rev.abbrev = 0;
if (!setup_diff_no_index(&rev, argc, argv, nongit, prefix))
diff --git a/builtin-diff-index.c b/builtin-diff-index.c
index 0f2390a20a6a138388564cd5e0395aee0a48b59c..2b955deb912a38ccabb115f8d3a6c7feb815eb45 100644 (file)
--- a/builtin-diff-index.c
+++ b/builtin-diff-index.c
int result;
init_revisions(&rev, prefix);
- git_config(git_default_config); /* no "diff" UI options */
+ git_config(git_diff_basic_config); /* no "diff" UI options */
rev.abbrev = 0;
argc = setup_revisions(argc, argv, &rev, NULL);
diff --git a/builtin-diff-tree.c b/builtin-diff-tree.c
index ebc50efbd22f7fa294d66d73d7b2c3084931b4b7..832797ff3bb45751758f0d629abb2cf8fa4507ad 100644 (file)
--- a/builtin-diff-tree.c
+++ b/builtin-diff-tree.c
int read_stdin = 0;
init_revisions(opt, prefix);
- git_config(git_default_config); /* no "diff" UI options */
+ git_config(git_diff_basic_config); /* no "diff" UI options */
nr_sha1 = 0;
opt->abbrev = 0;
opt->diff = 1;
index 5bdc111378d61e5bdb13d1908217ab44bfc7967d..44aa477c41e2d6b68e43d3c74a7996bf21a630a9 100644 (file)
--- a/diff.c
+++ b/diff.c
return parse_funcname_pattern(var, ep, value);
}
}
+
+ return git_diff_basic_config(var, value);
+}
+
+int git_diff_basic_config(const char *var, const char *value)
+{
if (!prefixcmp(var, "diff.color.") || !prefixcmp(var, "color.diff.")) {
int slot = parse_diff_color_slot(var, 11);
color_parse(value, var, diff_colors[slot]);
index beccf85962b3f4cca9fa6b668fa904b59efbed52..073d5cbf1ba97acf527770d912870cda01195489 100644 (file)
--- a/diff.h
+++ b/diff.h
#define DIFF_SETUP_USE_CACHE 2
#define DIFF_SETUP_USE_SIZE_CACHE 4
+extern int git_diff_basic_config(const char *var, const char *value);
extern int git_diff_ui_config(const char *var, const char *value);
extern void diff_setup(struct diff_options *);
extern int diff_opt_parse(struct diff_options *, const char **, int);