Skip to content

Commit 2a47241

Browse files
peffgitster
authored andcommitted
t0001: use test_config_global
We hand-set several config options using : git config -f $HOME/.gitconfig ... Instead, we can use "test_config_global". Not only is this more readable, but it cleans up for us so that subsequent tests aren't polluted by our settings. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 633734d commit 2a47241

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

t/t0001-init.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,8 @@ test_expect_success 'init with --template (blank)' '
211211
test_expect_success 'init with init.templatedir set' '
212212
mkdir templatedir-source &&
213213
echo Content >templatedir-source/file &&
214+
test_config_global init.templatedir "${HOME}/templatedir-source" &&
214215
(
215-
test_config="${HOME}/.gitconfig" &&
216-
git config -f "$test_config" init.templatedir "${HOME}/templatedir-source" &&
217216
mkdir templatedir-set &&
218217
cd templatedir-set &&
219218
sane_unset GIT_TEMPLATE_DIR &&
@@ -225,10 +224,9 @@ test_expect_success 'init with init.templatedir set' '
225224
'
226225

227226
test_expect_success 'init --bare/--shared overrides system/global config' '
227+
test_config_global core.bare false &&
228+
test_config_global core.sharedRepository 0640 &&
228229
(
229-
test_config="$HOME"/.gitconfig &&
230-
git config -f "$test_config" core.bare false &&
231-
git config -f "$test_config" core.sharedRepository 0640 &&
232230
mkdir init-bare-shared-override &&
233231
cd init-bare-shared-override &&
234232
git init --bare --shared=0666
@@ -239,9 +237,8 @@ test_expect_success 'init --bare/--shared overrides system/global config' '
239237
'
240238

241239
test_expect_success 'init honors global core.sharedRepository' '
240+
test_config_global core.sharedRepository 0666 &&
242241
(
243-
test_config="$HOME"/.gitconfig &&
244-
git config -f "$test_config" core.sharedRepository 0666 &&
245242
mkdir shared-honor-global &&
246243
cd shared-honor-global &&
247244
git init

0 commit comments

Comments
 (0)