rev-parse: mark die() messages for translation

These error messages are intended for the user. Let's touch them up
since we're here from the previous commit.

Signed-off-by: Wolfgang Müller <wolf@oriole.systems>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Wolfgang Müller 2021-05-17 10:02:43 +02:00 committed by Junio C Hamano
parent 99fc555188
commit e2c5993744

View File

@ -435,11 +435,11 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
/* get the usage up to the first line with a -- on it */ /* get the usage up to the first line with a -- on it */
for (;;) { for (;;) {
if (strbuf_getline(&sb, stdin) == EOF) if (strbuf_getline(&sb, stdin) == EOF)
die("premature end of input"); die(_("premature end of input"));
ALLOC_GROW(usage, unb + 1, usz); ALLOC_GROW(usage, unb + 1, usz);
if (!strcmp("--", sb.buf)) { if (!strcmp("--", sb.buf)) {
if (unb < 1) if (unb < 1)
die("no usage string given before the `--' separator"); die(_("no usage string given before the `--' separator"));
usage[unb] = NULL; usage[unb] = NULL;
break; break;
} }
@ -545,7 +545,7 @@ static void die_no_single_rev(int quiet)
if (quiet) if (quiet)
exit(1); exit(1);
else else
die("Needed a single revision"); die(_("Needed a single revision"));
} }
static const char builtin_rev_parse_usage[] = static const char builtin_rev_parse_usage[] =
@ -709,10 +709,10 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
if (!strcmp(arg, "--resolve-git-dir")) { if (!strcmp(arg, "--resolve-git-dir")) {
const char *gitdir = argv[++i]; const char *gitdir = argv[++i];
if (!gitdir) if (!gitdir)
die("--resolve-git-dir requires an argument"); die(_("--resolve-git-dir requires an argument"));
gitdir = resolve_gitdir(gitdir); gitdir = resolve_gitdir(gitdir);
if (!gitdir) if (!gitdir)
die("not a gitdir '%s'", argv[i]); die(_("not a gitdir '%s'"), argv[i]);
puts(gitdir); puts(gitdir);
continue; continue;
} }
@ -736,7 +736,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
if (!seen_end_of_options && *arg == '-') { if (!seen_end_of_options && *arg == '-') {
if (!strcmp(arg, "--git-path")) { if (!strcmp(arg, "--git-path")) {
if (!argv[i + 1]) if (!argv[i + 1])
die("--git-path requires an argument"); die(_("--git-path requires an argument"));
strbuf_reset(&buf); strbuf_reset(&buf);
print_path(git_path("%s", argv[i + 1]), prefix, print_path(git_path("%s", argv[i + 1]), prefix,
format, format,
@ -746,7 +746,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
} }
if (!strcmp(arg,"-n")) { if (!strcmp(arg,"-n")) {
if (++i >= argc) if (++i >= argc)
die("-n requires an argument"); die(_("-n requires an argument"));
if ((filter & DO_FLAGS) && (filter & DO_REVS)) { if ((filter & DO_FLAGS) && (filter & DO_REVS)) {
show(arg); show(arg);
show(argv[i]); show(argv[i]);
@ -760,26 +760,26 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
} }
if (opt_with_value(arg, "--path-format", &arg)) { if (opt_with_value(arg, "--path-format", &arg)) {
if (!arg) if (!arg)
die("--path-format requires an argument"); die(_("--path-format requires an argument"));
if (!strcmp(arg, "absolute")) { if (!strcmp(arg, "absolute")) {
format = FORMAT_CANONICAL; format = FORMAT_CANONICAL;
} else if (!strcmp(arg, "relative")) { } else if (!strcmp(arg, "relative")) {
format = FORMAT_RELATIVE; format = FORMAT_RELATIVE;
} else { } else {
die("unknown argument to --path-format: %s", arg); die(_("unknown argument to --path-format: %s"), arg);
} }
continue; continue;
} }
if (!strcmp(arg, "--default")) { if (!strcmp(arg, "--default")) {
def = argv[++i]; def = argv[++i];
if (!def) if (!def)
die("--default requires an argument"); die(_("--default requires an argument"));
continue; continue;
} }
if (!strcmp(arg, "--prefix")) { if (!strcmp(arg, "--prefix")) {
prefix = argv[++i]; prefix = argv[++i];
if (!prefix) if (!prefix)
die("--prefix requires an argument"); die(_("--prefix requires an argument"));
startup_info->prefix = prefix; startup_info->prefix = prefix;
output_prefix = 1; output_prefix = 1;
continue; continue;
@ -848,7 +848,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
else if (!strcmp(arg, "loose")) else if (!strcmp(arg, "loose"))
abbrev_ref_strict = 0; abbrev_ref_strict = 0;
else else
die("unknown mode for --abbrev-ref: %s", die(_("unknown mode for --abbrev-ref: %s"),
arg); arg);
} }
continue; continue;
@ -892,7 +892,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
if (work_tree) if (work_tree)
print_path(work_tree, prefix, format, DEFAULT_UNMODIFIED); print_path(work_tree, prefix, format, DEFAULT_UNMODIFIED);
else else
die("this operation must be run in a work tree"); die(_("this operation must be run in a work tree"));
continue; continue;
} }
if (!strcmp(arg, "--show-superproject-working-tree")) { if (!strcmp(arg, "--show-superproject-working-tree")) {
@ -1020,7 +1020,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
if (strcmp(val, "storage") && if (strcmp(val, "storage") &&
strcmp(val, "input") && strcmp(val, "input") &&
strcmp(val, "output")) strcmp(val, "output"))
die("unknown mode for --show-object-format: %s", die(_("unknown mode for --show-object-format: %s"),
arg); arg);
puts(the_hash_algo->name); puts(the_hash_algo->name);
continue; continue;
@ -1058,7 +1058,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
if (verify) if (verify)
die_no_single_rev(quiet); die_no_single_rev(quiet);
if (has_dashdash) if (has_dashdash)
die("bad revision '%s'", arg); die(_("bad revision '%s'"), arg);
as_is = 1; as_is = 1;
if (!show_file(arg, output_prefix)) if (!show_file(arg, output_prefix))
continue; continue;