diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-04-13 12:11:11 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-04-13 12:11:11 -0700 |
commit | c35b0b5884a12685aa794e00f51bc7dfaa0dd91c (patch) | |
tree | f1e76be5163a7bc4606380ebf3cff7922f18d27d /t/t1300-repo-config.sh | |
parent | f43e2fd43b50d5a82a34bb3e4f848cb38bf93b7f (diff) | |
download | git-c35b0b5884a12685aa794e00f51bc7dfaa0dd91c.tar.gz git-c35b0b5884a12685aa794e00f51bc7dfaa0dd91c.tar.xz |
Fix git_config_bool_or_int
The earlier one botched the return value logic between config_bool and
config_bool_and_int. The former should normalize between 0 and 1 while
the latter should give back full range of integer values.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1300-repo-config.sh')
-rwxr-xr-x | t/t1300-repo-config.sh | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index b36a9012e..a675cbb51 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -595,6 +595,64 @@ test_expect_success 'set --int' ' rm .git/config +cat >expect <<\EOF +[bool] + true1 = true + true2 = true + false1 = false + false2 = false +[int] + int1 = 0 + int2 = 1 + int3 = -1 +EOF + +test_expect_success 'get --bool-or-int' ' + ( + echo "[bool]" + echo true1 + echo true2 = true + echo false = false + echo "[int]" + echo int1 = 0 + echo int2 = 1 + echo int3 = -1 + ) >>.git/config && + test $(git config --bool-or-int bool.true1) = true && + test $(git config --bool-or-int bool.true2) = true && + test $(git config --bool-or-int bool.false) = false && + test $(git config --bool-or-int int.int1) = 0 && + test $(git config --bool-or-int int.int2) = 1 && + test $(git config --bool-or-int int.int3) = -1 + +' + +rm .git/config +cat >expect <<\EOF +[bool] + true1 = true + false1 = false + true2 = true + false2 = false +[int] + int1 = 0 + int2 = 1 + int3 = -1 +EOF + +test_expect_success 'set --bool-or-int' ' + git config --bool-or-int bool.true1 true && + git config --bool-or-int bool.false1 false && + git config --bool-or-int bool.true2 yes && + git config --bool-or-int bool.false2 no && + git config --bool-or-int int.int1 0 && + git config --bool-or-int int.int2 1 && + git config --bool-or-int int.int3 -1 && + test_cmp expect .git/config +' + +rm .git/config + git config quote.leading " test" git config quote.ending "test " git config quote.semicolon "test;test" |