summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2017-08-25 09:48:37 -0700
committerJunio C Hamano <gitster@pobox.com>2017-08-25 10:23:47 -0700
commit48b8d3cf482fc121768d2270c9a222601f8a6902 (patch)
tree19590564e17ecbe45359f9725b03cb93a65feaa7
parent0bfff8146f8c055fd95af4567286929ba8216fa7 (diff)
downloadgit-sb/parse-options-blank-line-before-option-list.tar.gz
usage_with_options: omit double new line on empty option listsb/parse-options-blank-line-before-option-list
Currently the worktree command gives its usage, when no subcommand is given. However there are no general options, all options are related to the subcommands itself, such that: | $ git worktree | usage: git worktree add [<options>] <path> [<branch>] | or: git worktree list [<options>] | or: git worktree lock [<options>] <path> | or: git worktree prune [<options>] | or: git worktree unlock <path> | | | $ Note the two empty lines at the end of the usage string. This is because the toplevel usage is printed with an empty options list. Only print one new line after the usage string if the option list is empty. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--parse-options.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/parse-options.c b/parse-options.c
index 312a85dbde..78d96162ae 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -600,7 +600,7 @@ static int usage_with_options_internal(struct parse_opt_ctx_t *ctx,
usagestr++;
}
- if (opts->type != OPTION_GROUP)
+ if (opts->type != OPTION_GROUP && opts->type != OPTION_END)
fputc('\n', outfile);
for (; opts->type != OPTION_END; opts++) {