fetch: add a test to exercise invalid output formats
Add a testcase that exercises the logic when an invalid output format is passed via the `fetch.output` configuration. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
May 10, 2023 at 14:34 UTC
3daf6558eddd2841b2eeedf1f2356cb89c7c8425
1 file changed
+24
t/t5574-fetch-output.sh
+24
@@ -7,6 +7,30 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8
. ./test-lib.sh
9
10
+test_expect_success 'fetch with invalid output format configuration' '
11
+ test_when_finished "rm -rf clone" &&
12
+ git clone . clone &&
13
+
14
+ test_must_fail git -C clone -c fetch.output fetch origin 2>actual.err &&
15
+ cat >expect <<-EOF &&
16
+ error: missing value for ${SQ}fetch.output${SQ}
17
+ fatal: unable to parse ${SQ}fetch.output${SQ} from command-line config
18
+ EOF
19
+ test_cmp expect actual.err &&
20
+
21
+ test_must_fail git -C clone -c fetch.output= fetch origin 2>actual.err &&
22
+ cat >expect <<-EOF &&
23
+ fatal: invalid value for ${SQ}fetch.output${SQ}: ${SQ}${SQ}
24
+ EOF
25
+ test_cmp expect actual.err &&
26
+
27
+ test_must_fail git -C clone -c fetch.output=garbage fetch origin 2>actual.err &&
28
+ cat >expect <<-EOF &&
29
+ fatal: invalid value for ${SQ}fetch.output${SQ}: ${SQ}garbage${SQ}
30
+ EOF
31
+ test_cmp expect actual.err
32
+'
33
+
34
test_expect_success 'fetch aligned output' '
35
git clone . full-output &&
36
test_commit looooooooooooong-tag &&