i18n: tag.c factorize i18n strings
Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> Reviewed-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jean-Noël Avila committed
Jan 5, 2022 at 20:02 UTC
408c5c5c79c1d8f423625c65f69c8f62a0901f6b
1 file changed
+14
-9
builtin/tag.c
+14
-9
@@ -483,6 +483,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
483
OPT_END()
484
};
485
int ret = 0;
486
+ const char *only_in_list = NULL;
487
488
setup_ref_filter_porcelain_msg();
489
@@ -542,15 +543,19 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
543
goto cleanup;
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);
559
if (cmdmode == 'd') {
560
ret = delete_tags(argv);
561
goto cleanup;