summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: aa38740)
raw | patch | inline | side by side (parent: aa38740)
author | Felipe Contreras <felipe.contreras@gmail.com> | |
Sat, 21 Feb 2009 00:48:56 +0000 (02:48 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 22 Feb 2009 04:36:07 +0000 (20:36 -0800) |
Essentially this replaces 'file' with 'prefix' in the cases where the
variable is used as a prefix, which is consistent with other git
commands.
When using the --list option general errors where not properly reported,
only errors related with the 'file'. Now they are reported, and 'file'
is irrelevant.
That reduces the rest of 'file' usage to nothing, therefore now only
'prefix' remains.
Suggested by Johannes Schindelin.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
variable is used as a prefix, which is consistent with other git
commands.
When using the --list option general errors where not properly reported,
only errors related with the 'file'. Now they are reported, and 'file'
is irrelevant.
That reduces the rest of 'file' usage to nothing, therefore now only
'prefix' remains.
Suggested by Johannes Schindelin.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-config.c | patch | blob | history |
diff --git a/builtin-config.c b/builtin-config.c
index d52a05744487182cfcd9e974ad1fb8c65e3eca89..5074c6123ecee476460a34198d19ca4de676b349 100644 (file)
--- a/builtin-config.c
+++ b/builtin-config.c
static int get_color_found;
static const char *get_color_slot;
+static const char *get_colorbool_slot;
static char parsed_color[COLOR_MAXLEN];
static int git_get_color_config(const char *var, const char *value, void *cb)
static int git_get_colorbool_config(const char *var, const char *value,
void *cb)
{
- if (!strcmp(var, get_color_slot)) {
+ if (!strcmp(var, get_colorbool_slot)) {
get_colorbool_found =
git_config_colorbool(var, value, stdout_is_tty);
}
usage(git_config_set_usage);
get_colorbool_found = -1;
get_diff_color_found = -1;
- get_color_slot = argv[0];
+ get_colorbool_slot = argv[0];
git_config(git_get_colorbool_config, NULL);
if (get_colorbool_found < 0) {
- if (!strcmp(get_color_slot, "color.diff"))
+ if (!strcmp(get_colorbool_slot, "color.diff"))
get_colorbool_found = get_diff_color_found;
if (get_colorbool_found < 0)
get_colorbool_found = git_use_color_default;
}
}
-int cmd_config(int argc, const char **argv, const char *prefix)
+int cmd_config(int argc, const char **argv, const char *unused_prefix)
{
int nongit;
char *value;
- const char *file = setup_git_directory_gently(&nongit);
+ const char *prefix = setup_git_directory_gently(&nongit);
config_exclusive_filename = getenv(CONFIG_ENVIRONMENT);
else if (!strcmp(argv[1], "--list") || !strcmp(argv[1], "-l")) {
if (argc != 2)
usage(git_config_set_usage);
- if (git_config(show_all_config, NULL) < 0 &&
- file && errno)
- die("unable to read config file %s: %s", file,
- strerror(errno));
+ if (git_config(show_all_config, NULL) < 0) {
+ if (config_exclusive_filename)
+ die("unable to read config file %s: %s",
+ config_exclusive_filename, strerror(errno));
+ else
+ die("error processing config file(s)");
+ }
return 0;
}
else if (!strcmp(argv[1], "--global")) {
else if (!strcmp(argv[1], "--file") || !strcmp(argv[1], "-f")) {
if (argc < 3)
usage(git_config_set_usage);
- if (!is_absolute_path(argv[2]) && file)
- file = prefix_filename(file, strlen(file),
- argv[2]);
+ if (!is_absolute_path(argv[2]) && prefix)
+ config_exclusive_filename = prefix_filename(prefix,
+ strlen(prefix),
+ argv[2]);
else
- file = argv[2];
- config_exclusive_filename = file;
+ config_exclusive_filename = argv[2];
argc--;
argv++;
}