3 # Copyright (c) 2005 Johannes Schindelin
6 test_description='Test git-config-set in different settings'
10 test -f .git/config && rm .git/config
12 git-config-set core.penguin "little blue"
16 # This is the config file
23 test_expect_success 'initial' 'cmp .git/config expect'
25 git-config-set Core.Movie BadPhysics
29 # This is the config file
37 test_expect_success 'mixed case' 'cmp .git/config expect'
39 git-config-set Cores.WhatEver Second
43 # This is the config file
53 test_expect_success 'similar section' 'cmp .git/config expect'
55 git-config-set CORE.UPPERCASE true
59 # This is the config file
70 test_expect_success 'similar section' 'cmp .git/config expect'
72 cat > .git/config << EOF
73 [beta] ; silly comment # another comment
74 noIndent= sillyValue ; 'nother silly comment
78 haha ="beta" # last silly comment
79 [nextSection] noNewline = ouch
82 git-config-set beta.haha alpha
85 [beta] ; silly comment # another comment
86 noIndent= sillyValue ; 'nother silly comment
91 [nextSection] noNewline = ouch
94 test_expect_success 'really mean test' 'cmp .git/config expect'
96 git-config-set nextsection.nonewline wow
99 [beta] ; silly comment # another comment
100 noIndent= sillyValue ; 'nother silly comment
109 test_expect_success 'really really mean test' 'cmp .git/config expect'
111 git-config-set beta.haha
114 [beta] ; silly comment # another comment
115 noIndent= sillyValue ; 'nother silly comment
123 test_expect_success 'unset' 'cmp .git/config expect'
125 git-config-set nextsection.NoNewLine "wow2 for me" "for me$"
128 [beta] ; silly comment # another comment
129 noIndent= sillyValue ; 'nother silly comment
135 NoNewLine = wow2 for me
138 test_expect_success 'multivar' 'cmp .git/config expect'
140 git-config-set nextsection.nonewline "wow3" "wow$"
143 [beta] ; silly comment # another comment
144 noIndent= sillyValue ; 'nother silly comment
150 NoNewLine = wow2 for me
153 test_expect_success 'multivar replace' 'cmp .git/config expect'
155 test_expect_failure 'ambiguous unset' \
156 'git-config-set --unset nextsection.nonewline'
158 test_expect_failure 'invalid unset' \
159 'git-config-set --unset somesection.nonewline'
161 git-config-set --unset nextsection.nonewline "wow3$"
164 [beta] ; silly comment # another comment
165 noIndent= sillyValue ; 'nother silly comment
170 NoNewLine = wow2 for me
173 test_expect_success 'multivar unset' 'cmp .git/config expect'
175 test_expect_failure 'invalid key' 'git-config-set inval.2key blabla'
177 test_expect_success 'correct key' 'git-config-set 123456.a123 987'