@@ -436,18 +436,18 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
436
436
struct ref_lock * lock ;
437
437
struct create_tag_options opt ;
438
438
char * cleanup_arg = NULL ;
439
- int annotate = 0 , force = 0 , lines = -1 , list = 0 ,
440
- delete = 0 , verify = 0 ;
439
+ int annotate = 0 , force = 0 , lines = -1 ;
440
+ int cmdmode = 0 ;
441
441
const char * msgfile = NULL , * keyid = NULL ;
442
442
struct msg_arg msg = { 0 , STRBUF_INIT };
443
443
struct commit_list * with_commit = NULL ;
444
444
struct option options [] = {
445
- OPT_BOOLEAN ('l' , "list" , & list , N_ ("list tag names" )),
445
+ OPT_CMDMODE ('l' , "list" , & cmdmode , N_ ("list tag names" ), 'l' ),
446
446
{ OPTION_INTEGER , 'n' , NULL , & lines , N_ ("n" ),
447
447
N_ ("print <n> lines of each tag message" ),
448
448
PARSE_OPT_OPTARG , NULL , 1 },
449
- OPT_BOOLEAN ('d' , "delete" , & delete , N_ ("delete tags" )),
450
- OPT_BOOLEAN ('v' , "verify" , & verify , N_ ("verify tags" )),
449
+ OPT_CMDMODE ('d' , "delete" , & cmdmode , N_ ("delete tags" ), 'd' ),
450
+ OPT_CMDMODE ('v' , "verify" , & cmdmode , N_ ("verify tags" ), 'v' ),
451
451
452
452
OPT_GROUP (N_ ("Tag creation options" )),
453
453
OPT_BOOLEAN ('a' , "annotate" , & annotate ,
@@ -489,22 +489,19 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
489
489
}
490
490
if (opt .sign )
491
491
annotate = 1 ;
492
- if (argc == 0 && !( delete || verify ) )
493
- list = 1 ;
492
+ if (argc == 0 && !cmdmode )
493
+ cmdmode = 'l' ;
494
494
495
- if ((annotate || msg .given || msgfile || force ) &&
496
- (list || delete || verify ))
495
+ if ((annotate || msg .given || msgfile || force ) && (cmdmode != 0 ))
497
496
usage_with_options (git_tag_usage , options );
498
497
499
- if (list + delete + verify > 1 )
500
- usage_with_options (git_tag_usage , options );
501
498
finalize_colopts (& colopts , -1 );
502
- if (list && lines != -1 ) {
499
+ if (cmdmode == 'l' && lines != -1 ) {
503
500
if (explicitly_enable_column (colopts ))
504
501
die (_ ("--column and -n are incompatible" ));
505
502
colopts = 0 ;
506
503
}
507
- if (list ) {
504
+ if (cmdmode == 'l' ) {
508
505
int ret ;
509
506
if (column_active (colopts )) {
510
507
struct column_options copts ;
@@ -523,9 +520,9 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
523
520
die (_ ("--contains option is only allowed with -l." ));
524
521
if (points_at .nr )
525
522
die (_ ("--points-at option is only allowed with -l." ));
526
- if (delete )
523
+ if (cmdmode == 'd' )
527
524
return for_each_tag_name (argv , delete_tag );
528
- if (verify )
525
+ if (cmdmode == 'v' )
529
526
return for_each_tag_name (argv , verify_tag );
530
527
531
528
if (msg .given || msgfile ) {
0 commit comments