Skip to content

Commit ec141d6

Browse files
committed
Merge branch 'ma/config-bool-valex' into pu
* ma/config-bool-valex: builtin/config: die if "value_regex" doesn't canonicalize as boolean
2 parents dd64109 + d5c3825 commit ec141d6

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

Documentation/git-config.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,10 @@ outgoing values are canonicalize-able under the given <type>. If no
4343
`--type=<type>` is given, no canonicalization will be performed. Callers may
4444
unset an existing `--type` specifier with `--no-type`.
4545

46-
With `--type=bool` or `--type=bool-or-int`, if `value_regex` is given
46+
With `--type=bool-or-int`, if `value_regex` is given
4747
and canonicalizes to a boolean value, it matches all entries
4848
that canonicalize to the same boolean value.
49-
The support for non-canonicalizing values of `value_regex` with
50-
`--type=bool` is deprecated.
49+
With `--type=bool`, `value_regex` (if given) must canonicalize.
5150

5251
When reading, the values are read from the system, global and
5352
repository local configuration files by default, and options

builtin/config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ static int handle_value_regex(const char *regex_)
303303
cmd_line_value.boolean = boolval;
304304
return 0;
305305
}
306-
warning(_("value_regex '%s' cannot be canonicalized "
307-
"to a boolean value"), regex_);
306+
die(_("value_regex '%s' cannot be canonicalized "
307+
"to a boolean value"), regex_);
308308
}
309309

310310
if (type == TYPE_BOOL_OR_INT) {

t/t1300-config.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -465,11 +465,8 @@ test_expect_success '--get canonicalizes integer value_regex with --type=bool' '
465465
'
466466

467467
test_expect_success '--type=bool with "non-bool" value_regex' '
468-
echo true >expect &&
469-
git config --type=bool --get foo.y4 "t.*" >output 2>err &&
470-
test_cmp expect output &&
468+
test_must_fail git config --type=bool --get foo.y4 t >output 2>err &&
471469
test_i18ngrep "cannot be canonicalized" err &&
472-
test_must_fail git config --type=bool --get foo.y4 "T.*" >output &&
473470
test_must_be_empty output
474471
'
475472

0 commit comments

Comments
 (0)