Skip to content

Commit 1a9bf1e

Browse files
drafnelgitster
authored andcommitted
parse-options: write blank line to correct output stream
When commit 54e6dc7 added translation support to parse-options, an fprintf was mistakenly replaced by a call to putchar(). Let's use fputc instead. Fixes t0040.11, t0040.12, t0040.33, and t1502.8. Signed-off-by: Brandon Casey <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c97ee17 commit 1a9bf1e

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

parse-options.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ static int usage_with_options_internal(struct parse_opt_ctx_t *ctx,
599599
if (**usagestr)
600600
fprintf_ln(outfile, _(" %s"), _(*usagestr));
601601
else
602-
putchar('\n');
602+
fputc('\n', outfile);
603603
usagestr++;
604604
}
605605

t/t0040-parse-options.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ test_expect_success 'OPT_BOOL() is idempotent #2' 'check boolean: 1 -DB'
9292
test_expect_success 'OPT_BOOL() negation #1' 'check boolean: 0 -D --no-yes'
9393
test_expect_success 'OPT_BOOL() negation #2' 'check boolean: 0 -D --no-no-doubt'
9494

95-
test_expect_failure 'OPT_BOOL() no negation #1' 'check_unknown_i18n --fear'
96-
test_expect_failure 'OPT_BOOL() no negation #2' 'check_unknown_i18n --no-no-fear'
95+
test_expect_success 'OPT_BOOL() no negation #1' 'check_unknown_i18n --fear'
96+
test_expect_success 'OPT_BOOL() no negation #2' 'check_unknown_i18n --no-no-fear'
9797

9898
test_expect_success 'OPT_BOOL() positivation' 'check boolean: 0 -D --doubt'
9999

@@ -288,7 +288,7 @@ test_expect_success 'OPT_CALLBACK() and OPT_BIT() work' '
288288

289289
>expect
290290

291-
test_expect_failure 'OPT_CALLBACK() and callback errors work' '
291+
test_expect_success 'OPT_CALLBACK() and callback errors work' '
292292
test_must_fail test-parse-options --no-length >output 2>output.err &&
293293
test_i18ncmp expect output &&
294294
test_i18ncmp expect.err output.err

t/t1502-rev-parse-parseopt.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ END_EXPECT
139139
test_i18ncmp expect output
140140
'
141141

142-
test_expect_failure 'test --parseopt invalid switch help output' '
142+
test_expect_success 'test --parseopt invalid switch help output' '
143143
sed -e "s/^|//" >expect <<\END_EXPECT &&
144144
|error: unknown option `does-not-exist'\''
145145
|usage: some-command [options] <args>...

0 commit comments

Comments
 (0)