Skip to content

Commit ca04dc9

Browse files
Denton-Lgitster
authored andcommitted
parse-options.h: extract common --cleanup option
The --cleanup option is commonly used. Extract it so that its definition is not repeated. Helped-by: Phillip Wood <[email protected]> Signed-off-by: Denton Liu <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f29cd86 commit ca04dc9

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

builtin/commit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
14731473
OPT_BOOL('s', "signoff", &signoff, N_("add Signed-off-by:")),
14741474
OPT_FILENAME('t', "template", &template_file, N_("use specified template file")),
14751475
OPT_BOOL('e', "edit", &edit_flag, N_("force edit of commit")),
1476-
OPT_STRING(0, "cleanup", &cleanup_arg, N_("default"), N_("how to strip spaces and #comments from message")),
1476+
OPT_CLEANUP(&cleanup_arg),
14771477
OPT_BOOL(0, "status", &include_status, N_("include status in commit message template")),
14781478
{ OPTION_STRING, 'S', "gpg-sign", &sign_commit, N_("key-id"),
14791479
N_("GPG sign commit"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" },

builtin/tag.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
397397
OPT_FILENAME('F', "file", &msgfile, N_("read message from file")),
398398
OPT_BOOL('e', "edit", &edit_flag, N_("force edit of tag message")),
399399
OPT_BOOL('s', "sign", &opt.sign, N_("annotated and GPG-signed tag")),
400-
OPT_STRING(0, "cleanup", &cleanup_arg, N_("mode"),
401-
N_("how to strip spaces and #comments from message")),
400+
OPT_CLEANUP(&cleanup_arg),
402401
OPT_STRING('u', "local-user", &keyid, N_("key-id"),
403402
N_("use another key to sign the tag")),
404403
OPT__FORCE(&force, N_("replace the tag if exists"), 0),

parse-options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,5 +314,6 @@ int parse_opt_passthru_argv(const struct option *, const char *, int);
314314
#define OPT_NO_CONTAINS(v, h) _OPT_CONTAINS_OR_WITH("no-contains", v, h, PARSE_OPT_NONEG)
315315
#define OPT_WITH(v, h) _OPT_CONTAINS_OR_WITH("with", v, h, PARSE_OPT_HIDDEN | PARSE_OPT_NONEG)
316316
#define OPT_WITHOUT(v, h) _OPT_CONTAINS_OR_WITH("without", v, h, PARSE_OPT_HIDDEN | PARSE_OPT_NONEG)
317+
#define OPT_CLEANUP(v) OPT_STRING(0, "cleanup", v, N_("mode"), N_("how to strip spaces and #comments from message"))
317318

318319
#endif

0 commit comments

Comments
 (0)