All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Subject: [PATCH 7/7] parse-options: drop parse_opt_unknown_cb()
Date: Tue, 28 Mar 2023 16:58:42 -0400	[thread overview]
Message-ID: <20230328205842.GG1754055@coredump.intra.peff.net> (raw)
In-Reply-To: <20230328205253.GA1753925@coredump.intra.peff.net>

This low-level callback was introduced in ce564eb1bd5 (parse-options:
add parse_opt_unknown_cb(), 2016-09-05) so that we could advertise
--indent-heuristic in git-blame's "-h" output, even though the option is
actually handled in parse_revision_opt(). We later stopped doing so in
44ae131e384 (builtin/blame.c: remove '--indent-heuristic' from usage
string, 2019-10-28).

This is a weird thing to do, and in the intervening years, we've never
used it again. Let's drop the helper in the name of simplicity.

Signed-off-by: Jeff King <peff@peff.net>
---
I guess this one is an oddball in this series, is it isn't about argv
directly. But it is argv-adjacent, and it needs to happen at some point
to silence the unused parameter warning.

 parse-options-cb.c | 15 ---------------
 parse-options.h    |  3 ---
 2 files changed, 18 deletions(-)

diff --git a/parse-options-cb.c b/parse-options-cb.c
index d346dbe2100..4729277aa69 100644
--- a/parse-options-cb.c
+++ b/parse-options-cb.c
@@ -213,21 +213,6 @@ int parse_opt_noop_cb(const struct option *opt, const char *arg, int unset)
 	return 0;
 }
 
-/**
- * Report that the option is unknown, so that other code can handle
- * it. This can be used as a callback together with
- * OPTION_LOWLEVEL_CALLBACK to allow an option to be documented in the
- * "-h" output even if it's not being handled directly by
- * parse_options().
- */
-enum parse_opt_result parse_opt_unknown_cb(struct parse_opt_ctx_t *ctx,
-					   const struct option *opt,
-					   const char *arg, int unset)
-{
-	BUG_ON_OPT_ARG(arg);
-	return PARSE_OPT_UNKNOWN;
-}
-
 /**
  * Recreates the command-line option in the strbuf.
  */
diff --git a/parse-options.h b/parse-options.h
index 50d852f2991..60b0a758d6b 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -348,9 +348,6 @@ int parse_opt_commit(const struct option *, const char *, int);
 int parse_opt_tertiary(const struct option *, const char *, int);
 int parse_opt_string_list(const struct option *, const char *, int);
 int parse_opt_noop_cb(const struct option *, const char *, int);
-enum parse_opt_result parse_opt_unknown_cb(struct parse_opt_ctx_t *ctx,
-					   const struct option *,
-					   const char *, int);
 int parse_opt_passthru(const struct option *, const char *, int);
 int parse_opt_passthru_argv(const struct option *, const char *, int);
 /* value is enum branch_track* */
-- 
2.40.0.675.gb17cd5d94c8

  parent reply	other threads:[~2023-03-28 20:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-28 20:52 [PATCH 0/7] unused argc/argv/prefix parameters Jeff King
2023-03-28 20:54 ` [PATCH 1/7] fast-import: fix file access when run from subdir Jeff King
2023-03-28 20:54 ` [PATCH 2/7] builtins: always pass prefix to parse_options() Jeff King
2023-03-28 20:55 ` [PATCH 3/7] builtins: annotate always-empty prefix parameters Jeff King
2023-03-28 20:56 ` [PATCH 4/7] builtins: mark unused " Jeff King
2023-03-28 20:57 ` [PATCH 5/7] mark "argv" as unused when we check argc Jeff King
2023-03-28 20:57 ` [PATCH 6/7] t/helper: mark unused argv/argc arguments Jeff King
2023-03-28 20:58 ` Jeff King [this message]
2023-03-29 13:17 ` [PATCH 0/7] unused argc/argv/prefix parameters Derrick Stolee
2023-03-29 15:21   ` 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=20230328205842.GG1754055@coredump.intra.peff.net \
    --to=peff@peff.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.