@@ -13,7 +13,7 @@ cleanup_fail() {
13
13
14
14
test_expect_success ' setup' '
15
15
sane_unset GIT_PAGER GIT_PAGER_IN_USE &&
16
- test_might_fail git config --unset core.pager &&
16
+ test_unconfig core.pager &&
17
17
18
18
PAGER="cat >paginated.out" &&
19
19
export PAGER &&
@@ -94,30 +94,27 @@ test_expect_success TTY 'no pager with --no-pager' '
94
94
95
95
test_expect_success TTY ' configuration can disable pager' '
96
96
rm -f paginated.out &&
97
- test_might_fail git config --unset pager.grep &&
97
+ test_unconfig pager.grep &&
98
98
test_terminal git grep initial &&
99
99
test -e paginated.out &&
100
100
101
101
rm -f paginated.out &&
102
- git config pager.grep false &&
103
- test_when_finished "git config --unset pager.grep" &&
102
+ test_config pager.grep false &&
104
103
test_terminal git grep initial &&
105
104
! test -e paginated.out
106
105
'
107
106
108
107
test_expect_success TTY ' git config uses a pager if configured to' '
109
108
rm -f paginated.out &&
110
- git config pager.config true &&
111
- test_when_finished "git config --unset pager.config" &&
109
+ test_config pager.config true &&
112
110
test_terminal git config --list &&
113
111
test -e paginated.out
114
112
'
115
113
116
114
test_expect_success TTY ' configuration can enable pager (from subdir)' '
117
115
rm -f paginated.out &&
118
116
mkdir -p subdir &&
119
- git config pager.bundle true &&
120
- test_when_finished "git config --unset pager.bundle" &&
117
+ test_config pager.bundle true &&
121
118
122
119
git bundle create test.bundle --all &&
123
120
rm -f paginated.out subdir/paginated.out &&
@@ -150,7 +147,7 @@ test_expect_success 'tests can detect color' '
150
147
151
148
test_expect_success ' no color when stdout is a regular file' '
152
149
rm -f colorless.log &&
153
- git config color.ui auto ||
150
+ test_config color.ui auto ||
154
151
cleanup_fail &&
155
152
156
153
git log >colorless.log &&
@@ -159,7 +156,7 @@ test_expect_success 'no color when stdout is a regular file' '
159
156
160
157
test_expect_success TTY ' color when writing to a pager' '
161
158
rm -f paginated.out &&
162
- git config color.ui auto ||
159
+ test_config color.ui auto ||
163
160
cleanup_fail &&
164
161
165
162
(
@@ -172,7 +169,7 @@ test_expect_success TTY 'color when writing to a pager' '
172
169
173
170
test_expect_success ' color when writing to a file intended for a pager' '
174
171
rm -f colorful.log &&
175
- git config color.ui auto ||
172
+ test_config color.ui auto ||
176
173
cleanup_fail &&
177
174
178
175
(
@@ -221,7 +218,7 @@ test_default_pager() {
221
218
222
219
$test_expectation SIMPLEPAGER,TTY " $cmd - default pager is used by default" "
223
220
sane_unset PAGER GIT_PAGER &&
224
- test_might_fail git config --unset core.pager &&
221
+ test_unconfig core.pager &&
225
222
rm -f default_pager_used ||
226
223
cleanup_fail &&
227
224
@@ -244,7 +241,7 @@ test_PAGER_overrides() {
244
241
245
242
$test_expectation TTY " $cmd - PAGER overrides default pager" "
246
243
sane_unset GIT_PAGER &&
247
- test_might_fail git config --unset core.pager &&
244
+ test_unconfig core.pager &&
248
245
rm -f PAGER_used ||
249
246
cleanup_fail &&
250
247
@@ -277,7 +274,7 @@ test_core_pager() {
277
274
278
275
PAGER=wc &&
279
276
export PAGER &&
280
- git config core.pager 'wc >core.pager_used' &&
277
+ test_config core.pager 'wc >core.pager_used' &&
281
278
$full_command &&
282
279
${if_local_config} test -e core.pager_used
283
280
"
@@ -307,7 +304,7 @@ test_pager_subdir_helper() {
307
304
PAGER=wc &&
308
305
stampname=\$ (pwd)/core.pager_used &&
309
306
export PAGER stampname &&
310
- git config core.pager 'wc >\"\$ stampname\" ' &&
307
+ test_config core.pager 'wc >\"\$ stampname\" ' &&
311
308
mkdir sub &&
312
309
(
313
310
cd sub &&
@@ -324,7 +321,7 @@ test_GIT_PAGER_overrides() {
324
321
rm -f GIT_PAGER_used ||
325
322
cleanup_fail &&
326
323
327
- git config core.pager wc &&
324
+ test_config core.pager wc &&
328
325
GIT_PAGER='wc >GIT_PAGER_used' &&
329
326
export GIT_PAGER &&
330
327
$full_command &&
@@ -405,8 +402,8 @@ test_expect_success TTY 'command-specific pager' '
405
402
sane_unset PAGER GIT_PAGER &&
406
403
echo "foo:initial" >expect &&
407
404
>actual &&
408
- git config --unset core.pager &&
409
- git config pager.log "sed s/^/foo:/ >actual" &&
405
+ test_unconfig core.pager &&
406
+ test_config pager.log "sed s/^/foo:/ >actual" &&
410
407
test_terminal git log --format=%s -1 &&
411
408
test_cmp expect actual
412
409
'
@@ -415,8 +412,8 @@ test_expect_success TTY 'command-specific pager overrides core.pager' '
415
412
sane_unset PAGER GIT_PAGER &&
416
413
echo "foo:initial" >expect &&
417
414
>actual &&
418
- git config core.pager "exit 1"
419
- git config pager.log "sed s/^/foo:/ >actual" &&
415
+ test_config core.pager "exit 1"
416
+ test_config pager.log "sed s/^/foo:/ >actual" &&
420
417
test_terminal git log --format=%s -1 &&
421
418
test_cmp expect actual
422
419
'
@@ -425,7 +422,7 @@ test_expect_success TTY 'command-specific pager overridden by environment' '
425
422
GIT_PAGER="sed s/^/foo:/ >actual" && export GIT_PAGER &&
426
423
>actual &&
427
424
echo "foo:initial" >expect &&
428
- git config pager.log "exit 1" &&
425
+ test_config pager.log "exit 1" &&
429
426
test_terminal git log --format=%s -1 &&
430
427
test_cmp expect actual
431
428
'
0 commit comments