As suggested by Johannes Schindelin. Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx> --- builtin-config.c | 27 +++++++++++---------------- 1 files changed, 11 insertions(+), 16 deletions(-) diff --git a/builtin-config.c b/builtin-config.c index 3463b1c..677ae3f 100644 --- a/builtin-config.c +++ b/builtin-config.c @@ -308,6 +308,7 @@ int cmd_config(int argc, const char **argv, const char *unused_prefix) { int nongit; char* value; + int ret = 0; const char *prefix = setup_git_directory_gently(&nongit); config_exclusive_filename = getenv(CONFIG_ENVIRONMENT); @@ -392,55 +393,49 @@ int cmd_config(int argc, const char **argv, const char *unused_prefix) else if (actions & ACTION_ADD) { check_argc(argc, 2, 2); value = normalize_value(argv[0], argv[1]); - return git_config_set_multivar(argv[0], value, "^$", 0); + ret = git_config_set_multivar(argv[0], value, "^$", 0); } else if (actions & ACTION_REPLACE_ALL) { check_argc(argc, 2, 3); value = normalize_value(argv[0], argv[1]); - return git_config_set_multivar(argv[0], value, argv[2], 1); + ret = git_config_set_multivar(argv[0], value, argv[2], 1); } else if (actions & ACTION_GET) { check_argc(argc, 1, 2); - return get_value(argv[0], argv[1]); + ret = get_value(argv[0], argv[1]); } else if (actions & ACTION_GET_ALL) { do_all = 1; check_argc(argc, 1, 2); - return get_value(argv[0], argv[1]); + ret = get_value(argv[0], argv[1]); } else if (actions & ACTION_GET_REGEXP) { show_keys = 1; use_key_regexp = 1; do_all = 1; check_argc(argc, 1, 2); - return get_value(argv[0], argv[1]); + ret = get_value(argv[0], argv[1]); } else if (actions & ACTION_UNSET) { check_argc(argc, 1, 2); if (argc == 2) - return git_config_set_multivar(argv[0], NULL, argv[1], 0); + ret = git_config_set_multivar(argv[0], NULL, argv[1], 0); else - return git_config_set(argv[0], NULL); + ret = git_config_set(argv[0], NULL); } else if (actions & ACTION_UNSET_ALL) { check_argc(argc, 1, 2); - return git_config_set_multivar(argv[0], NULL, argv[1], 1); + ret = git_config_set_multivar(argv[0], NULL, argv[1], 1); } else if (actions & ACTION_RENAME_SECTION) { - int ret; check_argc(argc, 2, 2); ret = git_config_rename_section(argv[0], argv[1]); - if (ret < 0) - return ret; if (ret == 0) die("No such section!"); } else if (actions & ACTION_REMOVE_SECTION) { - int ret; check_argc(argc, 1, 1); ret = git_config_rename_section(argv[0], NULL); - if (ret < 0) - return ret; if (ret == 0) die("No such section!"); } @@ -452,8 +447,8 @@ int cmd_config(int argc, const char **argv, const char *unused_prefix) stdout_is_tty = git_config_bool("command line", argv[0]); else if (argc == 0) stdout_is_tty = isatty(1); - return get_colorbool(argc != 1); + ret = get_colorbool(argc != 1); } - return 0; + return !!ret; } -- 1.6.1.3 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html