t: use test_config in t4055

Use the modern "test_config" test utility instead of manual"git config" as the former provides clean up on test completion. This is a prerequisite to the commits that follow which add to this test file. Signed-off-by: Leon Michalak <leonmichalak6@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Leon Michalak committed Jul 29, 2025 at 07:01 UTC 97b99a9eb6b3fec7ff46ab68af423b9a08d5a264
1 file changed +7 -7
t/t4055-diff-context.sh
+7 -7
@@ -47,43 +47,43 @@ test_expect_success 'the default number of context lines is 3' '
47 test_expect_success 'diff.context honored by "log"' '
48 git log -1 -p >output &&
49 test_grep ! firstline output &&
50 - git config diff.context 8 &&
50 + test_config diff.context 8 &&
51 git log -1 -p >output &&
52 test_grep "^ firstline" output
53 '
54
55 test_expect_success 'The -U option overrides diff.context' '
56 - git config diff.context 8 &&
56 + test_config diff.context 8 &&
57 git log -U4 -1 >output &&
58 test_grep ! "^ firstline" output
59 '
60
61 test_expect_success 'diff.context honored by "diff"' '
62 - git config diff.context 8 &&
62 + test_config diff.context 8 &&
63 git diff >output &&
64 test_grep "^ firstline" output
65 '
66
67 test_expect_success 'plumbing not affected' '
68 - git config diff.context 8 &&
68 + test_config diff.context 8 &&
69 git diff-files -p >output &&
70 test_grep ! "^ firstline" output
71 '
72
73 test_expect_success 'non-integer config parsing' '
74 - git config diff.context no &&
74 + test_config diff.context no &&
75 test_must_fail git diff 2>output &&
76 test_grep "bad numeric config value" output
77 '
78
79 test_expect_success 'negative integer config parsing' '
80 - git config diff.context -1 &&
80 + test_config diff.context -1 &&
81 test_must_fail git diff 2>output &&
82 test_grep "bad config variable" output
83 '
84
85 test_expect_success '-U0 is valid, so is diff.context=0' '
86 - git config diff.context 0 &&
86 + test_config diff.context 0 &&
87 git diff >output &&
88 test_grep "^-ADDED" output &&
89 test_grep "^+MODIFIED" output