From: Jeff King Date: Sat, 14 Jun 2008 07:27:21 +0000 (-0400) Subject: avoid whitespace on empty line in automatic usage message X-Git-Tag: v1.6.0-rc0~233^2~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=44d86e910d61dab4f059d86705599bbb2747b10f;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/parse-options.c b/parse-options.c index acf3fe3a1..8071711e5 100644 --- a/parse-options.c +++ b/parse-options.c @@ -312,8 +312,12 @@ void usage_with_options_internal(const char * const *usagestr, fprintf(stderr, "usage: %s\n", *usagestr++); while (*usagestr && **usagestr) fprintf(stderr, " or: %s\n", *usagestr++); - while (*usagestr) - fprintf(stderr, " %s\n", *usagestr++); + while (*usagestr) { + fprintf(stderr, "%s%s\n", + **usagestr ? " " : "", + *usagestr); + usagestr++; + } if (opts->type != OPTION_GROUP) fputc('\n', stderr); diff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh index d24a47d11..7cdd70a18 100755 --- a/t/t1502-rev-parse-parseopt.sh +++ b/t/t1502-rev-parse-parseopt.sh @@ -5,7 +5,7 @@ test_description='test git rev-parse --parseopt' cat > expect.err <... - + some-command does foo and bar! -h, --help show the help