Skip to content

Commit 3daf655

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2c5691d commit 3daf655

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

t/t5574-fetch-output.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,30 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
77

88
. ./test-lib.sh
99

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+
1034
test_expect_success 'fetch aligned output' '
1135
git clone . full-output &&
1236
test_commit looooooooooooong-tag &&

0 commit comments

Comments
 (0)