]> Pileus Git - ~andy/git/commitdiff
config: test for --replace-all with one argument and fix documentation.
authorCarlos Rica <jasampler@gmail.com>
Tue, 17 Mar 2009 09:46:37 +0000 (10:46 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 17 Mar 2009 16:30:00 +0000 (09:30 -0700)
Option --replace-all only allows at least two arguments, so
documentation was needing to be updated accordingly. A test showing
that the command fails with only one parameter is also provided.

Signed-off-by: Carlos Rica <jasampler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-config.txt
builtin-config.c
t/t1300-repo-config.sh

index 7d140073b13224d0763a6f62f58fc765bfbf0003..8b94f19b170ba86cf44b91a5be4ceae7888b1fa7 100644 (file)
@@ -11,7 +11,7 @@ SYNOPSIS
 [verse]
 'git config' [<file-option>] [type] [-z|--null] name [value [value_regex]]
 'git config' [<file-option>] [type] --add name value
-'git config' [<file-option>] [type] --replace-all name [value [value_regex]]
+'git config' [<file-option>] [type] --replace-all name value [value_regex]
 'git config' [<file-option>] [type] [-z|--null] --get name [value_regex]
 'git config' [<file-option>] [type] [-z|--null] --get-all name [value_regex]
 'git config' [<file-option>] [type] [-z|--null] --get-regexp name_regex [value_regex]
index 1a3baa1f46f663580a3817c68353a262637560fa..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),
index 11b82f43dd0220c736dd269b2f6531a1381edf3a..f0a75380b3fbb82b78f42b8ea7c24e9e8af2a24f 100755 (executable)
@@ -118,7 +118,14 @@ EOF
 
 test_expect_success 'multiple unset is correct' 'cmp .git/config expect'
 
-mv .git/config2 .git/config
+cp .git/config2 .git/config
+
+test_expect_success '--replace-all missing value' '
+       test_must_fail git config --replace-all beta.haha &&
+       test_cmp .git/config2 .git/config
+'
+
+rm .git/config2
 
 test_expect_success '--replace-all' \
        'git config --replace-all beta.haha gamma'