summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Jean-Noël Avila <jn.avila@free.fr>2022-01-05 20:02:18 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2022-01-05 13:31:00 -0800
commit408c5c5c79c1d8f423625c65f69c8f62a0901f6b (patch)
treec4ac59b7420e2c0050f04af5e8a15a8aaa4b026c
parenti18n: standardize "cannot open" and "cannot read" (diff)
downloadtgif-408c5c5c79c1d8f423625c65f69c8f62a0901f6b.tar.xz
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>
-rw-r--r--builtin/tag.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/builtin/tag.c b/builtin/tag.c
index dfdcfd3795..134b3f1edf 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -483,6 +483,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
OPT_END()
};
int ret = 0;
+ const char *only_in_list = NULL;
setup_ref_filter_porcelain_msg();
@@ -542,15 +543,19 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
goto cleanup;
}
if (filter.lines != -1)
- die(_("-n option is only allowed in list mode"));
- if (filter.with_commit)
- die(_("--contains option is only allowed in list mode"));
- if (filter.no_commit)
- die(_("--no-contains option is only allowed in list mode"));
- if (filter.points_at.nr)
- die(_("--points-at option is only allowed in list mode"));
- if (filter.reachable_from || filter.unreachable_from)
- die(_("--merged and --no-merged options are only allowed in list mode"));
+ only_in_list = "-n";
+ else if (filter.with_commit)
+ only_in_list = "--contains";
+ else if (filter.no_commit)
+ only_in_list = "--no-contains";
+ else if (filter.points_at.nr)
+ only_in_list = "--points-at";
+ else if (filter.reachable_from)
+ only_in_list = "--merged";
+ else if (filter.unreachable_from)
+ only_in_list = "--no-merged";
+ if (only_in_list)
+ die(_("the '%s' option is only allowed in list mode"), only_in_list);
if (cmdmode == 'd') {
ret = delete_tags(argv);
goto cleanup;