Client side support for user-relative paths.
[git.git] / t1300-config-set.sh
blobdf89216b19f4320d84c6cd23f45943b11507d3b6
1 #!/bin/sh
3 # Copyright (c) 2005 Johannes Schindelin
6 test_description='Test git-config-set in different settings'
8 . ./test-lib.sh
10 test -f .git/config && rm .git/config
12 git-config-set core.penguin "little blue"
14 cat > expect << EOF
16 # This is the config file
19 [core]
20 penguin = little blue
21 EOF
23 test_expect_success 'initial' 'cmp .git/config expect'
25 git-config-set Core.Movie BadPhysics
27 cat > expect << EOF
29 # This is the config file
32 [core]
33 penguin = little blue
34 Movie = BadPhysics
35 EOF
37 test_expect_success 'mixed case' 'cmp .git/config expect'
39 git-config-set Cores.WhatEver Second
41 cat > expect << EOF
43 # This is the config file
46 [core]
47 penguin = little blue
48 Movie = BadPhysics
49 [Cores]
50 WhatEver = Second
51 EOF
53 test_expect_success 'similar section' 'cmp .git/config expect'
55 git-config-set CORE.UPPERCASE true
57 cat > expect << EOF
59 # This is the config file
62 [core]
63 penguin = little blue
64 Movie = BadPhysics
65 UPPERCASE = true
66 [Cores]
67 WhatEver = Second
68 EOF
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
76 # empty line
77 ; comment
78 haha ="beta" # last silly comment
79 [nextSection] noNewline = ouch
80 EOF
82 git-config-set beta.haha alpha
84 cat > expect << EOF
85 [beta] ; silly comment # another comment
86 noIndent= sillyValue ; 'nother silly comment
88 # empty line
89 ; comment
90 haha = alpha
91 [nextSection] noNewline = ouch
92 EOF
94 test_expect_success 'really mean test' 'cmp .git/config expect'
96 git-config-set nextsection.nonewline wow
98 cat > expect << EOF
99 [beta] ; silly comment # another comment
100 noIndent= sillyValue ; 'nother silly comment
102 # empty line
103 ; comment
104 haha = alpha
105 [nextSection]
106 nonewline = wow
109 test_expect_success 'really really mean test' 'cmp .git/config expect'
111 git-config-set beta.haha
113 cat > expect << EOF
114 [beta] ; silly comment # another comment
115 noIndent= sillyValue ; 'nother silly comment
117 # empty line
118 ; comment
119 [nextSection]
120 nonewline = wow
123 test_expect_success 'unset' 'cmp .git/config expect'
125 git-config-set nextsection.NoNewLine "wow2 for me" "for me$"
127 cat > expect << EOF
128 [beta] ; silly comment # another comment
129 noIndent= sillyValue ; 'nother silly comment
131 # empty line
132 ; comment
133 [nextSection]
134 nonewline = wow
135 NoNewLine = wow2 for me
138 test_expect_success 'multivar' 'cmp .git/config expect'
140 git-config-set nextsection.nonewline "wow3" "wow$"
142 cat > expect << EOF
143 [beta] ; silly comment # another comment
144 noIndent= sillyValue ; 'nother silly comment
146 # empty line
147 ; comment
148 [nextSection]
149 nonewline = wow3
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$"
163 cat > expect << EOF
164 [beta] ; silly comment # another comment
165 noIndent= sillyValue ; 'nother silly comment
167 # empty line
168 ; comment
169 [nextSection]
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'
179 test_done