@matheusbsbs / matheus-bagliano / commits / 44d86e910d
Fork 0

avoid whitespace on empty line in automatic usage message

When outputting a usage message with a blank line in the header, we would output a line with four spaces. Make this truly a blank line. This helps us remove trailing whitespace from a test vector. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Jun 14, 2008 at 03:27 UTC 44d86e910d61dab4f059d86705599bbb2747b10f
2 files changed +7 -3
parse-options.c
+6 -2
@@ -312,8 +312,12 @@ void usage_with_options_internal(const char * const *usagestr,
312 fprintf(stderr, "usage: %s\n", *usagestr++);
313 while (*usagestr && **usagestr)
314 fprintf(stderr, " or: %s\n", *usagestr++);
315 - while (*usagestr)
316 - fprintf(stderr, " %s\n", *usagestr++);
315 + while (*usagestr) {
316 + fprintf(stderr, "%s%s\n",
317 + **usagestr ? " " : "",
318 + *usagestr);
319 + usagestr++;
320 + }
321
322 if (opts->type != OPTION_GROUP)
323 fputc('\n', stderr);
t/t1502-rev-parse-parseopt.sh
+1 -1
@@ -5,7 +5,7 @@ test_description='test git rev-parse --parseopt'
5
6 cat > expect.err <<EOF
7 usage: some-command [options] <args>...
8 -
8 +
9 some-command does foo and bar!
10
11 -h, --help show the help