git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 10/13] parse-options: drop unused ctx parameter from show_gitcomp()

From
Jeff King <peff@peff.net>
Date
Mar 20, 2019, 08:16 UTC
Message-ID
<20190320081627.GJ10403@sigill.intra.peff.net>
In-Reply-To
<20190320081258.GA5621@sigill.intra.peff.net>

The completion display doesn't actually care about where we are in the parsing. It's generated completely from the set of available options. So we don't need to see the parse-options context struct at all.

Signed-off-by: Jeff King <peff@peff.net>
---
 parse-options.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/parse-options.c b/parse-options.c
index cec74522e5..ade83a7b20 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -523,8 +523,7 @@ static void show_negated_gitcomp(const struct option *opts, int nr_noopts)
 	}
 }
 
-static int show_gitcomp(struct parse_opt_ctx_t *ctx,
-			const struct option *opts)
+static int show_gitcomp(const struct option *opts)
 {
 	const struct option *original_opts = opts;
 	int nr_noopts = 0;
@@ -603,7 +602,7 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
 
 		/* lone --git-completion-helper is asked by git-completion.bash */
 		if (ctx->total == 1 && !strcmp(arg + 1, "-git-completion-helper"))
-			return show_gitcomp(ctx, options);
+			return show_gitcomp(options);
 
 		if (arg[1] != '-') {
 			ctx->opt = arg + 1;
-- 
2.21.0.701.g4401309e11
Previous: Jeff KingNext: Jeff King
Message 11 of 19 in “more unused parameter cleanups”
  1. 0/13 more unused parameter cleanupsJeff King, Mar 20, 2019
  2. 01/13 revision: drop some unused "revs" parametersJeff King, Mar 20, 2019
  3. 02/13 log: drop unused rev_info from early outputJeff King, Mar 20, 2019
  4. 03/13 log: drop unused "len" from show_tagger()Jeff King, Mar 20, 2019
  5. 04/13 update-index: drop unused prefix_length parameter from do_reupdate()Jeff King, Mar 20, 2019
  6. 05/13 test-date: drop unused "now" parameter from parse_dates()Jeff King, Mar 20, 2019
  7. 06/13 unpack-trees: drop name_entry from traverse_by_cache_tree()Jeff King, Mar 20, 2019
  8. 07/13 unpack-trees: drop unused error_type parametersJeff King, Mar 20, 2019
  9. 08/13 report_path_error(): drop unused prefix parameterJeff King, Mar 20, 2019
  10. 09/13 fetch_pack(): drop unused parametersJeff King, Mar 20, 2019
  11. 10/13 parse-options: drop unused ctx parameter from show_gitcomp()Jeff King, Mar 20, 2019
  12. 11/13 pretty: drop unused "type" parameter in needs_rfc2047_encoding()Jeff King, Mar 20, 2019
  13. 12/13 pretty: drop unused strbuf from parse_padding_placeholder()Jeff King, Mar 20, 2019
  14. 13/13 parse_opt_ref_sorting: always use with NONEG flagJeff King, Mar 20, 2019
  15. Martin ÅgrenMar 20, 2019
  16. Jeff KingMar 20, 2019
  17. Junio C HamanoMar 20, 2019
  18. Ævar Arnfjörð BjarmasonMar 21, 2019
  19. Jeff KingMar 21, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.