push test: use test_config when appropriate
Configuration from test_config does not last beyond the end of the current test assertion, making each test easier to think about in isolation. This changes the meaning of some of the tests. For example, currently "push with insteadOf" passes even if the line setting "url.$TRASH.pushInsteadOf" is dropped because an url.$TRASH.insteadOf setting leaks in from a previous test. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jonathan Nieder committed
Mar 18, 2013 at 16:12 UTC
3c695523384855dffba49aec7f0a77e555ced822
1 file changed
+10
-17
t/t5516-fetch-push.sh
+10
-17
@@ -203,7 +203,7 @@ test_expect_success 'push with wildcard' '
203
test_expect_success 'push with insteadOf' '
204
mk_empty &&
205
TRASH="$(pwd)/" &&
206
- git config "url.$TRASH.insteadOf" trash/ &&
206
+ test_config "url.$TRASH.insteadOf" trash/ &&
207
git push trash/testrepo refs/heads/master:refs/remotes/origin/master &&
208
(
209
cd testrepo &&
@@ -217,7 +217,7 @@ test_expect_success 'push with insteadOf' '
217
test_expect_success 'push with pushInsteadOf' '
218
mk_empty &&
219
TRASH="$(pwd)/" &&
220
- git config "url.$TRASH.pushInsteadOf" trash/ &&
220
+ test_config "url.$TRASH.pushInsteadOf" trash/ &&
221
git push trash/testrepo refs/heads/master:refs/remotes/origin/master &&
222
(
223
cd testrepo &&
@@ -231,9 +231,9 @@ test_expect_success 'push with pushInsteadOf' '
231
test_expect_success 'push with pushInsteadOf and explicit pushurl (pushInsteadOf should not rewrite)' '
232
mk_empty &&
233
TRASH="$(pwd)/" &&
234
- git config "url.trash2/.pushInsteadOf" trash/ &&
235
- git config remote.r.url trash/wrong &&
236
- git config remote.r.pushurl "$TRASH/testrepo" &&
234
+ test_config "url.trash2/.pushInsteadOf" trash/ &&
235
+ test_config remote.r.url trash/wrong &&
236
+ test_config remote.r.pushurl "$TRASH/testrepo" &&
237
git push r refs/heads/master:refs/remotes/origin/master &&
238
(
239
cd testrepo &&
@@ -489,31 +489,24 @@ test_expect_success 'push with config remote.*.push = HEAD' '
489
git checkout local &&
490
git reset --hard $the_first_commit
491
) &&
492
- git config remote.there.url testrepo &&
493
- git config remote.there.push HEAD &&
494
- git config branch.master.remote there &&
492
+ test_config remote.there.url testrepo &&
493
+ test_config remote.there.push HEAD &&
494
+ test_config branch.master.remote there &&
495
git push &&
496
check_push_result $the_commit heads/master &&
497
check_push_result $the_first_commit heads/local
498
'
499
500
-# clean up the cruft left with the previous one
501
-git config --remove-section remote.there
502
-git config --remove-section branch.master
503
-
500
test_expect_success 'push with config remote.*.pushurl' '
501
502
mk_test heads/master &&
503
git checkout master &&
508
- git config remote.there.url test2repo &&
509
- git config remote.there.pushurl testrepo &&
504
+ test_config remote.there.url test2repo &&
505
+ test_config remote.there.pushurl testrepo &&
506
git push there &&
507
check_push_result $the_commit heads/master
508
'
509
514
-# clean up the cruft left with the previous one
515
-git config --remove-section remote.there
516
-
510
test_expect_success 'push with dry-run' '
511
512
mk_test heads/master &&