From: John Cai via GitGitGadget Date: Wed, 05 Jan 2022 04:06:01 GMT Subject: [PATCH v4] builtin/reflog.c: use parse-options api for expire, delete subcommands Message-ID: In-Reply-To: From: John Cai 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" --- reflog.c: switch to use parse-options API Switch out manual argv parsing for the reflog expire subcommand to use the parse-options API. This reduces code redundancy by consolidating option parsing logic. NOTE: this patch was based off of next. I know now that I should base it off of master. But practically, nothing in master touched reflog.c except for ab/reflog-prep changes since v3: * fixed indentation changes since v2: * got rid of parse_opt_expiry_date helper based on feedback from Junio. Just call parse_expiry_date directly in the callbacks, and don't worry about unset, as we can just set the PARSE_OPT_NONEG flag for --expire and --expire-unreachable since the original code didn't support a negated version of those flags anyway. The documentation also explicitly states to use "never" as the argument. * fix places where we set int i inside a for loop construct. Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1175%2Fjohn-cai%2Fjc%2Freflog-switch-to-option-parse-v4 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1175/john-cai/jc/reflog-switch-to-option-parse-v4 Pull-Request: https://github.com/git/git/pull/1175 Range-diff vs v3: 1: 99a97e6ee52 ! 1: 0efdf3d2cb1 builtin/reflog.c: use parse-options api for expire, delete subcommands @@ builtin/reflog.c: static void set_reflog_expiry_param(struct cmd_reflog_expire_c +static const char * reflog_expire_usage[] = { + N_("git reflog expire [--expire=