Thread (79 messages) 79 messages, 3 authors, 2022-09-05

Re: [PATCH v2 16/20] builtin/reflog.c: let parse-options parse subcommands

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2022-08-19 18:15:03

On Fri, Aug 19 2022, SZEDER Gábor wrote:
+	parse_opt_subcommand_fn *fn = NULL;
Re the comment on notes.c this is a bit like that pattern...
-log_reflog:
-	return cmd_log_reflog(argc, argv, prefix);
+			     PARSE_OPT_KEEP_UNKNOWN_OPT);
+	if (fn)
+		return fn(argc - 1, argv + 1, prefix);
+	else
+		return cmd_log_reflog(argc, argv, prefix);
 }
Maybe more obvious (untested):

	if (!fn) {
		argc--;
		argv++;
		fn = cmd_log_reflog;
	}
	return fn(argc, argv, prefix);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help