Code

user-manual: the name of the hash function is SHA-1, not sha1
[git.git] / builtin-config.c
index 6dc205d1f439e8fb25129513ad7be0361df94df7..d8da72cf20fa01600b4ad9e6e7a78240b4b4c290 100644 (file)
@@ -55,7 +55,7 @@ static struct option builtin_config_options[] = {
        OPT_BIT(0, "get", &actions, "get value: name [value-regex]", ACTION_GET),
        OPT_BIT(0, "get-all", &actions, "get all values: key [value-regex]", ACTION_GET_ALL),
        OPT_BIT(0, "get-regexp", &actions, "get values for regexp: name-regex [value-regex]", ACTION_GET_REGEXP),
-       OPT_BIT(0, "replace-all", &actions, "replace all matching variables: name [value [value_regex]", ACTION_REPLACE_ALL),
+       OPT_BIT(0, "replace-all", &actions, "replace all matching variables: name value [value_regex]", ACTION_REPLACE_ALL),
        OPT_BIT(0, "add", &actions, "adds a new variable: name value", ACTION_ADD),
        OPT_BIT(0, "unset", &actions, "removes a variable: name [value-regex]", ACTION_UNSET),
        OPT_BIT(0, "unset-all", &actions, "removes all matches: name [value-regex]", ACTION_UNSET_ALL),
@@ -68,7 +68,7 @@ static struct option builtin_config_options[] = {
        OPT_GROUP("Type"),
        OPT_BIT(0, "bool", &types, "value is \"true\" or \"false\"", TYPE_BOOL),
        OPT_BIT(0, "int", &types, "value is decimal number", TYPE_INT),
-       OPT_BIT(0, "bool-or-int", &types, NULL, TYPE_BOOL_OR_INT),
+       OPT_BIT(0, "bool-or-int", &types, "value is --bool or --int", TYPE_BOOL_OR_INT),
        OPT_GROUP("Other"),
        OPT_BOOLEAN('z', "null", &end_null, "terminate values with NUL byte"),
        OPT_END(),
@@ -360,6 +360,11 @@ int cmd_config(int argc, const char **argv, const char *unused_prefix)
        if (get_colorbool_slot)
            actions |= ACTION_GET_COLORBOOL;
 
+       if ((get_color_slot || get_colorbool_slot) && types) {
+               error("--get-color and variable type are incoherent");
+               usage_with_options(builtin_config_usage, builtin_config_options);
+       }
+
        if (HAS_MULTI_BITS(actions)) {
                error("only one action at a time.");
                usage_with_options(builtin_config_usage, builtin_config_options);
@@ -374,6 +379,7 @@ int cmd_config(int argc, const char **argv, const char *unused_prefix)
                }
 
        if (actions == ACTION_LIST) {
+               check_argc(argc, 0, 0);
                if (git_config(show_all_config, NULL) < 0) {
                        if (config_exclusive_filename)
                                die("unable to read config file %s: %s",
@@ -383,6 +389,7 @@ int cmd_config(int argc, const char **argv, const char *unused_prefix)
                }
        }
        else if (actions == ACTION_EDIT) {
+               check_argc(argc, 0, 0);
                git_config(git_default_config, NULL);
                launch_editor(config_exclusive_filename ?
                              config_exclusive_filename : git_path("config"),