From: "Carlo Marcelo Arenas Belón" <carenas@gmail.com>
To: git@vger.kernel.org
Cc: jeffhost@microsoft.com, "Carlo Marcelo Arenas Belón" <carenas@gmail.com>
Subject: [PATCH] builtin/fsmonitor--daemon: use parse-options API fully
Date: Tue, 17 Aug 2021 03:27:10 -0700 [thread overview]
Message-ID: <20210817102710.23916-1-carenas@gmail.com> (raw)
--help and -h are already handled internally so just parse_options()
do the parsing and extract the command from the remaining options.
as a side effect, avoid setting a variable argc to a value that was
never used.
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
builtin/fsmonitor--daemon.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c
index 25f18f2726..d6a6010512 100644
--- a/builtin/fsmonitor--daemon.c
+++ b/builtin/fsmonitor--daemon.c
@@ -1511,20 +1511,13 @@ int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix)
OPT_END()
};
- if (argc < 2)
- usage_with_options(builtin_fsmonitor__daemon_usage, options);
-
- if (argc == 2 && !strcmp(argv[1], "-h"))
+ argc = parse_options(argc, argv, prefix, options,
+ builtin_fsmonitor__daemon_usage, 0);
+ if (argc != 1)
usage_with_options(builtin_fsmonitor__daemon_usage, options);
+ subcmd = argv[0];
git_config(fsmonitor_config, NULL);
-
- subcmd = argv[1];
- argv--;
- argc++;
-
- argc = parse_options(argc, argv, prefix, options,
- builtin_fsmonitor__daemon_usage, 0);
if (fsmonitor__ipc_threads < 1)
die(_("invalid 'ipc-threads' value (%d)"),
fsmonitor__ipc_threads);
--
2.33.0.476.gf000ecbed9
next reply other threads:[~2021-08-17 10:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-17 10:27 Carlo Marcelo Arenas Belón [this message]
2021-08-17 18:03 ` [PATCH] builtin/fsmonitor--daemon: use parse-options API fully Jeff Hostetler
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210817102710.23916-1-carenas@gmail.com \
--to=carenas@gmail.com \
--cc=git@vger.kernel.org \
--cc=jeffhost@microsoft.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).