summaryrefslogtreecommitdiff
path: root/t/t1502-rev-parse-parseopt.sh
diff options
context:
space:
mode:
authorBrandon Casey <drafnel@gmail.com>2017-09-25 04:08:05 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-09-25 05:35:53 (GMT)
commita6304fa4c2f57b08ec0acea9f91c188f284f8374 (patch)
tree99d61834e5b76b3ffa3d39f3628f0ef212213201 /t/t1502-rev-parse-parseopt.sh
parent1a9bf1e176439d415b97fb8c5a556f69ea503877 (diff)
downloadgit-a6304fa4c2f57b08ec0acea9f91c188f284f8374.zip
git-a6304fa4c2f57b08ec0acea9f91c188f284f8374.tar.gz
git-a6304fa4c2f57b08ec0acea9f91c188f284f8374.tar.bz2
parse-options: only insert newline in help text if needed
Currently, when parse_options() produces a help message it always emits a blank line after the usage text to separate it from the options text. If the option spec does not define any switches, or only defines hidden switches that will not be displayed, then the help text will end up with two trailing blank lines instead of one. Let's defer emitting the blank line between the usage text and the options text until it is clear that the options section will not be empty. Fixes t1502.5, t1502.6. Signed-off-by: Brandon Casey <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1502-rev-parse-parseopt.sh')
-rwxr-xr-xt/t1502-rev-parse-parseopt.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh
index ce7dda1..a859abe 100755
--- a/t/t1502-rev-parse-parseopt.sh
+++ b/t/t1502-rev-parse-parseopt.sh
@@ -98,7 +98,7 @@ END_EXPECT
test_i18ncmp expect output
'
-test_expect_failure 'test --parseopt help output no switches' '
+test_expect_success 'test --parseopt help output no switches' '
sed -e "s/^|//" >expect <<\END_EXPECT &&
|cat <<\EOF
|usage: some-command [options] <args>...
@@ -111,7 +111,7 @@ END_EXPECT
test_i18ncmp expect output
'
-test_expect_failure 'test --parseopt help output hidden switches' '
+test_expect_success 'test --parseopt help output hidden switches' '
sed -e "s/^|//" >expect <<\END_EXPECT &&
|cat <<\EOF
|usage: some-command [options] <args>...