From: Stefan Beller <sbeller@google.com>
To: git@vger.kernel.org
Cc: Stefan Beller <sbeller@google.com>
Subject: [PATCH] usage_with_options: omit double new line on empty option list
Date: Fri, 25 Aug 2017 09:48:37 -0700 [thread overview]
Message-ID: <20170825164837.30118-1-sbeller@google.com> (raw)
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>
---
parse-options.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/parse-options.c b/parse-options.c
index 0dd9fc6a0d..1307c82861 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -603,7 +603,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++) {
--
2.14.0.rc0.3.g6c2e499285
next reply other threads:[~2017-08-25 16:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-25 16:48 Stefan Beller [this message]
2017-08-25 17:18 ` [PATCH] usage_with_options: omit double new line on empty option list Junio C Hamano
2017-08-25 17:19 ` Stefan Beller
2017-08-25 17:21 ` Junio C Hamano
2017-08-25 17:31 ` Junio C Hamano
[not found] <xmqqy3q7sge2.fsf@gitster.mtv.corp.google.com/>
2017-08-25 19:28 ` Stefan Beller
2017-08-25 20:27 ` Junio C Hamano
2017-08-25 21:06 ` Stefan Beller
2017-08-25 21:17 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170825164837.30118-1-sbeller@google.com \
--to=sbeller@google.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).