@@ -483,6 +483,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
483
483
OPT_END ()
484
484
};
485
485
int ret = 0 ;
486
+ const char * only_in_list = NULL ;
486
487
487
488
setup_ref_filter_porcelain_msg ();
488
489
@@ -542,15 +543,19 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
542
543
goto cleanup ;
543
544
}
544
545
if (filter .lines != -1 )
545
- die (_ ("-n option is only allowed in list mode" ));
546
- if (filter .with_commit )
547
- die (_ ("--contains option is only allowed in list mode" ));
548
- if (filter .no_commit )
549
- die (_ ("--no-contains option is only allowed in list mode" ));
550
- if (filter .points_at .nr )
551
- die (_ ("--points-at option is only allowed in list mode" ));
552
- if (filter .reachable_from || filter .unreachable_from )
553
- die (_ ("--merged and --no-merged options are only allowed in list mode" ));
546
+ only_in_list = "-n" ;
547
+ else if (filter .with_commit )
548
+ only_in_list = "--contains" ;
549
+ else if (filter .no_commit )
550
+ only_in_list = "--no-contains" ;
551
+ else if (filter .points_at .nr )
552
+ only_in_list = "--points-at" ;
553
+ else if (filter .reachable_from )
554
+ only_in_list = "--merged" ;
555
+ else if (filter .unreachable_from )
556
+ only_in_list = "--no-merged" ;
557
+ if (only_in_list )
558
+ die (_ ("the '%s' option is only allowed in list mode" ), only_in_list );
554
559
if (cmdmode == 'd' ) {
555
560
ret = delete_tags (argv );
556
561
goto cleanup ;
0 commit comments