Merge branch 'fl/config'
authorJunio C Hamano <gitster@pobox.com>
Sun, 1 Jul 2007 06:49:01 +0000 (23:49 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 1 Jul 2007 06:49:01 +0000 (23:49 -0700)
* fl/config:
config: add support for --bool and --int while setting values

1  2 
t/t1300-repo-config.sh
diff --combined t/t1300-repo-config.sh
index 27486de4de40c7d2c44a318890040cd35c560379,9443b875e2d802f05ce384dc8a230bce56ea1bcd..a2c11c4639a9e611c305b9eb2abb63099dbac1ef
@@@ -471,11 -471,57 +471,57 @@@ test_expect_success bool 
          done &&
        cmp expect result'
  
- test_expect_failure 'invalid bool' '
+ test_expect_failure 'invalid bool (--get)' '
  
        git-config bool.nobool foobar &&
        git-config --bool --get bool.nobool'
  
+ test_expect_failure 'invalid bool (set)' '
+       git-config --bool bool.nobool foobar'
+ rm .git/config
+ cat > expect <<\EOF
+ [bool]
+       true1 = true
+       true2 = true
+       true3 = true
+       true4 = true
+       false1 = false
+       false2 = false
+       false3 = false
+       false4 = false
+ EOF
+ test_expect_success 'set --bool' '
+       git-config --bool bool.true1 01 &&
+       git-config --bool bool.true2 -1 &&
+       git-config --bool bool.true3 YeS &&
+       git-config --bool bool.true4 true &&
+       git-config --bool bool.false1 000 &&
+       git-config --bool bool.false2 "" &&
+       git-config --bool bool.false3 nO &&
+       git-config --bool bool.false4 FALSE &&
+       cmp expect .git/config'
+ rm .git/config
+ cat > expect <<\EOF
+ [int]
+       val1 = 1
+       val2 = -1
+       val3 = 5242880
+ EOF
+ test_expect_success 'set --int' '
+       git-config --int int.val1 01 &&
+       git-config --int int.val2 -1 &&
+       git-config --int int.val3 5m &&
+       cmp expect .git/config'
  rm .git/config
  
  git-config quote.leading " test"
@@@ -529,23 -575,25 +575,23 @@@ cat > .git/config <<\EO
  EOF
  
  cat > expect <<\EOF
 -Key: section.sub=section.val1
 -Value: foo=bar
 -Key: section.sub=section.val2
 -Value: foo
 -bar
 -Key: section.sub=section.val3
 -Value: 
 +section.sub=section.val1
 +foo=barQsection.sub=section.val2
 +foo
 +barQsection.sub=section.val3
  
  
 -Key: section.sub=section.val4
 -Value: 
 -Key: section.sub=section.val5
 +Qsection.sub=section.val4
 +Qsection.sub=section.val5Q
  EOF
  
 -git config --null --list | perl -0ne 'chop;($key,$value)=split(/\n/,$_,2);print "Key: $key\n";print "Value: $value\n" if defined($value)' > result
 +git config --null --list | tr '[\000]' 'Q' > result
 +echo >>result
  
  test_expect_success '--null --list' 'cmp result expect'
  
 -git config --null --get-regexp 'val[0-9]' | perl -0ne 'chop;($key,$value)=split(/\n/,$_,2);print "Key: $key\n";print "Value: $value\n" if defined($value)' > result
 +git config --null --get-regexp 'val[0-9]' | tr '[\000]' 'Q' > result
 +echo >>result
  
  test_expect_success '--null --get-regexp' 'cmp result expect'