Thread (1 message) 1 message, 1 author, 2022-01-04

Re: [PATCH v3] builtin/reflog.c: use parse-options api for expire, delete subcommands

From: Junio C Hamano <hidden>
Date: 2022-01-04 22:04:49

"John Cai via GitGitGadget" [off-list ref] writes:
From: John Cai <redacted>

Switching out manual arg parsing for the parse-options API for the
expire and delete subcommands.

Move explicit_expiry flag into cmd_reflog_expire_cb struct so callbacks
can set both the value of the timestamp as well as the explicit_expiry
flag.

Signed-off-by: "John Cai" <redacted>
Makes sense.
-/* NEEDSWORK: switch to using parse_options */
-static const char reflog_expire_usage[] =
-N_("git reflog expire [--expire=<time>] "
-   "[--expire-unreachable=<time>] "
-   "[--rewrite] [--updateref] [--stale-fix] [--dry-run | -n] "
-   "[--verbose] [--all] <refs>...");
...
+static const char * reflog_expire_usage[] = {
+	N_("git reflog expire [--expire=<time>] "
+   "[--expire-unreachable=<time>] "
+   "[--rewrite] [--updateref] [--stale-fix] [--dry-run | -n] "
+   "[--verbose] [--all] <refs>..."),
Funny indentation?  Let's align the opening double-quote of all the
other lines to that of the first line on a fixed-column terminal,
like was done in the original.
 static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
 {
 	struct cmd_reflog_expire_cb cmd = { 0 };
 	timestamp_t now = time(NULL);
 	int i, status, do_all, all_worktrees = 1;
-	int explicit_expiry = 0;
 	unsigned int flags = 0;
 	int verbose = 0;
 	reflog_expiry_should_prune_fn *should_prune_fn = should_expire_reflog_ent;
+	const struct option options[] = {
This does not seem to apply.  Please leave a note on how the 'base'
was chosen when sending a patch that requires something not yet in
'master'.

I've based the topic for this patch by prepar ng a merge of
'ab/reflog-prep' into 'master', at least for now.

Other than that, looks nicely done.  The new approach seems much
simpler and sensible than the previous round.

Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help