@matheusbsbs / matheus-bagliano / commits / bf71b4b3ee
Fork 0

config: test for --replace-all with one argument and fix documentation.

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>

Carlos Rica committed Mar 17, 2009 at 10:46 UTC bf71b4b3ee07291e97c4dabfb97e7397eec904e0
3 files changed +10 -3
Documentation/git-config.txt
+1 -1
@@ -11,7 +11,7 @@ SYNOPSIS
11 [verse]
12 'git config' [<file-option>] [type] [-z|--null] name [value [value_regex]]
13 'git config' [<file-option>] [type] --add name value
14 -'git config' [<file-option>] [type] --replace-all name [value [value_regex]]
14 +'git config' [<file-option>] [type] --replace-all name value [value_regex]
15 'git config' [<file-option>] [type] [-z|--null] --get name [value_regex]
16 'git config' [<file-option>] [type] [-z|--null] --get-all name [value_regex]
17 'git config' [<file-option>] [type] [-z|--null] --get-regexp name_regex [value_regex]
builtin-config.c
+1 -1
@@ -55,7 +55,7 @@ static struct option builtin_config_options[] = {
55 OPT_BIT(0, "get", &actions, "get value: name [value-regex]", ACTION_GET),
56 OPT_BIT(0, "get-all", &actions, "get all values: key [value-regex]", ACTION_GET_ALL),
57 OPT_BIT(0, "get-regexp", &actions, "get values for regexp: name-regex [value-regex]", ACTION_GET_REGEXP),
58 - OPT_BIT(0, "replace-all", &actions, "replace all matching variables: name [value [value_regex]", ACTION_REPLACE_ALL),
58 + OPT_BIT(0, "replace-all", &actions, "replace all matching variables: name value [value_regex]", ACTION_REPLACE_ALL),
59 OPT_BIT(0, "add", &actions, "adds a new variable: name value", ACTION_ADD),
60 OPT_BIT(0, "unset", &actions, "removes a variable: name [value-regex]", ACTION_UNSET),
61 OPT_BIT(0, "unset-all", &actions, "removes all matches: name [value-regex]", ACTION_UNSET_ALL),
t/t1300-repo-config.sh
+8 -1
@@ -118,7 +118,14 @@ EOF
118
119 test_expect_success 'multiple unset is correct' 'cmp .git/config expect'
120
121 -mv .git/config2 .git/config
121 +cp .git/config2 .git/config
122 +
123 +test_expect_success '--replace-all missing value' '
124 + test_must_fail git config --replace-all beta.haha &&
125 + test_cmp .git/config2 .git/config
126 +'
127 +
128 +rm .git/config2
129
130 test_expect_success '--replace-all' \
131 'git config --replace-all beta.haha gamma'