revision, rev-parse: factorize incompatibility messages about - -exclude-hidden

Use the standard parameterized message for reporting incompatible
options to report options that are not accepted in combination with
--exclude-hidden.  This reduces the number of strings to translate and
makes the UI a bit more consistent.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe
2023-12-06 12:51:58 +01:00
committed by Junio C Hamano
parent fa518aef56
commit 81fb70f55e
4 changed files with 22 additions and 15 deletions

View File

@ -893,13 +893,15 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
}
if (opt_with_value(arg, "--branches", &arg)) {
if (ref_excludes.hidden_refs_configured)
return error(_("--exclude-hidden cannot be used together with --branches"));
return error(_("options '%s' and '%s' cannot be used together"),
"--exclude-hidden", "--branches");
handle_ref_opt(arg, "refs/heads/");
continue;
}
if (opt_with_value(arg, "--tags", &arg)) {
if (ref_excludes.hidden_refs_configured)
return error(_("--exclude-hidden cannot be used together with --tags"));
return error(_("options '%s' and '%s' cannot be used together"),
"--exclude-hidden", "--tags");
handle_ref_opt(arg, "refs/tags/");
continue;
}
@ -909,7 +911,8 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
}
if (opt_with_value(arg, "--remotes", &arg)) {
if (ref_excludes.hidden_refs_configured)
return error(_("--exclude-hidden cannot be used together with --remotes"));
return error(_("options '%s' and '%s' cannot be used together"),
"--exclude-hidden", "--remotes");
handle_ref_opt(arg, "refs/remotes/");
continue;
}