* [PATCH 0/5] fast-export/import: cleanups and translation
@ 2025-10-28 8:12 Christian Couder
2025-10-28 8:12 ` [PATCH 1/5] gpg-interface: simplify ssh fingerprint parsing Christian Couder
` (5 more replies)
0 siblings, 6 replies; 22+ messages in thread
From: Christian Couder @ 2025-10-28 8:12 UTC (permalink / raw)
To: git
Cc: Junio C Hamano, Patrick Steinhardt, Elijah Newren, Jeff King,
brian m . carlson, Johannes Schindelin, Christian Couder
In a previous v2 patch series[1] that I sent last May, there were two
preparatory cleanup patches[2][3] that have been dropped in the v3 and
next versions. I think these two cleanup patches are worth resending
in their own series though.
While at cleaning things up, I realized that, when working in this
area of the code, I have often been annoyed by the fact that few error
and warning messages were marked for translation. So I decided to also
address this here.
So patches 1/5 and 2/5 are small code cleanups that are resent, while
patches 3/5, 4/5 and 5/5 are about marking strings for translation.
[1] https://lore.kernel.org/git/20250526103314.1542316-1-christian.couder@gmail.com/
[2] https://lore.kernel.org/git/20250526103314.1542316-2-christian.couder@gmail.com/
[3] https://lore.kernel.org/git/20250526103314.1542316-3-christian.couder@gmail.com/
CI build:
---------
All the tests pass, except for the "win + Meson build" which seems to
fail at a Rust related step:
https://github.com/chriscool/git/actions/runs/18856740498
Christian Couder (5):
gpg-interface: simplify ssh fingerprint parsing
gpg-interface: use left shift to define GPG_VERIFY_*
fast-export: mark strings for translation
fast-import: mark strings for translation
gpg-interface: mark a string for translation
builtin/fast-export.c | 77 ++++++------
builtin/fast-import.c | 270 +++++++++++++++++++++---------------------
gpg-interface.c | 4 +-
gpg-interface.h | 6 +-
4 files changed, 179 insertions(+), 178 deletions(-)
--
2.51.2.540.g4ad31e1014
^ permalink raw reply [flat|nested] 22+ messages in thread* [PATCH 1/5] gpg-interface: simplify ssh fingerprint parsing 2025-10-28 8:12 [PATCH 0/5] fast-export/import: cleanups and translation Christian Couder @ 2025-10-28 8:12 ` Christian Couder 2025-10-28 16:45 ` Junio C Hamano 2025-10-28 8:12 ` [PATCH 2/5] gpg-interface: use left shift to define GPG_VERIFY_* Christian Couder ` (4 subsequent siblings) 5 siblings, 1 reply; 22+ messages in thread From: Christian Couder @ 2025-10-28 8:12 UTC (permalink / raw) To: git Cc: Junio C Hamano, Patrick Steinhardt, Elijah Newren, Jeff King, brian m . carlson, Johannes Schindelin, Christian Couder, Christian Couder In "gpg-interface.c", the 'parse_ssh_output()' function takes a 'struct signature_check *sigc' argument and populates many members of this 'sigc' using information parsed from 'sigc->output' which contains the ouput of an `ssh-keygen -Y ...` command that was used to verify an SSH signature. When it populates 'sigc->fingerprint' though, it uses `xstrdup(strstr(line, "key ") + 4)` while `strstr(line, "key ")` has already been computed a few lines above and is already available in the `key` variable. Let's simplify this. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> --- gpg-interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gpg-interface.c b/gpg-interface.c index 2f4f0e32cb..91d1b58cb4 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -443,7 +443,7 @@ static void parse_ssh_output(struct signature_check *sigc) key = strstr(line, "key "); if (key) { - sigc->fingerprint = xstrdup(strstr(line, "key ") + 4); + sigc->fingerprint = xstrdup(key + 4); sigc->key = xstrdup(sigc->fingerprint); } else { /* -- 2.51.2.540.g4ad31e1014 ^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH 1/5] gpg-interface: simplify ssh fingerprint parsing 2025-10-28 8:12 ` [PATCH 1/5] gpg-interface: simplify ssh fingerprint parsing Christian Couder @ 2025-10-28 16:45 ` Junio C Hamano 0 siblings, 0 replies; 22+ messages in thread From: Junio C Hamano @ 2025-10-28 16:45 UTC (permalink / raw) To: Christian Couder Cc: git, Patrick Steinhardt, Elijah Newren, Jeff King, brian m . carlson, Johannes Schindelin, Christian Couder Christian Couder <christian.couder@gmail.com> writes: > In "gpg-interface.c", the 'parse_ssh_output()' function takes a > 'struct signature_check *sigc' argument and populates many members of > this 'sigc' using information parsed from 'sigc->output' which > contains the ouput of an `ssh-keygen -Y ...` command that was used to > verify an SSH signature. > > When it populates 'sigc->fingerprint' though, it uses > `xstrdup(strstr(line, "key ") + 4)` while `strstr(line, "key ")` has > already been computed a few lines above and is already available in > the `key` variable. > > Let's simplify this. > > Signed-off-by: Christian Couder <chriscool@tuxfamily.org> > --- > gpg-interface.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gpg-interface.c b/gpg-interface.c > index 2f4f0e32cb..91d1b58cb4 100644 > --- a/gpg-interface.c > +++ b/gpg-interface.c > @@ -443,7 +443,7 @@ static void parse_ssh_output(struct signature_check *sigc) > > key = strstr(line, "key "); > if (key) { > - sigc->fingerprint = xstrdup(strstr(line, "key ") + 4); > + sigc->fingerprint = xstrdup(key + 4); Looks like an obvious avoidance of duplicated work. I am not sure if "find 'key ' anywhere on the line and take the first one" is a sensible validation, but that is not a fault of this patch ;-) > sigc->key = xstrdup(sigc->fingerprint); > } else { > /* ^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 2/5] gpg-interface: use left shift to define GPG_VERIFY_* 2025-10-28 8:12 [PATCH 0/5] fast-export/import: cleanups and translation Christian Couder 2025-10-28 8:12 ` [PATCH 1/5] gpg-interface: simplify ssh fingerprint parsing Christian Couder @ 2025-10-28 8:12 ` Christian Couder 2025-10-28 8:12 ` [PATCH 3/5] fast-export: mark strings for translation Christian Couder ` (3 subsequent siblings) 5 siblings, 0 replies; 22+ messages in thread From: Christian Couder @ 2025-10-28 8:12 UTC (permalink / raw) To: git Cc: Junio C Hamano, Patrick Steinhardt, Elijah Newren, Jeff King, brian m . carlson, Johannes Schindelin, Christian Couder, Christian Couder In "gpg-interface.h", the definitions of the GPG_VERIFY_* boolean flags are currently using 1, 2 and 4 while we often prefer the bitwise left shift operator, `<<`, for that purpose to make it clearer that they are boolean. Let's use the left shift operator here too. Let's also fix an indent issue with "4" while at it. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> --- gpg-interface.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gpg-interface.h b/gpg-interface.h index 50487aa148..ead1ed6967 100644 --- a/gpg-interface.h +++ b/gpg-interface.h @@ -3,9 +3,9 @@ struct strbuf; -#define GPG_VERIFY_VERBOSE 1 -#define GPG_VERIFY_RAW 2 -#define GPG_VERIFY_OMIT_STATUS 4 +#define GPG_VERIFY_VERBOSE (1<<0) +#define GPG_VERIFY_RAW (1<<1) +#define GPG_VERIFY_OMIT_STATUS (1<<2) enum signature_trust_level { TRUST_UNDEFINED, -- 2.51.2.540.g4ad31e1014 ^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 3/5] fast-export: mark strings for translation 2025-10-28 8:12 [PATCH 0/5] fast-export/import: cleanups and translation Christian Couder 2025-10-28 8:12 ` [PATCH 1/5] gpg-interface: simplify ssh fingerprint parsing Christian Couder 2025-10-28 8:12 ` [PATCH 2/5] gpg-interface: use left shift to define GPG_VERIFY_* Christian Couder @ 2025-10-28 8:12 ` Christian Couder 2025-10-28 13:43 ` Junio C Hamano 2025-10-28 8:12 ` [PATCH 4/5] fast-import: " Christian Couder ` (2 subsequent siblings) 5 siblings, 1 reply; 22+ messages in thread From: Christian Couder @ 2025-10-28 8:12 UTC (permalink / raw) To: git Cc: Junio C Hamano, Patrick Steinhardt, Elijah Newren, Jeff King, brian m . carlson, Johannes Schindelin, Christian Couder, Christian Couder Some error or warning messages in "builtin/fast-export.c" are marked for translation, but many are not. To be more consistent and provide a better experience to people using a translated version, let's mark all the remaining error or warning messages for translation. While at it, improve how some arguments to some error functions are indented. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> --- builtin/fast-export.c | 77 ++++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/builtin/fast-export.c b/builtin/fast-export.c index dc2486f9a8..cb532f6325 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -65,7 +65,7 @@ static int parse_opt_sign_mode(const struct option *opt, return 0; if (parse_sign_mode(arg, val)) - return error("Unknown %s mode: %s", opt->long_name, arg); + return error(_("Unknown %s mode: %s"), opt->long_name, arg); return 0; } @@ -82,7 +82,7 @@ static int parse_opt_tag_of_filtered_mode(const struct option *opt, else if (!strcmp(arg, "rewrite")) *val = REWRITE; else - return error("Unknown tag-of-filtered mode: %s", arg); + return error(_("Unknown tag-of-filtered mode: %s"), arg); return 0; } @@ -107,7 +107,7 @@ static int parse_opt_reencode_mode(const struct option *opt, if (!strcasecmp(arg, "abort")) *val = REENCODE_ABORT; else - return error("Unknown reencoding mode: %s", arg); + return error(_("Unknown reencoding mode: %s"), arg); } return 0; @@ -318,16 +318,16 @@ static void export_blob(const struct object_id *oid) } else { buf = odb_read_object(the_repository->objects, oid, &type, &size); if (!buf) - die("could not read blob %s", oid_to_hex(oid)); + die(_("could not read blob %s"), oid_to_hex(oid)); if (check_object_signature(the_repository, oid, buf, size, type) < 0) - die("oid mismatch in blob %s", oid_to_hex(oid)); + die(_("oid mismatch in blob %s"), oid_to_hex(oid)); object = parse_object_buffer(the_repository, oid, type, size, buf, &eaten); } if (!object) - die("Could not read blob %s", oid_to_hex(oid)); + die(_("Could not read blob %s"), oid_to_hex(oid)); mark_next_object(object); @@ -336,7 +336,7 @@ static void export_blob(const struct object_id *oid) printf("original-oid %s\n", oid_to_hex(oid)); printf("data %"PRIuMAX"\n", (uintmax_t)size); if (size && fwrite(buf, size, 1, stdout) != 1) - die_errno("could not write blob '%s'", oid_to_hex(oid)); + die_errno(_("could not write blob '%s'"), oid_to_hex(oid)); printf("\n"); show_progress(); @@ -499,10 +499,10 @@ static void show_filemodify(struct diff_queue_struct *q, break; default: - die("Unexpected comparison status '%c' for %s, %s", - q->queue[i]->status, - ospec->path ? ospec->path : "none", - spec->path ? spec->path : "none"); + die(_("Unexpected comparison status '%c' for %s, %s"), + q->queue[i]->status, + ospec->path ? ospec->path : _("none"), + spec->path ? spec->path : _("none")); } } } @@ -699,14 +699,14 @@ static void handle_commit(struct commit *commit, struct rev_info *rev, author = strstr(commit_buffer_cursor, "\nauthor "); if (!author) - die("could not find author in commit %s", + die(_("could not find author in commit %s"), oid_to_hex(&commit->object.oid)); author++; commit_buffer_cursor = author_end = strchrnul(author, '\n'); committer = strstr(commit_buffer_cursor, "\ncommitter "); if (!committer) - die("could not find committer in commit %s", + die(_("could not find committer in commit %s"), oid_to_hex(&commit->object.oid)); committer++; commit_buffer_cursor = committer_end = strchrnul(committer, '\n'); @@ -781,8 +781,8 @@ static void handle_commit(struct commit *commit, struct rev_info *rev, case REENCODE_NO: break; case REENCODE_ABORT: - die("Encountered commit-specific encoding %.*s in commit " - "%s; use --reencode=[yes|no] to handle it", + die(_("Encountered commit-specific encoding %.*s in commit " + "%s; use --reencode=[yes|no] to handle it"), (int)encoding_len, encoding, oid_to_hex(&commit->object.oid)); } @@ -798,11 +798,11 @@ static void handle_commit(struct commit *commit, struct rev_info *rev, if (signatures.nr) { switch (signed_commit_mode) { case SIGN_ABORT: - die("encountered signed commit %s; use " - "--signed-commits=<mode> to handle it", + die(_("encountered signed commit %s; use " + "--signed-commits=<mode> to handle it"), oid_to_hex(&commit->object.oid)); case SIGN_WARN_VERBATIM: - warning("exporting %"PRIuMAX" signature(s) for commit %s", + warning(_("exporting %"PRIuMAX" signature(s) for commit %s"), (uintmax_t)signatures.nr, oid_to_hex(&commit->object.oid)); /* fallthru */ case SIGN_VERBATIM: @@ -812,7 +812,7 @@ static void handle_commit(struct commit *commit, struct rev_info *rev, } break; case SIGN_WARN_STRIP: - warning("stripping signature(s) from commit %s", + warning(_("stripping signature(s) from commit %s"), oid_to_hex(&commit->object.oid)); /* fallthru */ case SIGN_STRIP: @@ -890,7 +890,8 @@ static void handle_tag(const char *name, struct tag *tag) tagged = ((struct tag *)tagged)->tagged; } if (tagged->type == OBJ_TREE) { - warning("Omitting tag %s,\nsince tags of trees (or tags of tags of trees, etc.) are not supported.", + warning(_("Omitting tag %s,\nsince tags of trees (or tags " + "of tags of trees, etc.) are not supported."), oid_to_hex(&tag->object.oid)); return; } @@ -898,7 +899,7 @@ static void handle_tag(const char *name, struct tag *tag) buf = odb_read_object(the_repository->objects, &tag->object.oid, &type, &size); if (!buf) - die("could not read tag %s", oid_to_hex(&tag->object.oid)); + die(_("could not read tag %s"), oid_to_hex(&tag->object.oid)); message = memmem(buf, size, "\n\n", 2); if (message) { message += 2; @@ -936,17 +937,17 @@ static void handle_tag(const char *name, struct tag *tag) if (signature) switch (signed_tag_mode) { case SIGN_ABORT: - die("encountered signed tag %s; use " - "--signed-tags=<mode> to handle it", + die(_("encountered signed tag %s; use " + "--signed-tags=<mode> to handle it"), oid_to_hex(&tag->object.oid)); case SIGN_WARN_VERBATIM: - warning("exporting signed tag %s", + warning(_("exporting signed tag %s"), oid_to_hex(&tag->object.oid)); /* fallthru */ case SIGN_VERBATIM: break; case SIGN_WARN_STRIP: - warning("stripping signature from tag %s", + warning(_("stripping signature from tag %s"), oid_to_hex(&tag->object.oid)); /* fallthru */ case SIGN_STRIP: @@ -961,8 +962,8 @@ static void handle_tag(const char *name, struct tag *tag) if (!tagged_mark) { switch (tag_of_filtered_mode) { case TAG_FILTERING_ABORT: - die("tag %s tags unexported object; use " - "--tag-of-filtered-object=<mode> to handle it", + die(_("tag %s tags unexported object; use " + "--tag-of-filtered-object=<mode> to handle it"), oid_to_hex(&tag->object.oid)); case DROP: /* Ignore this tag altogether */ @@ -1026,7 +1027,7 @@ static struct commit *get_commit(struct rev_cmdline_entry *e, const char *full_n tag = (struct tag *)tag->tagged; } if (!tag) - die("Tag %s points nowhere?", e->name); + die(_("Tag %s points nowhere?"), e->name); return (struct commit *)tag; } default: @@ -1064,7 +1065,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info) commit = get_commit(e, full_name); if (!commit) { - warning("%s: Unexpected object of type %s, skipping.", + warning(_("%s: Unexpected object of type %s, skipping."), e->name, type_name(e->item->type)); free(full_name); @@ -1079,7 +1080,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info) free(full_name); continue; default: /* OBJ_TAG (nested tags) is already handled */ - warning("Tag points to object of unexpected type %s, skipping.", + warning(_("Tag points to object of unexpected type %s, skipping."), type_name(commit->object.type)); free(full_name); continue; @@ -1175,7 +1176,7 @@ static void export_marks(char *file) f = fopen_for_writing(file); if (!f) - die_errno("Unable to open marks file %s for writing.", file); + die_errno(_("Unable to open marks file %s for writing."), file); for (i = 0; i < idnums.size; i++) { if (deco->base && deco->base->type == 1) { @@ -1192,7 +1193,7 @@ static void export_marks(char *file) e |= ferror(f); e |= fclose(f); if (e) - error("Unable to write marks file %s.", file); + error(_("Unable to write marks file %s."), file); } static void import_marks(char *input_file, int check_exists) @@ -1215,20 +1216,20 @@ static void import_marks(char *input_file, int check_exists) line_end = strchr(line, '\n'); if (line[0] != ':' || !line_end) - die("corrupt mark line: %s", line); + die(_("corrupt mark line: %s"), line); *line_end = '\0'; mark = strtoumax(line + 1, &mark_end, 10); if (!mark || mark_end == line + 1 || *mark_end != ' ' || get_oid_hex(mark_end + 1, &oid)) - die("corrupt mark line: %s", line); + die(_("corrupt mark line: %s"), line); if (last_idnum < mark) last_idnum = mark; type = odb_read_object_info(the_repository->objects, &oid, NULL); if (type < 0) - die("object not found: %s", oid_to_hex(&oid)); + die(_("object not found: %s"), oid_to_hex(&oid)); if (type != OBJ_COMMIT) /* only commits */ @@ -1236,12 +1237,12 @@ static void import_marks(char *input_file, int check_exists) commit = lookup_commit(the_repository, &oid); if (!commit) - die("not a commit? can't happen: %s", oid_to_hex(&oid)); + die(_("not a commit? can't happen: %s"), oid_to_hex(&oid)); object = &commit->object; if (object->flags & SHOWN) - error("Object %s already has a mark", oid_to_hex(&oid)); + error(_("Object %s already has a mark"), oid_to_hex(&oid)); mark_object(object, mark); @@ -1395,7 +1396,7 @@ int cmd_fast_export(int argc, get_tags_and_duplicates(&revs.cmdline); if (prepare_revision_walk(&revs)) - die("revision walk setup failed"); + die(_("revision walk setup failed")); revs.reverse = 1; revs.diffopt.format_callback = show_filemodify; -- 2.51.2.540.g4ad31e1014 ^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH 3/5] fast-export: mark strings for translation 2025-10-28 8:12 ` [PATCH 3/5] fast-export: mark strings for translation Christian Couder @ 2025-10-28 13:43 ` Junio C Hamano 2025-10-29 14:29 ` Christian Couder 0 siblings, 1 reply; 22+ messages in thread From: Junio C Hamano @ 2025-10-28 13:43 UTC (permalink / raw) To: Christian Couder Cc: git, Patrick Steinhardt, Elijah Newren, Jeff King, brian m . carlson, Johannes Schindelin, Christian Couder Christian Couder <christian.couder@gmail.com> writes: > Some error or warning messages in "builtin/fast-export.c" are marked > for translation, but many are not. > > To be more consistent and provide a better experience to people using a > translated version, let's mark all the remaining error or warning > messages for translation. Makes sense. Should we also downcase some Unknown and Unexpected? > While at it, improve how some arguments to some error functions are > indented. OK. > Signed-off-by: Christian Couder <chriscool@tuxfamily.org> > --- > builtin/fast-export.c | 77 ++++++++++++++++++++++--------------------- > 1 file changed, 39 insertions(+), 38 deletions(-) > > diff --git a/builtin/fast-export.c b/builtin/fast-export.c > index dc2486f9a8..cb532f6325 100644 > --- a/builtin/fast-export.c > +++ b/builtin/fast-export.c > @@ -65,7 +65,7 @@ static int parse_opt_sign_mode(const struct option *opt, > return 0; > > if (parse_sign_mode(arg, val)) > - return error("Unknown %s mode: %s", opt->long_name, arg); > + return error(_("Unknown %s mode: %s"), opt->long_name, arg); > > return 0; > } > @@ -82,7 +82,7 @@ static int parse_opt_tag_of_filtered_mode(const struct option *opt, > else if (!strcmp(arg, "rewrite")) > *val = REWRITE; > else > - return error("Unknown tag-of-filtered mode: %s", arg); > + return error(_("Unknown tag-of-filtered mode: %s"), arg); > return 0; > } > > @@ -107,7 +107,7 @@ static int parse_opt_reencode_mode(const struct option *opt, > if (!strcasecmp(arg, "abort")) > *val = REENCODE_ABORT; > else > - return error("Unknown reencoding mode: %s", arg); > + return error(_("Unknown reencoding mode: %s"), arg); > } > > return 0; > @@ -318,16 +318,16 @@ static void export_blob(const struct object_id *oid) > } else { > buf = odb_read_object(the_repository->objects, oid, &type, &size); > if (!buf) > - die("could not read blob %s", oid_to_hex(oid)); > + die(_("could not read blob %s"), oid_to_hex(oid)); > if (check_object_signature(the_repository, oid, buf, size, > type) < 0) > - die("oid mismatch in blob %s", oid_to_hex(oid)); > + die(_("oid mismatch in blob %s"), oid_to_hex(oid)); > object = parse_object_buffer(the_repository, oid, type, > size, buf, &eaten); > } > > if (!object) > - die("Could not read blob %s", oid_to_hex(oid)); > + die(_("Could not read blob %s"), oid_to_hex(oid)); > > mark_next_object(object); > > @@ -336,7 +336,7 @@ static void export_blob(const struct object_id *oid) > printf("original-oid %s\n", oid_to_hex(oid)); > printf("data %"PRIuMAX"\n", (uintmax_t)size); > if (size && fwrite(buf, size, 1, stdout) != 1) > - die_errno("could not write blob '%s'", oid_to_hex(oid)); > + die_errno(_("could not write blob '%s'"), oid_to_hex(oid)); > printf("\n"); > > show_progress(); > @@ -499,10 +499,10 @@ static void show_filemodify(struct diff_queue_struct *q, > break; > > default: > - die("Unexpected comparison status '%c' for %s, %s", > - q->queue[i]->status, > - ospec->path ? ospec->path : "none", > - spec->path ? spec->path : "none"); > + die(_("Unexpected comparison status '%c' for %s, %s"), > + q->queue[i]->status, > + ospec->path ? ospec->path : _("none"), > + spec->path ? spec->path : _("none")); > } > } > } > @@ -699,14 +699,14 @@ static void handle_commit(struct commit *commit, struct rev_info *rev, > > author = strstr(commit_buffer_cursor, "\nauthor "); > if (!author) > - die("could not find author in commit %s", > + die(_("could not find author in commit %s"), > oid_to_hex(&commit->object.oid)); > author++; > commit_buffer_cursor = author_end = strchrnul(author, '\n'); > > committer = strstr(commit_buffer_cursor, "\ncommitter "); > if (!committer) > - die("could not find committer in commit %s", > + die(_("could not find committer in commit %s"), > oid_to_hex(&commit->object.oid)); > committer++; > commit_buffer_cursor = committer_end = strchrnul(committer, '\n'); > @@ -781,8 +781,8 @@ static void handle_commit(struct commit *commit, struct rev_info *rev, > case REENCODE_NO: > break; > case REENCODE_ABORT: > - die("Encountered commit-specific encoding %.*s in commit " > - "%s; use --reencode=[yes|no] to handle it", > + die(_("Encountered commit-specific encoding %.*s in commit " > + "%s; use --reencode=[yes|no] to handle it"), > (int)encoding_len, encoding, > oid_to_hex(&commit->object.oid)); > } > @@ -798,11 +798,11 @@ static void handle_commit(struct commit *commit, struct rev_info *rev, > if (signatures.nr) { > switch (signed_commit_mode) { > case SIGN_ABORT: > - die("encountered signed commit %s; use " > - "--signed-commits=<mode> to handle it", > + die(_("encountered signed commit %s; use " > + "--signed-commits=<mode> to handle it"), > oid_to_hex(&commit->object.oid)); > case SIGN_WARN_VERBATIM: > - warning("exporting %"PRIuMAX" signature(s) for commit %s", > + warning(_("exporting %"PRIuMAX" signature(s) for commit %s"), > (uintmax_t)signatures.nr, oid_to_hex(&commit->object.oid)); > /* fallthru */ > case SIGN_VERBATIM: > @@ -812,7 +812,7 @@ static void handle_commit(struct commit *commit, struct rev_info *rev, > } > break; > case SIGN_WARN_STRIP: > - warning("stripping signature(s) from commit %s", > + warning(_("stripping signature(s) from commit %s"), > oid_to_hex(&commit->object.oid)); > /* fallthru */ > case SIGN_STRIP: > @@ -890,7 +890,8 @@ static void handle_tag(const char *name, struct tag *tag) > tagged = ((struct tag *)tagged)->tagged; > } > if (tagged->type == OBJ_TREE) { > - warning("Omitting tag %s,\nsince tags of trees (or tags of tags of trees, etc.) are not supported.", > + warning(_("Omitting tag %s,\nsince tags of trees (or tags " > + "of tags of trees, etc.) are not supported."), > oid_to_hex(&tag->object.oid)); > return; > } > @@ -898,7 +899,7 @@ static void handle_tag(const char *name, struct tag *tag) > buf = odb_read_object(the_repository->objects, &tag->object.oid, > &type, &size); > if (!buf) > - die("could not read tag %s", oid_to_hex(&tag->object.oid)); > + die(_("could not read tag %s"), oid_to_hex(&tag->object.oid)); > message = memmem(buf, size, "\n\n", 2); > if (message) { > message += 2; > @@ -936,17 +937,17 @@ static void handle_tag(const char *name, struct tag *tag) > if (signature) > switch (signed_tag_mode) { > case SIGN_ABORT: > - die("encountered signed tag %s; use " > - "--signed-tags=<mode> to handle it", > + die(_("encountered signed tag %s; use " > + "--signed-tags=<mode> to handle it"), > oid_to_hex(&tag->object.oid)); > case SIGN_WARN_VERBATIM: > - warning("exporting signed tag %s", > + warning(_("exporting signed tag %s"), > oid_to_hex(&tag->object.oid)); > /* fallthru */ > case SIGN_VERBATIM: > break; > case SIGN_WARN_STRIP: > - warning("stripping signature from tag %s", > + warning(_("stripping signature from tag %s"), > oid_to_hex(&tag->object.oid)); > /* fallthru */ > case SIGN_STRIP: > @@ -961,8 +962,8 @@ static void handle_tag(const char *name, struct tag *tag) > if (!tagged_mark) { > switch (tag_of_filtered_mode) { > case TAG_FILTERING_ABORT: > - die("tag %s tags unexported object; use " > - "--tag-of-filtered-object=<mode> to handle it", > + die(_("tag %s tags unexported object; use " > + "--tag-of-filtered-object=<mode> to handle it"), > oid_to_hex(&tag->object.oid)); > case DROP: > /* Ignore this tag altogether */ > @@ -1026,7 +1027,7 @@ static struct commit *get_commit(struct rev_cmdline_entry *e, const char *full_n > tag = (struct tag *)tag->tagged; > } > if (!tag) > - die("Tag %s points nowhere?", e->name); > + die(_("Tag %s points nowhere?"), e->name); > return (struct commit *)tag; > } > default: > @@ -1064,7 +1065,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info) > > commit = get_commit(e, full_name); > if (!commit) { > - warning("%s: Unexpected object of type %s, skipping.", > + warning(_("%s: Unexpected object of type %s, skipping."), > e->name, > type_name(e->item->type)); > free(full_name); > @@ -1079,7 +1080,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info) > free(full_name); > continue; > default: /* OBJ_TAG (nested tags) is already handled */ > - warning("Tag points to object of unexpected type %s, skipping.", > + warning(_("Tag points to object of unexpected type %s, skipping."), > type_name(commit->object.type)); > free(full_name); > continue; > @@ -1175,7 +1176,7 @@ static void export_marks(char *file) > > f = fopen_for_writing(file); > if (!f) > - die_errno("Unable to open marks file %s for writing.", file); > + die_errno(_("Unable to open marks file %s for writing."), file); > > for (i = 0; i < idnums.size; i++) { > if (deco->base && deco->base->type == 1) { > @@ -1192,7 +1193,7 @@ static void export_marks(char *file) > e |= ferror(f); > e |= fclose(f); > if (e) > - error("Unable to write marks file %s.", file); > + error(_("Unable to write marks file %s."), file); > } > > static void import_marks(char *input_file, int check_exists) > @@ -1215,20 +1216,20 @@ static void import_marks(char *input_file, int check_exists) > > line_end = strchr(line, '\n'); > if (line[0] != ':' || !line_end) > - die("corrupt mark line: %s", line); > + die(_("corrupt mark line: %s"), line); > *line_end = '\0'; > > mark = strtoumax(line + 1, &mark_end, 10); > if (!mark || mark_end == line + 1 > || *mark_end != ' ' || get_oid_hex(mark_end + 1, &oid)) > - die("corrupt mark line: %s", line); > + die(_("corrupt mark line: %s"), line); > > if (last_idnum < mark) > last_idnum = mark; > > type = odb_read_object_info(the_repository->objects, &oid, NULL); > if (type < 0) > - die("object not found: %s", oid_to_hex(&oid)); > + die(_("object not found: %s"), oid_to_hex(&oid)); > > if (type != OBJ_COMMIT) > /* only commits */ > @@ -1236,12 +1237,12 @@ static void import_marks(char *input_file, int check_exists) > > commit = lookup_commit(the_repository, &oid); > if (!commit) > - die("not a commit? can't happen: %s", oid_to_hex(&oid)); > + die(_("not a commit? can't happen: %s"), oid_to_hex(&oid)); > > object = &commit->object; > > if (object->flags & SHOWN) > - error("Object %s already has a mark", oid_to_hex(&oid)); > + error(_("Object %s already has a mark"), oid_to_hex(&oid)); > > mark_object(object, mark); > > @@ -1395,7 +1396,7 @@ int cmd_fast_export(int argc, > get_tags_and_duplicates(&revs.cmdline); > > if (prepare_revision_walk(&revs)) > - die("revision walk setup failed"); > + die(_("revision walk setup failed")); > > revs.reverse = 1; > revs.diffopt.format_callback = show_filemodify; ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 3/5] fast-export: mark strings for translation 2025-10-28 13:43 ` Junio C Hamano @ 2025-10-29 14:29 ` Christian Couder 2025-10-29 16:12 ` Junio C Hamano 0 siblings, 1 reply; 22+ messages in thread From: Christian Couder @ 2025-10-29 14:29 UTC (permalink / raw) To: Junio C Hamano Cc: git, Patrick Steinhardt, Elijah Newren, Jeff King, brian m . carlson, Johannes Schindelin, Christian Couder On Tue, Oct 28, 2025 at 2:43 PM Junio C Hamano <gitster@pobox.com> wrote: > > Christian Couder <christian.couder@gmail.com> writes: > > > Some error or warning messages in "builtin/fast-export.c" are marked > > for translation, but many are not. > > > > To be more consistent and provide a better experience to people using a > > translated version, let's mark all the remaining error or warning > > messages for translation. > > Makes sense. Should we also downcase some Unknown and Unexpected? I am fine with doing it as part of this series, but I wonder if it should be part of this patch or in a separate patch. If it's in a separate patch, each patch might be easier to review independently, but a number of lines will be changed several times in this series. So not sure what's the best practice. Thanks. ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 3/5] fast-export: mark strings for translation 2025-10-29 14:29 ` Christian Couder @ 2025-10-29 16:12 ` Junio C Hamano 2025-10-30 12:39 ` Christian Couder 0 siblings, 1 reply; 22+ messages in thread From: Junio C Hamano @ 2025-10-29 16:12 UTC (permalink / raw) To: Christian Couder Cc: git, Patrick Steinhardt, Elijah Newren, Jeff King, brian m . carlson, Johannes Schindelin, Christian Couder Christian Couder <christian.couder@gmail.com> writes: > On Tue, Oct 28, 2025 at 2:43 PM Junio C Hamano <gitster@pobox.com> wrote: >> >> Christian Couder <christian.couder@gmail.com> writes: >> >> > Some error or warning messages in "builtin/fast-export.c" are marked >> > for translation, but many are not. >> > >> > To be more consistent and provide a better experience to people using a >> > translated version, let's mark all the remaining error or warning >> > messages for translation. >> >> Makes sense. Should we also downcase some Unknown and Unexpected? > > I am fine with doing it as part of this series, but I wonder if it > should be part of this patch or in a separate patch. > > If it's in a separate patch, each patch might be easier to review > independently, but a number of lines will be changed several times in > this series. So not sure what's the best practice. Rephrasing the messages may need more careful thinking while reviewing, but if you limit your changes to only downcasing the first letter, I would think it would fall in the same bucket as "While at it, improve code indentation". Thanks. ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 3/5] fast-export: mark strings for translation 2025-10-29 16:12 ` Junio C Hamano @ 2025-10-30 12:39 ` Christian Couder 0 siblings, 0 replies; 22+ messages in thread From: Christian Couder @ 2025-10-30 12:39 UTC (permalink / raw) To: Junio C Hamano Cc: git, Patrick Steinhardt, Elijah Newren, Jeff King, brian m . carlson, Johannes Schindelin, Christian Couder On Wed, Oct 29, 2025 at 5:12 PM Junio C Hamano <gitster@pobox.com> wrote: > > Christian Couder <christian.couder@gmail.com> writes: > > > On Tue, Oct 28, 2025 at 2:43 PM Junio C Hamano <gitster@pobox.com> wrote: > >> Makes sense. Should we also downcase some Unknown and Unexpected? > > > > I am fine with doing it as part of this series, but I wonder if it > > should be part of this patch or in a separate patch. > > > > If it's in a separate patch, each patch might be easier to review > > independently, but a number of lines will be changed several times in > > this series. So not sure what's the best practice. > > Rephrasing the messages may need more careful thinking while > reviewing, but if you limit your changes to only downcasing the > first letter, I would think it would fall in the same bucket as > "While at it, improve code indentation". I did it in the same patches in the v2 I just sent, but an issue I faced was that some tests in "t9300-fast-import.sh" check for some error messages in a case sensitive way, so I had to make changes in those tests. ^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 4/5] fast-import: mark strings for translation 2025-10-28 8:12 [PATCH 0/5] fast-export/import: cleanups and translation Christian Couder ` (2 preceding siblings ...) 2025-10-28 8:12 ` [PATCH 3/5] fast-export: mark strings for translation Christian Couder @ 2025-10-28 8:12 ` Christian Couder 2025-10-28 16:46 ` Junio C Hamano 2025-10-28 8:12 ` [PATCH 5/5] gpg-interface: mark a string " Christian Couder 2025-10-30 12:33 ` [PATCH v2 0/5] fast-export/import: cleanups and translation Christian Couder 5 siblings, 1 reply; 22+ messages in thread From: Christian Couder @ 2025-10-28 8:12 UTC (permalink / raw) To: git Cc: Junio C Hamano, Patrick Steinhardt, Elijah Newren, Jeff King, brian m . carlson, Johannes Schindelin, Christian Couder, Christian Couder Some error or warning messages in "builtin/fast-import.c" are marked for translation, but many are not. To be more consistent and provide a better experience to people using a translated version, let's mark all the remaining error or warning messages for translation. While at it, let's make the following small changes: - replace "GIT" or "git" in a few error messages to just "Git", - replace "Expected from command, got %s" to "Expected 'from' command, got '%s'", which makes it clearer that "from" is a command and should not be translated, - adjust the indentation of some arguments of the error functions. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> --- builtin/fast-import.c | 270 +++++++++++++++++++++--------------------- 1 file changed, 135 insertions(+), 135 deletions(-) diff --git a/builtin/fast-import.c b/builtin/fast-import.c index 606c6aea82..96ff0c7360 100644 --- a/builtin/fast-import.c +++ b/builtin/fast-import.c @@ -338,12 +338,12 @@ static void write_crash_report(const char *err) struct recent_command *rc; if (!rpt) { - error_errno("can't write crash report %s", loc); + error_errno(_("can't write crash report %s"), loc); free(loc); return; } - fprintf(stderr, "fast-import: dumping crash report to %s\n", loc); + fprintf(stderr, _("fast-import: dumping crash report to %s\n"), loc); fprintf(rpt, "fast-import crash report:\n"); fprintf(rpt, " fast-import process: %"PRIuMAX"\n", (uintmax_t) getpid()); @@ -587,7 +587,7 @@ static void *find_mark(struct mark_set *s, uintmax_t idnum) oe = s->data.marked[idnum]; } if (!oe) - die("mark :%" PRIuMAX " not declared", orig_idnum); + die(_("mark :%" PRIuMAX " not declared"), orig_idnum); return oe; } @@ -627,9 +627,9 @@ static struct branch *new_branch(const char *name) struct branch *b = lookup_branch(name); if (b) - die("Invalid attempt to create duplicate branch: %s", name); + die(_("Invalid attempt to create duplicate branch: %s"), name); if (check_refname_format(name, REFNAME_ALLOW_ONELEVEL)) - die("Branch name doesn't conform to GIT standards: %s", name); + die(_("Branch name doesn't conform to Git standards: %s"), name); b = mem_pool_calloc(&fi_mem_pool, 1, sizeof(struct branch)); b->name = mem_pool_strdup(&fi_mem_pool, name); @@ -800,7 +800,7 @@ static const char *create_index(void) *c++ = &e->idx; last = idx + object_count; if (c != last) - die("internal consistency error creating the index"); + die(_("internal consistency error creating the index")); tmpfile = write_idx_file(the_repository, NULL, idx, object_count, &pack_idx_opts, pack_data->hash); @@ -818,18 +818,18 @@ static char *keep_pack(const char *curr_index_name) keep_fd = safe_create_file_with_leading_directories(pack_data->repo, name.buf); if (keep_fd < 0) - die_errno("cannot create keep file"); + die_errno(_("cannot create keep file")); write_or_die(keep_fd, keep_msg, strlen(keep_msg)); if (close(keep_fd)) - die_errno("failed to write keep file"); + die_errno(_("failed to write keep file")); odb_pack_name(pack_data->repo, &name, pack_data->hash, "pack"); if (finalize_object_file(pack_data->repo, pack_data->pack_name, name.buf)) - die("cannot store pack file"); + die(_("cannot store pack file")); odb_pack_name(pack_data->repo, &name, pack_data->hash, "idx"); if (finalize_object_file(pack_data->repo, curr_index_name, name.buf)) - die("cannot store index file"); + die(_("cannot store index file")); free((void *)curr_index_name); return strbuf_detach(&name, NULL); } @@ -852,7 +852,7 @@ static int loosen_small_pack(const struct packed_git *p) struct child_process unpack = CHILD_PROCESS_INIT; if (lseek(p->pack_fd, 0, SEEK_SET) < 0) - die_errno("Failed seeking to start of '%s'", p->pack_name); + die_errno(_("Failed seeking to start of '%s'"), p->pack_name); unpack.in = p->pack_fd; unpack.git_cmd = 1; @@ -902,7 +902,7 @@ static void end_packfile(void) new_p = packfile_store_load_pack(pack_data->repo->objects->packfiles, idx_name, 1); if (!new_p) - die("core git rejected index %s", idx_name); + die(_("core Git rejected index %s"), idx_name); all_packs[pack_id] = new_p; free(idx_name); @@ -1089,7 +1089,7 @@ static int store_object( static void truncate_pack(struct hashfile_checkpoint *checkpoint) { if (hashfile_truncate(pack_file, checkpoint)) - die_errno("cannot truncate pack to skip duplicate"); + die_errno(_("cannot truncate pack to skip duplicate")); pack_size = checkpoint->offset; } @@ -1137,7 +1137,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark) size_t cnt = in_sz < len ? in_sz : (size_t)len; size_t n = fread(in_buf, 1, cnt, stdin); if (!n && feof(stdin)) - die("EOF in data (%" PRIuMAX " bytes remaining)", len); + die(_("EOF in data (%" PRIuMAX " bytes remaining)"), len); git_hash_update(&c, in_buf, n); s.next_in = in_buf; @@ -1161,7 +1161,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark) case Z_STREAM_END: continue; default: - die("unexpected deflate failure: %d", status); + die(_("unexpected deflate failure: %d"), status); } } git_deflate_end(&s); @@ -1263,16 +1263,16 @@ static void load_tree(struct tree_entry *root) myoe = find_object(oid); if (myoe && myoe->pack_id != MAX_PACK_ID) { if (myoe->type != OBJ_TREE) - die("Not a tree: %s", oid_to_hex(oid)); + die(_("Not a tree: %s"), oid_to_hex(oid)); t->delta_depth = myoe->depth; buf = gfi_unpack_entry(myoe, &size); if (!buf) - die("Can't load tree %s", oid_to_hex(oid)); + die(_("Can't load tree %s"), oid_to_hex(oid)); } else { enum object_type type; buf = odb_read_object(the_repository->objects, oid, &type, &size); if (!buf || type != OBJ_TREE) - die("Can't load tree %s", oid_to_hex(oid)); + die(_("Can't load tree %s"), oid_to_hex(oid)); } c = buf; @@ -1286,7 +1286,7 @@ static void load_tree(struct tree_entry *root) e->tree = NULL; c = parse_mode(c, &e->versions[1].mode); if (!c) - die("Corrupt mode in %s", oid_to_hex(oid)); + die(_("Corrupt mode in %s"), oid_to_hex(oid)); e->versions[0].mode = e->versions[1].mode; e->name = to_atom(c, strlen(c)); c += e->name->str_len + 1; @@ -1398,7 +1398,7 @@ static void tree_content_replace( struct tree_content *newtree) { if (!S_ISDIR(mode)) - die("Root cannot be a non-directory"); + die(_("Root cannot be a non-directory")); oidclr(&root->versions[0].oid, the_repository->hash_algo); oidcpy(&root->versions[1].oid, oid); if (root->tree) @@ -1421,9 +1421,9 @@ static int tree_content_set( slash1 = strchrnul(p, '/'); n = slash1 - p; if (!n) - die("Empty path component found in input"); + die(_("Empty path component found in input")); if (!*slash1 && !S_ISDIR(mode) && subtree) - die("Non-directories cannot have subtrees"); + die(_("Non-directories cannot have subtrees")); if (!root->tree) load_tree(root); @@ -1575,7 +1575,7 @@ static int tree_content_get( slash1 = strchrnul(p, '/'); n = slash1 - p; if (!n && !allow_root) - die("Empty path component found in input"); + die(_("Empty path component found in input")); if (!root->tree) load_tree(root); @@ -1621,8 +1621,8 @@ static int update_branch(struct branch *b) !strcmp(b->name + strlen(replace_prefix), oid_to_hex(&b->oid))) { if (!quiet) - warning("Dropping %s since it would point to " - "itself (i.e. to %s)", + warning(_("Dropping %s since it would point to " + "itself (i.e. to %s)"), b->name, oid_to_hex(&b->oid)); refs_delete_ref(get_main_ref_store(the_repository), NULL, b->name, NULL, 0); @@ -1645,14 +1645,14 @@ static int update_branch(struct branch *b) new_cmit = lookup_commit_reference_gently(the_repository, &b->oid, 0); if (!old_cmit || !new_cmit) - return error("Branch %s is missing commits.", b->name); + return error(_("Branch %s is missing commits."), b->name); ret = repo_in_merge_bases(the_repository, old_cmit, new_cmit); if (ret < 0) exit(128); if (!ret) { - warning("Not updating %s" - " (new tip %s does not contain %s)", + warning(_("Not updating %s" + " (new tip %s does not contain %s)"), b->name, oid_to_hex(&b->oid), oid_to_hex(&old_oid)); return -1; @@ -1728,13 +1728,13 @@ static void dump_marks(void) return; if (safe_create_leading_directories_const(the_repository, export_marks_file)) { - failure |= error_errno("unable to create leading directories of %s", + failure |= error_errno(_("unable to create leading directories of %s"), export_marks_file); return; } if (hold_lock_file_for_update(&mark_lock, export_marks_file, 0) < 0) { - failure |= error_errno("Unable to write marks file %s", + failure |= error_errno(_("Unable to write marks file %s"), export_marks_file); return; } @@ -1743,14 +1743,14 @@ static void dump_marks(void) if (!f) { int saved_errno = errno; rollback_lock_file(&mark_lock); - failure |= error("Unable to write marks file %s: %s", + failure |= error(_("Unable to write marks file %s: %s"), export_marks_file, strerror(saved_errno)); return; } for_each_mark(marks, 0, dump_marks_fn, f); if (commit_lock_file(&mark_lock)) { - failure |= error_errno("Unable to write file %s", + failure |= error_errno(_("Unable to write file %s"), export_marks_file); return; } @@ -1764,7 +1764,7 @@ static void insert_object_entry(struct mark_set **s, struct object_id *oid, uint enum object_type type = odb_read_object_info(the_repository->objects, oid, NULL); if (type < 0) - die("object not found: %s", oid_to_hex(oid)); + die(_("object not found: %s"), oid_to_hex(oid)); e = insert_object(oid); e->type = type; e->pack_id = MAX_PACK_ID; @@ -1791,13 +1791,13 @@ static void read_mark_file(struct mark_set **s, FILE *f, mark_set_inserter_t ins end = strchr(line, '\n'); if (line[0] != ':' || !end) - die("corrupt mark line: %s", line); + die(_("corrupt mark line: %s"), line); *end = 0; mark = strtoumax(line + 1, &end, 10); if (!mark || end == line + 1 || *end != ' ' || get_oid_hex_any(end + 1, &oid) == GIT_HASH_UNKNOWN) - die("corrupt mark line: %s", line); + die(_("corrupt mark line: %s"), line); inserter(s, &oid, mark); } } @@ -1810,7 +1810,7 @@ static void read_marks(void) else if (import_marks_file_ignore_missing && errno == ENOENT) goto done; /* Marks file does not exist */ else - die_errno("cannot read '%s'", import_marks_file); + die_errno(_("cannot read '%s'"), import_marks_file); read_mark_file(&marks, f, insert_object_entry); fclose(f); done: @@ -1896,7 +1896,7 @@ static int parse_data(struct strbuf *sb, uintmax_t limit, uintmax_t *len_res) strbuf_reset(sb); if (!skip_prefix(command_buf.buf, "data ", &data)) - die("Expected 'data n' command, found: %s", command_buf.buf); + die(_("Expected 'data n' command, found: %s"), command_buf.buf); if (skip_prefix(data, "<<", &data)) { char *term = xstrdup(data); @@ -1904,7 +1904,7 @@ static int parse_data(struct strbuf *sb, uintmax_t limit, uintmax_t *len_res) for (;;) { if (strbuf_getline_lf(&command_buf, stdin) == EOF) - die("EOF in data (terminator '%s' not found)", term); + die(_("EOF in data (terminator '%s' not found)"), term); if (term_len == command_buf.len && !strcmp(term, command_buf.buf)) break; @@ -1922,12 +1922,12 @@ static int parse_data(struct strbuf *sb, uintmax_t limit, uintmax_t *len_res) return 0; } if (length < len) - die("data is too large to use in this context"); + die(_("data is too large to use in this context")); while (n < length) { size_t s = strbuf_fread(sb, length - n, stdin); if (!s && feof(stdin)) - die("EOF in data (%lu bytes remaining)", + die(_("EOF in data (%lu bytes remaining)"), (unsigned long)(length - n)); n += s; } @@ -1984,15 +1984,15 @@ static char *parse_ident(const char *buf) ltgt = buf + strcspn(buf, "<>"); if (*ltgt != '<') - die("Missing < in ident string: %s", buf); + die(_("Missing < in ident string: %s"), buf); if (ltgt != buf && ltgt[-1] != ' ') - die("Missing space before < in ident string: %s", buf); + die(_("Missing space before < in ident string: %s"), buf); ltgt = ltgt + 1 + strcspn(ltgt + 1, "<>"); if (*ltgt != '>') - die("Missing > in ident string: %s", buf); + die(_("Missing > in ident string: %s"), buf); ltgt++; if (*ltgt != ' ') - die("Missing space after > in ident string: %s", buf); + die(_("Missing space after > in ident string: %s"), buf); ltgt++; name_len = ltgt - buf; strbuf_add(&ident, buf, name_len); @@ -2000,19 +2000,19 @@ static char *parse_ident(const char *buf) switch (whenspec) { case WHENSPEC_RAW: if (validate_raw_date(ltgt, &ident, 1) < 0) - die("Invalid raw date \"%s\" in ident: %s", ltgt, buf); + die(_("Invalid raw date \"%s\" in ident: %s"), ltgt, buf); break; case WHENSPEC_RAW_PERMISSIVE: if (validate_raw_date(ltgt, &ident, 0) < 0) - die("Invalid raw date \"%s\" in ident: %s", ltgt, buf); + die(_("Invalid raw date \"%s\" in ident: %s"), ltgt, buf); break; case WHENSPEC_RFC2822: if (parse_date(ltgt, &ident) < 0) - die("Invalid rfc2822 date \"%s\" in ident: %s", ltgt, buf); + die(_("Invalid rfc2822 date \"%s\" in ident: %s"), ltgt, buf); break; case WHENSPEC_NOW: if (strcmp("now", ltgt)) - die("Date in ident must be 'now': %s", buf); + die(_("Date in ident must be 'now': %s"), buf); datestamp(&ident); break; } @@ -2106,7 +2106,7 @@ static void construct_path_with_fanout(const char *hex_sha1, { unsigned int i = 0, j = 0; if (fanout >= the_hash_algo->rawsz) - die("Too large fanout (%u)", fanout); + die(_("Too large fanout (%u)"), fanout); while (fanout) { path[i++] = hex_sha1[j++]; path[i++] = hex_sha1[j++]; @@ -2180,7 +2180,7 @@ static uintmax_t do_change_note_fanout( /* Rename fullpath to realpath */ if (!tree_content_remove(orig_root, fullpath, &leaf, 0)) - die("Failed to remove path %s", fullpath); + die(_("Failed to remove path %s"), fullpath); tree_content_set(orig_root, realpath, &leaf.versions[1].oid, leaf.versions[1].mode, @@ -2253,7 +2253,7 @@ static uintmax_t parse_mark_ref(const char *p, char **endptr) p++; mark = strtoumax(p, endptr, 10); if (*endptr == p) - die("No value after ':' in mark: %s", command_buf.buf); + die(_("No value after ':' in mark: %s"), command_buf.buf); return mark; } @@ -2268,7 +2268,7 @@ static uintmax_t parse_mark_ref_eol(const char *p) mark = parse_mark_ref(p, &end); if (*end != '\0') - die("Garbage after mark: %s", command_buf.buf); + die(_("Garbage after mark: %s"), command_buf.buf); return mark; } @@ -2283,7 +2283,7 @@ static uintmax_t parse_mark_ref_space(const char **p) mark = parse_mark_ref(*p, &end); if (*end++ != ' ') - die("Missing space after mark: %s", command_buf.buf); + die(_("Missing space after mark: %s"), command_buf.buf); *p = end; return mark; } @@ -2299,9 +2299,9 @@ static void parse_path(struct strbuf *sb, const char *p, const char **endp, { if (*p == '"') { if (unquote_c_style(sb, p, endp)) - die("Invalid %s: %s", field, command_buf.buf); + die(_("Invalid %s: %s"), field, command_buf.buf); if (strlen(sb->buf) != sb->len) - die("NUL in %s: %s", field, command_buf.buf); + die(_("NUL in %s: %s"), field, command_buf.buf); } else { /* * Unless we are parsing the last field of a line, @@ -2324,7 +2324,7 @@ static void parse_path_eol(struct strbuf *sb, const char *p, const char *field) parse_path(sb, p, &end, 1, field); if (*end) - die("Garbage after %s: %s", field, command_buf.buf); + die(_("Garbage after %s: %s"), field, command_buf.buf); } /* @@ -2337,7 +2337,7 @@ static void parse_path_space(struct strbuf *sb, const char *p, { parse_path(sb, p, endp, 0, field); if (**endp != ' ') - die("Missing space after %s: %s", field, command_buf.buf); + die(_("Missing space after %s: %s"), field, command_buf.buf); (*endp)++; } @@ -2350,7 +2350,7 @@ static void file_change_m(const char *p, struct branch *b) p = parse_mode(p, &mode); if (!p) - die("Corrupt mode: %s", command_buf.buf); + die(_("Corrupt mode: %s"), command_buf.buf); switch (mode) { case 0644: case 0755: @@ -2363,7 +2363,7 @@ static void file_change_m(const char *p, struct branch *b) /* ok */ break; default: - die("Corrupt mode: %s", command_buf.buf); + die(_("Corrupt mode: %s"), command_buf.buf); } if (*p == ':') { @@ -2374,10 +2374,10 @@ static void file_change_m(const char *p, struct branch *b) oe = NULL; /* not used with inline_data, but makes gcc happy */ } else { if (parse_mapped_oid_hex(p, &oid, &p)) - die("Invalid dataref: %s", command_buf.buf); + die(_("Invalid dataref: %s"), command_buf.buf); oe = find_object(&oid); if (*p++ != ' ') - die("Missing space after SHA1: %s", command_buf.buf); + die(_("Missing space after SHA1: %s"), command_buf.buf); } strbuf_reset(&path); @@ -2393,11 +2393,11 @@ static void file_change_m(const char *p, struct branch *b) if (S_ISGITLINK(mode)) { if (inline_data) - die("Git links cannot be specified 'inline': %s", + die(_("Git links cannot be specified 'inline': %s"), command_buf.buf); else if (oe) { if (oe->type != OBJ_COMMIT) - die("Not a commit (actually a %s): %s", + die(_("Not a commit (actually a %s): %s"), type_name(oe->type), command_buf.buf); } /* @@ -2406,7 +2406,7 @@ static void file_change_m(const char *p, struct branch *b) */ } else if (inline_data) { if (S_ISDIR(mode)) - die("Directories cannot be specified 'inline': %s", + die(_("Directories cannot be specified 'inline': %s"), command_buf.buf); while (read_next_command() != EOF) { const char *v; @@ -2424,11 +2424,11 @@ static void file_change_m(const char *p, struct branch *b) odb_read_object_info(the_repository->objects, &oid, NULL); if (type < 0) - die("%s not found: %s", - S_ISDIR(mode) ? "Tree" : "Blob", - command_buf.buf); + die(_("%s not found: %s"), + S_ISDIR(mode) ? _("Tree") : _("Blob"), + command_buf.buf); if (type != expected) - die("Not a %s (actually a %s): %s", + die(_("Not a %s (actually a %s): %s"), type_name(expected), type_name(type), command_buf.buf); } @@ -2439,7 +2439,7 @@ static void file_change_m(const char *p, struct branch *b) } if (!verify_path(path.buf, mode)) - die("invalid path '%s'", path.buf); + die(_("invalid path '%s'"), path.buf); tree_content_set(&b->branch_tree, path.buf, &oid, mode, NULL); } @@ -2469,7 +2469,7 @@ static void file_change_cr(const char *p, struct branch *b, int rename) else tree_content_get(&b->branch_tree, source.buf, &leaf, 1); if (!leaf.versions[1].mode) - die("Path %s not in branch", source.buf); + die(_("Path %s not in branch"), source.buf); if (!*dest.buf) { /* C "path/to/subdir" "" */ tree_content_replace(&b->branch_tree, &leaf.versions[1].oid, @@ -2478,7 +2478,7 @@ static void file_change_cr(const char *p, struct branch *b, int rename) return; } if (!verify_path(dest.buf, leaf.versions[1].mode)) - die("invalid path '%s'", dest.buf); + die(_("invalid path '%s'"), dest.buf); tree_content_set(&b->branch_tree, dest.buf, &leaf.versions[1].oid, leaf.versions[1].mode, @@ -2520,23 +2520,23 @@ static void note_change_n(const char *p, struct branch *b, unsigned char *old_fa oe = NULL; /* not used with inline_data, but makes gcc happy */ } else { if (parse_mapped_oid_hex(p, &oid, &p)) - die("Invalid dataref: %s", command_buf.buf); + die(_("Invalid dataref: %s"), command_buf.buf); oe = find_object(&oid); if (*p++ != ' ') - die("Missing space after SHA1: %s", command_buf.buf); + die(_("Missing space after SHA1: %s"), command_buf.buf); } /* <commit-ish> */ s = lookup_branch(p); if (s) { if (is_null_oid(&s->oid)) - die("Can't add a note on empty branch."); + die(_("Can't add a note on empty branch.")); oidcpy(&commit_oid, &s->oid); } else if (*p == ':') { uintmax_t commit_mark = parse_mark_ref_eol(p); struct object_entry *commit_oe = find_mark(marks, commit_mark); if (commit_oe->type != OBJ_COMMIT) - die("Mark :%" PRIuMAX " not a commit", commit_mark); + die(_("Mark :%" PRIuMAX " not a commit"), commit_mark); oidcpy(&commit_oid, &commit_oe->idx.oid); } else if (!repo_get_oid(the_repository, p, &commit_oid)) { unsigned long size; @@ -2544,25 +2544,25 @@ static void note_change_n(const char *p, struct branch *b, unsigned char *old_fa &commit_oid, OBJ_COMMIT, &size, &commit_oid); if (!buf || size < the_hash_algo->hexsz + 6) - die("Not a valid commit: %s", p); + die(_("Not a valid commit: %s"), p); free(buf); } else - die("Invalid ref name or SHA1 expression: %s", p); + die(_("Invalid ref name or SHA1 expression: %s"), p); if (inline_data) { read_next_command(); parse_and_store_blob(&last_blob, &oid, 0); } else if (oe) { if (oe->type != OBJ_BLOB) - die("Not a blob (actually a %s): %s", + die(_("Not a blob (actually a %s): %s"), type_name(oe->type), command_buf.buf); } else if (!is_null_oid(&oid)) { enum object_type type = odb_read_object_info(the_repository->objects, &oid, NULL); if (type < 0) - die("Blob not found: %s", command_buf.buf); + die(_("Blob not found: %s"), command_buf.buf); if (type != OBJ_BLOB) - die("Not a blob (actually a %s): %s", + die(_("Not a blob (actually a %s): %s"), type_name(type), command_buf.buf); } @@ -2591,10 +2591,10 @@ static void file_change_deleteall(struct branch *b) static void parse_from_commit(struct branch *b, char *buf, unsigned long size) { if (!buf || size < the_hash_algo->hexsz + 6) - die("Not a valid commit: %s", oid_to_hex(&b->oid)); + die(_("Not a valid commit: %s"), oid_to_hex(&b->oid)); if (memcmp("tree ", buf, 5) || get_oid_hex(buf + 5, &b->branch_tree.versions[1].oid)) - die("The commit %s is corrupt", oid_to_hex(&b->oid)); + die(_("The commit %s is corrupt"), oid_to_hex(&b->oid)); oidcpy(&b->branch_tree.versions[0].oid, &b->branch_tree.versions[1].oid); } @@ -2624,7 +2624,7 @@ static int parse_objectish(struct branch *b, const char *objectish) s = lookup_branch(objectish); if (b == s) - die("Can't create a branch from itself: %s", b->name); + die(_("Can't create a branch from itself: %s"), b->name); else if (s) { struct object_id *t = &s->branch_tree.versions[1].oid; oidcpy(&b->oid, &s->oid); @@ -2634,7 +2634,7 @@ static int parse_objectish(struct branch *b, const char *objectish) uintmax_t idnum = parse_mark_ref_eol(objectish); struct object_entry *oe = find_mark(marks, idnum); if (oe->type != OBJ_COMMIT) - die("Mark :%" PRIuMAX " not a commit", idnum); + die(_("Mark :%" PRIuMAX " not a commit"), idnum); if (!oideq(&b->oid, &oe->idx.oid)) { oidcpy(&b->oid, &oe->idx.oid); if (oe->pack_id != MAX_PACK_ID) { @@ -2651,7 +2651,7 @@ static int parse_objectish(struct branch *b, const char *objectish) b->delete = 1; } else - die("Invalid ref name or SHA1 expression: %s", objectish); + die(_("Invalid ref name or SHA1 expression: %s"), objectish); if (b->branch_tree.tree && !oideq(&oid, &b->branch_tree.versions[1].oid)) { release_tree_content_recursive(b->branch_tree.tree); @@ -2698,7 +2698,7 @@ static struct hash_list *parse_merge(unsigned int *count) uintmax_t idnum = parse_mark_ref_eol(from); struct object_entry *oe = find_mark(marks, idnum); if (oe->type != OBJ_COMMIT) - die("Mark :%" PRIuMAX " not a commit", idnum); + die(_("Mark :%" PRIuMAX " not a commit"), idnum); oidcpy(&n->oid, &oe->idx.oid); } else if (!repo_get_oid(the_repository, from, &n->oid)) { unsigned long size; @@ -2706,10 +2706,10 @@ static struct hash_list *parse_merge(unsigned int *count) &n->oid, OBJ_COMMIT, &size, &n->oid); if (!buf || size < the_hash_algo->hexsz + 6) - die("Not a valid commit: %s", from); + die(_("Not a valid commit: %s"), from); free(buf); } else - die("Invalid ref name or SHA1 expression: %s", from); + die(_("Invalid ref name or SHA1 expression: %s"), from); n->next = NULL; *tail = n; @@ -2733,8 +2733,8 @@ static void parse_one_signature(struct signature_data *sig, const char *v) char *space = strchr(args, ' '); if (!space) - die("Expected gpgsig format: 'gpgsig <hash-algo> <signature-format>', " - "got 'gpgsig %s'", args); + die(_("Expected gpgsig format: 'gpgsig <hash-algo> <signature-format>', " + "got 'gpgsig %s'"), args); *space = '\0'; sig->hash_algo = args; @@ -2743,13 +2743,13 @@ static void parse_one_signature(struct signature_data *sig, const char *v) /* Validate hash algorithm */ if (strcmp(sig->hash_algo, "sha1") && strcmp(sig->hash_algo, "sha256")) - die("Unknown git hash algorithm in gpgsig: '%s'", sig->hash_algo); + die(_("Unknown git hash algorithm in gpgsig: '%s'"), sig->hash_algo); /* Validate signature format */ if (!valid_signature_format(sig->sig_format)) - die("Invalid signature format in gpgsig: '%s'", sig->sig_format); + die(_("Invalid signature format in gpgsig: '%s'"), sig->sig_format); if (!strcmp(sig->sig_format, "unknown")) - warning("'unknown' signature format in gpgsig"); + warning(_("'unknown' signature format in gpgsig")); /* Read signature data */ read_next_command(); @@ -2788,8 +2788,8 @@ static void store_signature(struct signature_data *stored_sig, const char *hash_type) { if (stored_sig->hash_algo) { - warning("multiple %s signatures found, " - "ignoring additional signature", + warning(_("multiple %s signatures found, " + "ignoring additional signature"), hash_type); strbuf_release(&new_sig->data); free(new_sig->hash_algo); @@ -2844,15 +2844,15 @@ static void parse_new_commit(const char *arg) read_next_command(); } if (!committer) - die("Expected committer but didn't get one"); + die(_("Expected committer but didn't get one")); while (skip_prefix(command_buf.buf, "gpgsig ", &v)) { switch (signed_commit_mode) { /* First, modes that don't need the signature to be parsed */ case SIGN_ABORT: - die("encountered signed commit; use " - "--signed-commits=<mode> to handle it"); + die(_("encountered signed commit; use " + "--signed-commits=<mode> to handle it")); case SIGN_WARN_STRIP: warning(_("stripping a commit signature")); /* fallthru */ @@ -2987,11 +2987,11 @@ static void parse_new_tag(const char *arg) /* from ... */ if (!skip_prefix(command_buf.buf, "from ", &from)) - die("Expected from command, got %s", command_buf.buf); + die(_("Expected 'from' command, got '%s'"), command_buf.buf); s = lookup_branch(from); if (s) { if (is_null_oid(&s->oid)) - die("Can't tag an empty branch."); + die(_("Can't tag an empty branch.")); oidcpy(&oid, &s->oid); type = OBJ_COMMIT; } else if (*from == ':') { @@ -3006,11 +3006,11 @@ static void parse_new_tag(const char *arg) type = odb_read_object_info(the_repository->objects, &oid, NULL); if (type < 0) - die("Not a valid object: %s", from); + die(_("Not a valid object: %s"), from); } else type = oe->type; } else - die("Invalid ref name or SHA1 expression: %s", from); + die(_("Invalid ref name or SHA1 expression: %s"), from); read_next_command(); /* original-oid ... */ @@ -3099,7 +3099,7 @@ static void parse_reset_branch(const char *arg) static void cat_blob_write(const char *buf, unsigned long size) { if (write_in_full(cat_blob_fd, buf, size) < 0) - die_errno("Write to frontend failed"); + die_errno(_("Write to frontend failed")); } static void cat_blob(struct object_entry *oe, struct object_id *oid) @@ -3128,9 +3128,9 @@ static void cat_blob(struct object_entry *oe, struct object_id *oid) return; } if (!buf) - die("Can't read object %s", oid_to_hex(oid)); + die(_("Can't read object %s"), oid_to_hex(oid)); if (type != OBJ_BLOB) - die("Object %s is a %s but a blob was expected.", + die(_("Object %s is a %s but a blob was expected."), oid_to_hex(oid), type_name(type)); strbuf_reset(&line); strbuf_addf(&line, "%s %s %"PRIuMAX"\n", oid_to_hex(oid), @@ -3154,11 +3154,11 @@ static void parse_get_mark(const char *p) /* get-mark SP <object> LF */ if (*p != ':') - die("Not a mark: %s", p); + die(_("Not a mark: %s"), p); oe = find_mark(marks, parse_mark_ref_eol(p)); if (!oe) - die("Unknown mark: %s", command_buf.buf); + die(_("Unknown mark: %s"), command_buf.buf); xsnprintf(output, sizeof(output), "%s\n", oid_to_hex(&oe->idx.oid)); cat_blob_write(output, the_hash_algo->hexsz + 1); @@ -3173,13 +3173,13 @@ static void parse_cat_blob(const char *p) if (*p == ':') { oe = find_mark(marks, parse_mark_ref_eol(p)); if (!oe) - die("Unknown mark: %s", command_buf.buf); + die(_("Unknown mark: %s"), command_buf.buf); oidcpy(&oid, &oe->idx.oid); } else { if (parse_mapped_oid_hex(p, &oid, &p)) - die("Invalid dataref: %s", command_buf.buf); + die(_("Invalid dataref: %s"), command_buf.buf); if (*p) - die("Garbage after SHA1: %s", command_buf.buf); + die(_("Garbage after SHA1: %s"), command_buf.buf); oe = find_object(&oid); } @@ -3197,7 +3197,7 @@ static struct object_entry *dereference(struct object_entry *oe, enum object_type type = odb_read_object_info(the_repository->objects, oid, NULL); if (type < 0) - die("object not found: %s", oid_to_hex(oid)); + die(_("object not found: %s"), oid_to_hex(oid)); /* cache it! */ oe = insert_object(oid); oe->type = type; @@ -3211,7 +3211,7 @@ static struct object_entry *dereference(struct object_entry *oe, case OBJ_TAG: break; default: - die("Not a tree-ish: %s", command_buf.buf); + die(_("Not a tree-ish: %s"), command_buf.buf); } if (oe->pack_id != MAX_PACK_ID) { /* in a pack being written */ @@ -3222,19 +3222,19 @@ static struct object_entry *dereference(struct object_entry *oe, &unused, &size); } if (!buf) - die("Can't load object %s", oid_to_hex(oid)); + die(_("Can't load object %s"), oid_to_hex(oid)); /* Peel one layer. */ switch (oe->type) { case OBJ_TAG: if (size < hexsz + strlen("object ") || get_oid_hex(buf + strlen("object "), oid)) - die("Invalid SHA1 in tag: %s", command_buf.buf); + die(_("Invalid SHA1 in tag: %s"), command_buf.buf); break; case OBJ_COMMIT: if (size < hexsz + strlen("tree ") || get_oid_hex(buf + strlen("tree "), oid)) - die("Invalid SHA1 in commit: %s", command_buf.buf); + die(_("Invalid SHA1 in commit: %s"), command_buf.buf); } free(buf); @@ -3285,14 +3285,14 @@ static struct object_entry *parse_treeish_dataref(const char **p) if (**p == ':') { /* <mark> */ e = find_mark(marks, parse_mark_ref_space(p)); if (!e) - die("Unknown mark: %s", command_buf.buf); + die(_("Unknown mark: %s"), command_buf.buf); oidcpy(&oid, &e->idx.oid); } else { /* <sha1> */ if (parse_mapped_oid_hex(*p, &oid, p)) - die("Invalid dataref: %s", command_buf.buf); + die(_("Invalid dataref: %s"), command_buf.buf); e = find_object(&oid); if (*(*p)++ != ' ') - die("Missing space after tree-ish: %s", command_buf.buf); + die(_("Missing space after tree-ish: %s"), command_buf.buf); } while (!e || e->type != OBJ_TREE) @@ -3336,7 +3336,7 @@ static void parse_ls(const char *p, struct branch *b) /* ls SP (<tree-ish> SP)? <path> */ if (*p == '"') { if (!b) - die("Not in a commit: %s", command_buf.buf); + die(_("Not in a commit: %s"), command_buf.buf); root = &b->branch_tree; } else { struct object_entry *e = parse_treeish_dataref(&p); @@ -3422,7 +3422,7 @@ static void option_import_marks(const char *marks, { if (import_marks_file) { if (from_stream) - die("Only one import-marks command allowed per stream"); + die(_("Only one import-marks command allowed per stream")); /* read previous mark file */ if(!import_marks_file_from_stream) @@ -3446,7 +3446,7 @@ static void option_date_format(const char *fmt) else if (!strcmp(fmt, "now")) whenspec = WHENSPEC_NOW; else - die("unknown --date-format argument %s", fmt); + die(_("unknown --date-format argument %s"), fmt); } static unsigned long ulong_arg(const char *option, const char *arg) @@ -3454,7 +3454,7 @@ static unsigned long ulong_arg(const char *option, const char *arg) char *endptr; unsigned long rv = strtoul(arg, &endptr, 0); if (strchr(arg, '-') || endptr == arg || *endptr) - die("%s: argument must be a non-negative integer", option); + die(_("%s: argument must be a non-negative integer"), option); return rv; } @@ -3462,7 +3462,7 @@ static void option_depth(const char *depth) { max_depth = ulong_arg("--depth", depth); if (max_depth > MAX_DEPTH) - die("--depth cannot exceed %u", MAX_DEPTH); + die(_("--depth cannot exceed %u"), MAX_DEPTH); } static void option_active_branches(const char *branches) @@ -3480,7 +3480,7 @@ static void option_cat_blob_fd(const char *fd) { unsigned long n = ulong_arg("--cat-blob-fd", fd); if (n > (unsigned long) INT_MAX) - die("--cat-blob-fd cannot exceed %d", INT_MAX); + die(_("--cat-blob-fd cannot exceed %d"), INT_MAX); cat_blob_fd = (int) n; } @@ -3508,7 +3508,7 @@ static void option_rewrite_submodules(const char *arg, struct string_list *list) f = prefix_filename(global_prefix, f); fp = fopen(f, "r"); if (!fp) - die_errno("cannot read '%s'", f); + die_errno(_("cannot read '%s'"), f); read_mark_file(&ms, fp, insert_oid_entry); fclose(fp); free(f); @@ -3525,10 +3525,10 @@ static int parse_one_option(const char *option) if (!git_parse_ulong(option, &v)) return 0; if (v < 8192) { - warning("max-pack-size is now in bytes, assuming --max-pack-size=%lum", v); + warning(_("max-pack-size is now in bytes, assuming --max-pack-size=%lum"), v); v *= 1024 * 1024; } else if (v < 1024 * 1024) { - warning("minimum max-pack-size is 1 MiB"); + warning(_("minimum max-pack-size is 1 MiB")); v = 1024 * 1024; } max_packsize = v; @@ -3612,23 +3612,23 @@ static int parse_one_feature(const char *feature, int from_stream) static void parse_feature(const char *feature) { if (seen_data_command) - die("Got feature command '%s' after data command", feature); + die(_("Got feature command '%s' after data command"), feature); if (parse_one_feature(feature, 1)) return; - die("This version of fast-import does not support feature %s.", feature); + die(_("This version of fast-import does not support feature %s."), feature); } static void parse_option(const char *option) { if (seen_data_command) - die("Got option command '%s' after data command", option); + die(_("Got option command '%s' after data command"), option); if (parse_one_option(option)) return; - die("This version of fast-import does not support option: %s", option); + die(_("This version of fast-import does not support option: %s"), option); } static void git_pack_config(void) @@ -3672,7 +3672,7 @@ static void parse_argv(void) break; if (!skip_prefix(a, "--", &a)) - die("unknown option %s", a); + die(_("unknown option %s"), a); if (parse_one_option(a)) continue; @@ -3685,7 +3685,7 @@ static void parse_argv(void) continue; } - die("unknown option --%s", a); + die(_("unknown option --%s"), a); } if (i != global_argc) usage(fast_import_usage); @@ -3774,7 +3774,7 @@ int cmd_fast_import(int argc, else if (starts_with(command_buf.buf, "option ")) /* ignore non-git options*/; else - die("Unsupported command: %s", command_buf.buf); + die(_("Unsupported command: %s"), command_buf.buf); if (checkpoint_requested) checkpoint(); @@ -3785,7 +3785,7 @@ int cmd_fast_import(int argc, parse_argv(); if (require_explicit_termination && feof(stdin)) - die("stream ends early"); + die(_("stream ends early")); end_packfile(); -- 2.51.2.540.g4ad31e1014 ^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH 4/5] fast-import: mark strings for translation 2025-10-28 8:12 ` [PATCH 4/5] fast-import: " Christian Couder @ 2025-10-28 16:46 ` Junio C Hamano 0 siblings, 0 replies; 22+ messages in thread From: Junio C Hamano @ 2025-10-28 16:46 UTC (permalink / raw) To: Christian Couder Cc: git, Patrick Steinhardt, Elijah Newren, Jeff King, brian m . carlson, Johannes Schindelin, Christian Couder Christian Couder <christian.couder@gmail.com> writes: > Some error or warning messages in "builtin/fast-import.c" are marked > for translation, but many are not. > > To be more consistent and provide a better experience to people using a > translated version, let's mark all the remaining error or warning > messages for translation. > > While at it, let's make the following small changes: > > - replace "GIT" or "git" in a few error messages to just "Git", > - replace "Expected from command, got %s" to "Expected 'from' > command, got '%s'", which makes it clearer that "from" is a command > and should not be translated, > - adjust the indentation of some arguments of the error functions. > > Signed-off-by: Christian Couder <chriscool@tuxfamily.org> > --- > builtin/fast-import.c | 270 +++++++++++++++++++++--------------------- > 1 file changed, 135 insertions(+), 135 deletions(-) Same comments as previous. > ... > @@ -3774,7 +3774,7 @@ int cmd_fast_import(int argc, > else if (starts_with(command_buf.buf, "option ")) > /* ignore non-git options*/; > else > - die("Unsupported command: %s", command_buf.buf); > + die(_("Unsupported command: %s"), command_buf.buf); > > if (checkpoint_requested) > checkpoint(); > @@ -3785,7 +3785,7 @@ int cmd_fast_import(int argc, > parse_argv(); > > if (require_explicit_termination && feof(stdin)) > - die("stream ends early"); > + die(_("stream ends early")); > > end_packfile(); ^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 5/5] gpg-interface: mark a string for translation 2025-10-28 8:12 [PATCH 0/5] fast-export/import: cleanups and translation Christian Couder ` (3 preceding siblings ...) 2025-10-28 8:12 ` [PATCH 4/5] fast-import: " Christian Couder @ 2025-10-28 8:12 ` Christian Couder 2025-10-30 12:33 ` [PATCH v2 0/5] fast-export/import: cleanups and translation Christian Couder 5 siblings, 0 replies; 22+ messages in thread From: Christian Couder @ 2025-10-28 8:12 UTC (permalink / raw) To: git Cc: Junio C Hamano, Patrick Steinhardt, Elijah Newren, Jeff King, brian m . carlson, Johannes Schindelin, Christian Couder, Christian Couder Previous commits have marked a number of error or warning messages in "builtin/fast-export.c" and "builtin/fast-import.c" for translation. As "gpg-interface.c" code is used by the fast-export and fast-import code, we should make sure that error or warning messages are also all marked for translation in "gpg-interface.c". To ensure that, let's mark for translation an error message in a die() function. With this, all the error and warning messages emitted by fast-export and fast-import can be properly translated. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> --- gpg-interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gpg-interface.c b/gpg-interface.c index 91d1b58cb4..6b895f83ed 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -876,7 +876,7 @@ static char *get_default_ssh_signing_key(void) n = split_cmdline(key_command, &argv); if (n < 0) - die("malformed build-time gpg.ssh.defaultKeyCommand: %s", + die(_("malformed build-time gpg.ssh.defaultKeyCommand: %s"), split_cmdline_strerror(n)); strvec_pushv(&ssh_default_key.args, argv); -- 2.51.2.540.g4ad31e1014 ^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 0/5] fast-export/import: cleanups and translation 2025-10-28 8:12 [PATCH 0/5] fast-export/import: cleanups and translation Christian Couder ` (4 preceding siblings ...) 2025-10-28 8:12 ` [PATCH 5/5] gpg-interface: mark a string " Christian Couder @ 2025-10-30 12:33 ` Christian Couder 2025-10-30 12:33 ` [PATCH v2 1/5] gpg-interface: simplify ssh fingerprint parsing Christian Couder ` (6 more replies) 5 siblings, 7 replies; 22+ messages in thread From: Christian Couder @ 2025-10-30 12:33 UTC (permalink / raw) To: git Cc: Junio C Hamano, Patrick Steinhardt, Elijah Newren, Jeff King, brian m . carlson, Johannes Schindelin, Christian Couder Introduction ------------ In a previous v2 patch series[1] that I sent last May, there were two preparatory cleanup patches[2][3] that have been dropped in the v3 and next versions. I think these two cleanup patches are worth resending in their own series though. While at cleaning things up, I realized that, when working in this area of the code, I have often been annoyed by the fact that few error and warning messages were marked for translation. So I decided to also address this here. So patches 1/5 and 2/5 are small code cleanups that are resent, while patches 3/5, 4/5 and 5/5 are about marking strings for translation. [1] https://lore.kernel.org/git/20250526103314.1542316-1-christian.couder@gmail.com/ [2] https://lore.kernel.org/git/20250526103314.1542316-2-christian.couder@gmail.com/ [3] https://lore.kernel.org/git/20250526103314.1542316-3-christian.couder@gmail.com/ Changes compared to v1 ---------------------- Thanks to Junio for commenting on the v1! There are only small changes in patches 3/5 and 4/5. Mostly some uppercase letters at the start of error and warning messages have been downcased according to our style. In patch 3/5, an error message that started with "Error: " has been changed to remove that part. In patch 4/5, some tests in "t9300-fast-import.sh" had to be adjusted because they were testing error or warning messages where the first letter was downcased. The commit messages of patches 3/5 and 4/5 have also been adjusted to mention these changes. CI tests: --------- All the tests passed. See: https://github.com/chriscool/git/actions/runs/18938796521 Range diff compared to v1 ------------------------- 1: 525f8a7bbb = 1: fbc4a97b6a gpg-interface: simplify ssh fingerprint parsing 2: 54a4126ad6 = 2: e653da13fb gpg-interface: use left shift to define GPG_VERIFY_* 3: 719785dc07 ! 3: 82348e8e42 fast-export: mark strings for translation @@ Commit message translated version, let's mark all the remaining error or warning messages for translation. - While at it, improve how some arguments to some error functions are - indented. + While at it: + + - improve how some arguments to some error functions are indented, + - remove "Error:" at the start of an error message, + - downcase error and warning messages that start with an uppercase. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> @@ builtin/fast-export.c: static int parse_opt_sign_mode(const struct option *opt, if (parse_sign_mode(arg, val)) - return error("Unknown %s mode: %s", opt->long_name, arg); -+ return error(_("Unknown %s mode: %s"), opt->long_name, arg); ++ return error(_("unknown %s mode: %s"), opt->long_name, arg); return 0; } @@ builtin/fast-export.c: static int parse_opt_tag_of_filtered_mode(const struct op *val = REWRITE; else - return error("Unknown tag-of-filtered mode: %s", arg); -+ return error(_("Unknown tag-of-filtered mode: %s"), arg); ++ return error(_("unknown tag-of-filtered mode: %s"), arg); return 0; } @@ builtin/fast-export.c: static int parse_opt_reencode_mode(const struct option *o *val = REENCODE_ABORT; else - return error("Unknown reencoding mode: %s", arg); -+ return error(_("Unknown reencoding mode: %s"), arg); ++ return error(_("unknown reencoding mode: %s"), arg); } return 0; @@ builtin/fast-export.c: static void export_blob(const struct object_id *oid) if (!object) - die("Could not read blob %s", oid_to_hex(oid)); -+ die(_("Could not read blob %s"), oid_to_hex(oid)); ++ die(_("could not read blob %s"), oid_to_hex(oid)); mark_next_object(object); @@ builtin/fast-export.c: static void show_filemodify(struct diff_queue_struct *q, - q->queue[i]->status, - ospec->path ? ospec->path : "none", - spec->path ? spec->path : "none"); -+ die(_("Unexpected comparison status '%c' for %s, %s"), ++ die(_("unexpected comparison status '%c' for %s, %s"), + q->queue[i]->status, + ospec->path ? ospec->path : _("none"), + spec->path ? spec->path : _("none")); @@ builtin/fast-export.c: static void handle_commit(struct commit *commit, struct r case REENCODE_ABORT: - die("Encountered commit-specific encoding %.*s in commit " - "%s; use --reencode=[yes|no] to handle it", -+ die(_("Encountered commit-specific encoding %.*s in commit " ++ die(_("encountered commit-specific encoding %.*s in commit " + "%s; use --reencode=[yes|no] to handle it"), (int)encoding_len, encoding, oid_to_hex(&commit->object.oid)); @@ builtin/fast-export.c: static void handle_tag(const char *name, struct tag *tag) } if (tagged->type == OBJ_TREE) { - warning("Omitting tag %s,\nsince tags of trees (or tags of tags of trees, etc.) are not supported.", -+ warning(_("Omitting tag %s,\nsince tags of trees (or tags " ++ warning(_("omitting tag %s,\nsince tags of trees (or tags " + "of tags of trees, etc.) are not supported."), oid_to_hex(&tag->object.oid)); return; @@ builtin/fast-export.c: static void handle_tag(const char *name, struct tag *tag) if (message) { message += 2; @@ builtin/fast-export.c: static void handle_tag(const char *name, struct tag *tag) - if (signature) + if (sig_offset < message_size) switch (signed_tag_mode) { case SIGN_ABORT: - die("encountered signed tag %s; use " @@ builtin/fast-export.c: static void handle_tag(const char *name, struct tag *tag) oid_to_hex(&tag->object.oid)); case DROP: /* Ignore this tag altogether */ +@@ builtin/fast-export.c: static void handle_tag(const char *name, struct tag *tag) + return; + case REWRITE: + if (tagged->type == OBJ_TAG && !mark_tags) { +- die(_("Error: Cannot export nested tags unless --mark-tags is specified.")); ++ die(_("cannot export nested tags unless --mark-tags is specified.")); + } else if (tagged->type == OBJ_COMMIT) { + p = rewrite_commit((struct commit *)tagged); + if (!p) { @@ builtin/fast-export.c: static struct commit *get_commit(struct rev_cmdline_entry *e, const char *full_n tag = (struct tag *)tag->tagged; } if (!tag) - die("Tag %s points nowhere?", e->name); -+ die(_("Tag %s points nowhere?"), e->name); ++ die(_("tag %s points nowhere?"), e->name); return (struct commit *)tag; } default: @@ builtin/fast-export.c: static void get_tags_and_duplicates(struct rev_cmdline_in commit = get_commit(e, full_name); if (!commit) { - warning("%s: Unexpected object of type %s, skipping.", -+ warning(_("%s: Unexpected object of type %s, skipping."), ++ warning(_("%s: unexpected object of type %s, skipping."), e->name, type_name(e->item->type)); free(full_name); @@ builtin/fast-export.c: static void get_tags_and_duplicates(struct rev_cmdline_in continue; default: /* OBJ_TAG (nested tags) is already handled */ - warning("Tag points to object of unexpected type %s, skipping.", -+ warning(_("Tag points to object of unexpected type %s, skipping."), ++ warning(_("tag points to object of unexpected type %s, skipping."), type_name(commit->object.type)); free(full_name); continue; @@ builtin/fast-export.c: static void export_marks(char *file) f = fopen_for_writing(file); if (!f) - die_errno("Unable to open marks file %s for writing.", file); -+ die_errno(_("Unable to open marks file %s for writing."), file); ++ die_errno(_("unable to open marks file %s for writing."), file); for (i = 0; i < idnums.size; i++) { if (deco->base && deco->base->type == 1) { @@ builtin/fast-export.c: static void export_marks(char *file) e |= fclose(f); if (e) - error("Unable to write marks file %s.", file); -+ error(_("Unable to write marks file %s."), file); ++ error(_("unable to write marks file %s."), file); } static void import_marks(char *input_file, int check_exists) @@ builtin/fast-export.c: static void import_marks(char *input_file, int check_exis if (object->flags & SHOWN) - error("Object %s already has a mark", oid_to_hex(&oid)); -+ error(_("Object %s already has a mark"), oid_to_hex(&oid)); ++ error(_("object %s already has a mark"), oid_to_hex(&oid)); mark_object(object, mark); 4: bfb336a14f ! 4: 024ffc060e fast-import: mark strings for translation @@ Commit message While at it, let's make the following small changes: - replace "GIT" or "git" in a few error messages to just "Git", - - replace "Expected from command, got %s" to "Expected 'from' + - replace "Expected from command, got %s" to "expected 'from' command, got '%s'", which makes it clearer that "from" is a command and should not be translated, + - downcase error and warning messages that start with an uppercase, + - fix test cases in "t9300-fast-import.sh" that broke because an + error or warning message was downcased, + - split error and warning messages that are too long, - adjust the indentation of some arguments of the error functions. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> @@ builtin/fast-import.c: static struct branch *new_branch(const char *name) if (b) - die("Invalid attempt to create duplicate branch: %s", name); -+ die(_("Invalid attempt to create duplicate branch: %s"), name); ++ die(_("invalid attempt to create duplicate branch: %s"), name); if (check_refname_format(name, REFNAME_ALLOW_ONELEVEL)) - die("Branch name doesn't conform to GIT standards: %s", name); -+ die(_("Branch name doesn't conform to Git standards: %s"), name); ++ die(_("branch name doesn't conform to Git standards: %s"), name); b = mem_pool_calloc(&fi_mem_pool, 1, sizeof(struct branch)); b->name = mem_pool_strdup(&fi_mem_pool, name); @@ builtin/fast-import.c: static int loosen_small_pack(const struct packed_git *p) if (lseek(p->pack_fd, 0, SEEK_SET) < 0) - die_errno("Failed seeking to start of '%s'", p->pack_name); -+ die_errno(_("Failed seeking to start of '%s'"), p->pack_name); ++ die_errno(_("failed seeking to start of '%s'"), p->pack_name); unpack.in = p->pack_fd; unpack.git_cmd = 1; @@ builtin/fast-import.c: static void load_tree(struct tree_entry *root) if (myoe && myoe->pack_id != MAX_PACK_ID) { if (myoe->type != OBJ_TREE) - die("Not a tree: %s", oid_to_hex(oid)); -+ die(_("Not a tree: %s"), oid_to_hex(oid)); ++ die(_("not a tree: %s"), oid_to_hex(oid)); t->delta_depth = myoe->depth; buf = gfi_unpack_entry(myoe, &size); if (!buf) - die("Can't load tree %s", oid_to_hex(oid)); -+ die(_("Can't load tree %s"), oid_to_hex(oid)); ++ die(_("can't load tree %s"), oid_to_hex(oid)); } else { enum object_type type; buf = odb_read_object(the_repository->objects, oid, &type, &size); if (!buf || type != OBJ_TREE) - die("Can't load tree %s", oid_to_hex(oid)); -+ die(_("Can't load tree %s"), oid_to_hex(oid)); ++ die(_("can't load tree %s"), oid_to_hex(oid)); } c = buf; @@ builtin/fast-import.c: static void load_tree(struct tree_entry *root) c = parse_mode(c, &e->versions[1].mode); if (!c) - die("Corrupt mode in %s", oid_to_hex(oid)); -+ die(_("Corrupt mode in %s"), oid_to_hex(oid)); ++ die(_("corrupt mode in %s"), oid_to_hex(oid)); e->versions[0].mode = e->versions[1].mode; e->name = to_atom(c, strlen(c)); c += e->name->str_len + 1; @@ builtin/fast-import.c: static void tree_content_replace( { if (!S_ISDIR(mode)) - die("Root cannot be a non-directory"); -+ die(_("Root cannot be a non-directory")); ++ die(_("root cannot be a non-directory")); oidclr(&root->versions[0].oid, the_repository->hash_algo); oidcpy(&root->versions[1].oid, oid); if (root->tree) @@ builtin/fast-import.c: static int tree_content_set( n = slash1 - p; if (!n) - die("Empty path component found in input"); -+ die(_("Empty path component found in input")); ++ die(_("empty path component found in input")); if (!*slash1 && !S_ISDIR(mode) && subtree) - die("Non-directories cannot have subtrees"); -+ die(_("Non-directories cannot have subtrees")); ++ die(_("non-directories cannot have subtrees")); if (!root->tree) load_tree(root); @@ builtin/fast-import.c: static int tree_content_get( n = slash1 - p; if (!n && !allow_root) - die("Empty path component found in input"); -+ die(_("Empty path component found in input")); ++ die(_("empty path component found in input")); if (!root->tree) load_tree(root); @@ builtin/fast-import.c: static int update_branch(struct branch *b) if (!quiet) - warning("Dropping %s since it would point to " - "itself (i.e. to %s)", -+ warning(_("Dropping %s since it would point to " ++ warning(_("dropping %s since it would point to " + "itself (i.e. to %s)"), b->name, oid_to_hex(&b->oid)); refs_delete_ref(get_main_ref_store(the_repository), @@ builtin/fast-import.c: static int update_branch(struct branch *b) &b->oid, 0); if (!old_cmit || !new_cmit) - return error("Branch %s is missing commits.", b->name); -+ return error(_("Branch %s is missing commits."), b->name); ++ return error(_("branch %s is missing commits."), b->name); ret = repo_in_merge_bases(the_repository, old_cmit, new_cmit); if (ret < 0) @@ builtin/fast-import.c: static int update_branch(struct branch *b) if (!ret) { - warning("Not updating %s" - " (new tip %s does not contain %s)", -+ warning(_("Not updating %s" ++ warning(_("not updating %s" + " (new tip %s does not contain %s)"), b->name, oid_to_hex(&b->oid), oid_to_hex(&old_oid)); @@ builtin/fast-import.c: static void dump_marks(void) if (hold_lock_file_for_update(&mark_lock, export_marks_file, 0) < 0) { - failure |= error_errno("Unable to write marks file %s", -+ failure |= error_errno(_("Unable to write marks file %s"), ++ failure |= error_errno(_("unable to write marks file %s"), export_marks_file); return; } @@ builtin/fast-import.c: static void dump_marks(void) int saved_errno = errno; rollback_lock_file(&mark_lock); - failure |= error("Unable to write marks file %s: %s", -+ failure |= error(_("Unable to write marks file %s: %s"), ++ failure |= error(_("unable to write marks file %s: %s"), export_marks_file, strerror(saved_errno)); return; } @@ builtin/fast-import.c: static void dump_marks(void) for_each_mark(marks, 0, dump_marks_fn, f); if (commit_lock_file(&mark_lock)) { - failure |= error_errno("Unable to write file %s", -+ failure |= error_errno(_("Unable to write file %s"), ++ failure |= error_errno(_("unable to write file %s"), export_marks_file); return; } @@ builtin/fast-import.c: static int parse_data(struct strbuf *sb, uintmax_t limit, if (!skip_prefix(command_buf.buf, "data ", &data)) - die("Expected 'data n' command, found: %s", command_buf.buf); -+ die(_("Expected 'data n' command, found: %s"), command_buf.buf); ++ die(_("expected 'data n' command, found: %s"), command_buf.buf); if (skip_prefix(data, "<<", &data)) { char *term = xstrdup(data); @@ builtin/fast-import.c: static char *parse_ident(const char *buf) ltgt = buf + strcspn(buf, "<>"); if (*ltgt != '<') - die("Missing < in ident string: %s", buf); -+ die(_("Missing < in ident string: %s"), buf); ++ die(_("missing < in ident string: %s"), buf); if (ltgt != buf && ltgt[-1] != ' ') - die("Missing space before < in ident string: %s", buf); -+ die(_("Missing space before < in ident string: %s"), buf); ++ die(_("missing space before < in ident string: %s"), buf); ltgt = ltgt + 1 + strcspn(ltgt + 1, "<>"); if (*ltgt != '>') - die("Missing > in ident string: %s", buf); -+ die(_("Missing > in ident string: %s"), buf); ++ die(_("missing > in ident string: %s"), buf); ltgt++; if (*ltgt != ' ') - die("Missing space after > in ident string: %s", buf); -+ die(_("Missing space after > in ident string: %s"), buf); ++ die(_("missing space after > in ident string: %s"), buf); ltgt++; name_len = ltgt - buf; strbuf_add(&ident, buf, name_len); @@ builtin/fast-import.c: static char *parse_ident(const char *buf) case WHENSPEC_RAW: if (validate_raw_date(ltgt, &ident, 1) < 0) - die("Invalid raw date \"%s\" in ident: %s", ltgt, buf); -+ die(_("Invalid raw date \"%s\" in ident: %s"), ltgt, buf); ++ die(_("invalid raw date \"%s\" in ident: %s"), ltgt, buf); break; case WHENSPEC_RAW_PERMISSIVE: if (validate_raw_date(ltgt, &ident, 0) < 0) - die("Invalid raw date \"%s\" in ident: %s", ltgt, buf); -+ die(_("Invalid raw date \"%s\" in ident: %s"), ltgt, buf); ++ die(_("invalid raw date \"%s\" in ident: %s"), ltgt, buf); break; case WHENSPEC_RFC2822: if (parse_date(ltgt, &ident) < 0) - die("Invalid rfc2822 date \"%s\" in ident: %s", ltgt, buf); -+ die(_("Invalid rfc2822 date \"%s\" in ident: %s"), ltgt, buf); ++ die(_("invalid rfc2822 date \"%s\" in ident: %s"), ltgt, buf); break; case WHENSPEC_NOW: if (strcmp("now", ltgt)) - die("Date in ident must be 'now': %s", buf); -+ die(_("Date in ident must be 'now': %s"), buf); ++ die(_("date in ident must be 'now': %s"), buf); datestamp(&ident); break; } @@ builtin/fast-import.c: static void construct_path_with_fanout(const char *hex_sh unsigned int i = 0, j = 0; if (fanout >= the_hash_algo->rawsz) - die("Too large fanout (%u)", fanout); -+ die(_("Too large fanout (%u)"), fanout); ++ die(_("too large fanout (%u)"), fanout); while (fanout) { path[i++] = hex_sha1[j++]; path[i++] = hex_sha1[j++]; @@ builtin/fast-import.c: static uintmax_t do_change_note_fanout( /* Rename fullpath to realpath */ if (!tree_content_remove(orig_root, fullpath, &leaf, 0)) - die("Failed to remove path %s", fullpath); -+ die(_("Failed to remove path %s"), fullpath); ++ die(_("failed to remove path %s"), fullpath); tree_content_set(orig_root, realpath, &leaf.versions[1].oid, leaf.versions[1].mode, @@ builtin/fast-import.c: static uintmax_t parse_mark_ref(const char *p, char **end mark = strtoumax(p, endptr, 10); if (*endptr == p) - die("No value after ':' in mark: %s", command_buf.buf); -+ die(_("No value after ':' in mark: %s"), command_buf.buf); ++ die(_("no value after ':' in mark: %s"), command_buf.buf); return mark; } @@ builtin/fast-import.c: static uintmax_t parse_mark_ref_eol(const char *p) mark = parse_mark_ref(p, &end); if (*end != '\0') - die("Garbage after mark: %s", command_buf.buf); -+ die(_("Garbage after mark: %s"), command_buf.buf); ++ die(_("garbage after mark: %s"), command_buf.buf); return mark; } @@ builtin/fast-import.c: static uintmax_t parse_mark_ref_space(const char **p) mark = parse_mark_ref(*p, &end); if (*end++ != ' ') - die("Missing space after mark: %s", command_buf.buf); -+ die(_("Missing space after mark: %s"), command_buf.buf); ++ die(_("missing space after mark: %s"), command_buf.buf); *p = end; return mark; } @@ builtin/fast-import.c: static void parse_path(struct strbuf *sb, const char *p, if (*p == '"') { if (unquote_c_style(sb, p, endp)) - die("Invalid %s: %s", field, command_buf.buf); -+ die(_("Invalid %s: %s"), field, command_buf.buf); ++ die(_("invalid %s: %s"), field, command_buf.buf); if (strlen(sb->buf) != sb->len) - die("NUL in %s: %s", field, command_buf.buf); + die(_("NUL in %s: %s"), field, command_buf.buf); @@ builtin/fast-import.c: static void parse_path_eol(struct strbuf *sb, const char parse_path(sb, p, &end, 1, field); if (*end) - die("Garbage after %s: %s", field, command_buf.buf); -+ die(_("Garbage after %s: %s"), field, command_buf.buf); ++ die(_("garbage after %s: %s"), field, command_buf.buf); } /* @@ builtin/fast-import.c: static void parse_path_space(struct strbuf *sb, const cha parse_path(sb, p, endp, 0, field); if (**endp != ' ') - die("Missing space after %s: %s", field, command_buf.buf); -+ die(_("Missing space after %s: %s"), field, command_buf.buf); ++ die(_("missing space after %s: %s"), field, command_buf.buf); (*endp)++; } @@ builtin/fast-import.c: static void file_change_m(const char *p, struct branch *b p = parse_mode(p, &mode); if (!p) - die("Corrupt mode: %s", command_buf.buf); -+ die(_("Corrupt mode: %s"), command_buf.buf); ++ die(_("corrupt mode: %s"), command_buf.buf); switch (mode) { case 0644: case 0755: @@ builtin/fast-import.c: static void file_change_m(const char *p, struct branch *b break; default: - die("Corrupt mode: %s", command_buf.buf); -+ die(_("Corrupt mode: %s"), command_buf.buf); ++ die(_("corrupt mode: %s"), command_buf.buf); } if (*p == ':') { @@ builtin/fast-import.c: static void file_change_m(const char *p, struct branch *b } else { if (parse_mapped_oid_hex(p, &oid, &p)) - die("Invalid dataref: %s", command_buf.buf); -+ die(_("Invalid dataref: %s"), command_buf.buf); ++ die(_("invalid dataref: %s"), command_buf.buf); oe = find_object(&oid); if (*p++ != ' ') - die("Missing space after SHA1: %s", command_buf.buf); -+ die(_("Missing space after SHA1: %s"), command_buf.buf); ++ die(_("missing space after SHA1: %s"), command_buf.buf); } strbuf_reset(&path); @@ builtin/fast-import.c: static void file_change_m(const char *p, struct branch *b else if (oe) { if (oe->type != OBJ_COMMIT) - die("Not a commit (actually a %s): %s", -+ die(_("Not a commit (actually a %s): %s"), ++ die(_("not a commit (actually a %s): %s"), type_name(oe->type), command_buf.buf); } /* @@ builtin/fast-import.c: static void file_change_m(const char *p, struct branch *b } else if (inline_data) { if (S_ISDIR(mode)) - die("Directories cannot be specified 'inline': %s", -+ die(_("Directories cannot be specified 'inline': %s"), ++ die(_("directories cannot be specified 'inline': %s"), command_buf.buf); while (read_next_command() != EOF) { const char *v; @@ builtin/fast-import.c: static void file_change_m(const char *p, struct branch *b - S_ISDIR(mode) ? "Tree" : "Blob", - command_buf.buf); + die(_("%s not found: %s"), -+ S_ISDIR(mode) ? _("Tree") : _("Blob"), ++ S_ISDIR(mode) ? _("tree") : _("blob"), + command_buf.buf); if (type != expected) - die("Not a %s (actually a %s): %s", -+ die(_("Not a %s (actually a %s): %s"), ++ die(_("not a %s (actually a %s): %s"), type_name(expected), type_name(type), command_buf.buf); } @@ builtin/fast-import.c: static void file_change_cr(const char *p, struct branch * tree_content_get(&b->branch_tree, source.buf, &leaf, 1); if (!leaf.versions[1].mode) - die("Path %s not in branch", source.buf); -+ die(_("Path %s not in branch"), source.buf); ++ die(_("path %s not in branch"), source.buf); if (!*dest.buf) { /* C "path/to/subdir" "" */ tree_content_replace(&b->branch_tree, &leaf.versions[1].oid, @@ builtin/fast-import.c: static void note_change_n(const char *p, struct branch *b } else { if (parse_mapped_oid_hex(p, &oid, &p)) - die("Invalid dataref: %s", command_buf.buf); -+ die(_("Invalid dataref: %s"), command_buf.buf); ++ die(_("invalid dataref: %s"), command_buf.buf); oe = find_object(&oid); if (*p++ != ' ') - die("Missing space after SHA1: %s", command_buf.buf); -+ die(_("Missing space after SHA1: %s"), command_buf.buf); ++ die(_("missing space after SHA1: %s"), command_buf.buf); } /* <commit-ish> */ @@ builtin/fast-import.c: static void note_change_n(const char *p, struct branch *b if (s) { if (is_null_oid(&s->oid)) - die("Can't add a note on empty branch."); -+ die(_("Can't add a note on empty branch.")); ++ die(_("can't add a note on empty branch.")); oidcpy(&commit_oid, &s->oid); } else if (*p == ':') { uintmax_t commit_mark = parse_mark_ref_eol(p); struct object_entry *commit_oe = find_mark(marks, commit_mark); if (commit_oe->type != OBJ_COMMIT) - die("Mark :%" PRIuMAX " not a commit", commit_mark); -+ die(_("Mark :%" PRIuMAX " not a commit"), commit_mark); ++ die(_("mark :%" PRIuMAX " not a commit"), commit_mark); oidcpy(&commit_oid, &commit_oe->idx.oid); } else if (!repo_get_oid(the_repository, p, &commit_oid)) { unsigned long size; @@ builtin/fast-import.c: static void note_change_n(const char *p, struct branch *b &commit_oid); if (!buf || size < the_hash_algo->hexsz + 6) - die("Not a valid commit: %s", p); -+ die(_("Not a valid commit: %s"), p); ++ die(_("not a valid commit: %s"), p); free(buf); } else - die("Invalid ref name or SHA1 expression: %s", p); -+ die(_("Invalid ref name or SHA1 expression: %s"), p); ++ die(_("invalid ref name or SHA1 expression: %s"), p); if (inline_data) { read_next_command(); @@ builtin/fast-import.c: static void note_change_n(const char *p, struct branch *b } else if (oe) { if (oe->type != OBJ_BLOB) - die("Not a blob (actually a %s): %s", -+ die(_("Not a blob (actually a %s): %s"), ++ die(_("not a blob (actually a %s): %s"), type_name(oe->type), command_buf.buf); } else if (!is_null_oid(&oid)) { enum object_type type = odb_read_object_info(the_repository->objects, &oid, NULL); if (type < 0) - die("Blob not found: %s", command_buf.buf); -+ die(_("Blob not found: %s"), command_buf.buf); ++ die(_("blob not found: %s"), command_buf.buf); if (type != OBJ_BLOB) - die("Not a blob (actually a %s): %s", -+ die(_("Not a blob (actually a %s): %s"), ++ die(_("not a blob (actually a %s): %s"), type_name(type), command_buf.buf); } @@ builtin/fast-import.c: static void file_change_deleteall(struct branch *b) { if (!buf || size < the_hash_algo->hexsz + 6) - die("Not a valid commit: %s", oid_to_hex(&b->oid)); -+ die(_("Not a valid commit: %s"), oid_to_hex(&b->oid)); ++ die(_("not a valid commit: %s"), oid_to_hex(&b->oid)); if (memcmp("tree ", buf, 5) || get_oid_hex(buf + 5, &b->branch_tree.versions[1].oid)) - die("The commit %s is corrupt", oid_to_hex(&b->oid)); -+ die(_("The commit %s is corrupt"), oid_to_hex(&b->oid)); ++ die(_("the commit %s is corrupt"), oid_to_hex(&b->oid)); oidcpy(&b->branch_tree.versions[0].oid, &b->branch_tree.versions[1].oid); } @@ builtin/fast-import.c: static int parse_objectish(struct branch *b, const char * s = lookup_branch(objectish); if (b == s) - die("Can't create a branch from itself: %s", b->name); -+ die(_("Can't create a branch from itself: %s"), b->name); ++ die(_("can't create a branch from itself: %s"), b->name); else if (s) { struct object_id *t = &s->branch_tree.versions[1].oid; oidcpy(&b->oid, &s->oid); @@ builtin/fast-import.c: static int parse_objectish(struct branch *b, const char * struct object_entry *oe = find_mark(marks, idnum); if (oe->type != OBJ_COMMIT) - die("Mark :%" PRIuMAX " not a commit", idnum); -+ die(_("Mark :%" PRIuMAX " not a commit"), idnum); ++ die(_("mark :%" PRIuMAX " not a commit"), idnum); if (!oideq(&b->oid, &oe->idx.oid)) { oidcpy(&b->oid, &oe->idx.oid); if (oe->pack_id != MAX_PACK_ID) { @@ builtin/fast-import.c: static int parse_objectish(struct branch *b, const char * } else - die("Invalid ref name or SHA1 expression: %s", objectish); -+ die(_("Invalid ref name or SHA1 expression: %s"), objectish); ++ die(_("invalid ref name or SHA1 expression: %s"), objectish); if (b->branch_tree.tree && !oideq(&oid, &b->branch_tree.versions[1].oid)) { release_tree_content_recursive(b->branch_tree.tree); @@ builtin/fast-import.c: static struct hash_list *parse_merge(unsigned int *count) struct object_entry *oe = find_mark(marks, idnum); if (oe->type != OBJ_COMMIT) - die("Mark :%" PRIuMAX " not a commit", idnum); -+ die(_("Mark :%" PRIuMAX " not a commit"), idnum); ++ die(_("mark :%" PRIuMAX " not a commit"), idnum); oidcpy(&n->oid, &oe->idx.oid); } else if (!repo_get_oid(the_repository, from, &n->oid)) { unsigned long size; @@ builtin/fast-import.c: static struct hash_list *parse_merge(unsigned int *count) &size, &n->oid); if (!buf || size < the_hash_algo->hexsz + 6) - die("Not a valid commit: %s", from); -+ die(_("Not a valid commit: %s"), from); ++ die(_("not a valid commit: %s"), from); free(buf); } else - die("Invalid ref name or SHA1 expression: %s", from); -+ die(_("Invalid ref name or SHA1 expression: %s"), from); ++ die(_("invalid ref name or SHA1 expression: %s"), from); n->next = NULL; *tail = n; @@ builtin/fast-import.c: static void parse_one_signature(struct signature_data *si if (!space) - die("Expected gpgsig format: 'gpgsig <hash-algo> <signature-format>', " - "got 'gpgsig %s'", args); -+ die(_("Expected gpgsig format: 'gpgsig <hash-algo> <signature-format>', " ++ die(_("expected gpgsig format: 'gpgsig <hash-algo> <signature-format>', " + "got 'gpgsig %s'"), args); *space = '\0'; @@ builtin/fast-import.c: static void parse_one_signature(struct signature_data *si if (strcmp(sig->hash_algo, "sha1") && strcmp(sig->hash_algo, "sha256")) - die("Unknown git hash algorithm in gpgsig: '%s'", sig->hash_algo); -+ die(_("Unknown git hash algorithm in gpgsig: '%s'"), sig->hash_algo); ++ die(_("unknown git hash algorithm in gpgsig: '%s'"), sig->hash_algo); /* Validate signature format */ if (!valid_signature_format(sig->sig_format)) - die("Invalid signature format in gpgsig: '%s'", sig->sig_format); -+ die(_("Invalid signature format in gpgsig: '%s'"), sig->sig_format); ++ die(_("invalid signature format in gpgsig: '%s'"), sig->sig_format); if (!strcmp(sig->sig_format, "unknown")) - warning("'unknown' signature format in gpgsig"); + warning(_("'unknown' signature format in gpgsig")); @@ builtin/fast-import.c: static void parse_new_commit(const char *arg) } if (!committer) - die("Expected committer but didn't get one"); -+ die(_("Expected committer but didn't get one")); ++ die(_("expected committer but didn't get one")); while (skip_prefix(command_buf.buf, "gpgsig ", &v)) { switch (signed_commit_mode) { @@ builtin/fast-import.c: static void parse_new_tag(const char *arg) /* from ... */ if (!skip_prefix(command_buf.buf, "from ", &from)) - die("Expected from command, got %s", command_buf.buf); -+ die(_("Expected 'from' command, got '%s'"), command_buf.buf); ++ die(_("expected 'from' command, got '%s'"), command_buf.buf); s = lookup_branch(from); if (s) { if (is_null_oid(&s->oid)) - die("Can't tag an empty branch."); -+ die(_("Can't tag an empty branch.")); ++ die(_("can't tag an empty branch.")); oidcpy(&oid, &s->oid); type = OBJ_COMMIT; } else if (*from == ':') { @@ builtin/fast-import.c: static void parse_new_tag(const char *arg) &oid, NULL); if (type < 0) - die("Not a valid object: %s", from); -+ die(_("Not a valid object: %s"), from); ++ die(_("not a valid object: %s"), from); } else type = oe->type; } else - die("Invalid ref name or SHA1 expression: %s", from); -+ die(_("Invalid ref name or SHA1 expression: %s"), from); ++ die(_("invalid ref name or SHA1 expression: %s"), from); read_next_command(); /* original-oid ... */ @@ builtin/fast-import.c: static void parse_reset_branch(const char *arg) { if (write_in_full(cat_blob_fd, buf, size) < 0) - die_errno("Write to frontend failed"); -+ die_errno(_("Write to frontend failed")); ++ die_errno(_("write to frontend failed")); } static void cat_blob(struct object_entry *oe, struct object_id *oid) @@ builtin/fast-import.c: static void cat_blob(struct object_entry *oe, struct obje } if (!buf) - die("Can't read object %s", oid_to_hex(oid)); -+ die(_("Can't read object %s"), oid_to_hex(oid)); ++ die(_("can't read object %s"), oid_to_hex(oid)); if (type != OBJ_BLOB) - die("Object %s is a %s but a blob was expected.", -+ die(_("Object %s is a %s but a blob was expected."), ++ die(_("object %s is a %s but a blob was expected."), oid_to_hex(oid), type_name(type)); strbuf_reset(&line); strbuf_addf(&line, "%s %s %"PRIuMAX"\n", oid_to_hex(oid), @@ builtin/fast-import.c: static void parse_get_mark(const char *p) /* get-mark SP <object> LF */ if (*p != ':') - die("Not a mark: %s", p); -+ die(_("Not a mark: %s"), p); ++ die(_("not a mark: %s"), p); oe = find_mark(marks, parse_mark_ref_eol(p)); if (!oe) - die("Unknown mark: %s", command_buf.buf); -+ die(_("Unknown mark: %s"), command_buf.buf); ++ die(_("unknown mark: %s"), command_buf.buf); xsnprintf(output, sizeof(output), "%s\n", oid_to_hex(&oe->idx.oid)); cat_blob_write(output, the_hash_algo->hexsz + 1); @@ builtin/fast-import.c: static void parse_cat_blob(const char *p) oe = find_mark(marks, parse_mark_ref_eol(p)); if (!oe) - die("Unknown mark: %s", command_buf.buf); -+ die(_("Unknown mark: %s"), command_buf.buf); ++ die(_("unknown mark: %s"), command_buf.buf); oidcpy(&oid, &oe->idx.oid); } else { if (parse_mapped_oid_hex(p, &oid, &p)) - die("Invalid dataref: %s", command_buf.buf); -+ die(_("Invalid dataref: %s"), command_buf.buf); ++ die(_("invalid dataref: %s"), command_buf.buf); if (*p) - die("Garbage after SHA1: %s", command_buf.buf); -+ die(_("Garbage after SHA1: %s"), command_buf.buf); ++ die(_("garbage after SHA1: %s"), command_buf.buf); oe = find_object(&oid); } @@ builtin/fast-import.c: static struct object_entry *dereference(struct object_ent break; default: - die("Not a tree-ish: %s", command_buf.buf); -+ die(_("Not a tree-ish: %s"), command_buf.buf); ++ die(_("not a tree-ish: %s"), command_buf.buf); } if (oe->pack_id != MAX_PACK_ID) { /* in a pack being written */ @@ builtin/fast-import.c: static struct object_entry *dereference(struct object_ent } if (!buf) - die("Can't load object %s", oid_to_hex(oid)); -+ die(_("Can't load object %s"), oid_to_hex(oid)); ++ die(_("can't load object %s"), oid_to_hex(oid)); /* Peel one layer. */ switch (oe->type) { @@ builtin/fast-import.c: static struct object_entry *dereference(struct object_ent if (size < hexsz + strlen("object ") || get_oid_hex(buf + strlen("object "), oid)) - die("Invalid SHA1 in tag: %s", command_buf.buf); -+ die(_("Invalid SHA1 in tag: %s"), command_buf.buf); ++ die(_("invalid SHA1 in tag: %s"), command_buf.buf); break; case OBJ_COMMIT: if (size < hexsz + strlen("tree ") || get_oid_hex(buf + strlen("tree "), oid)) - die("Invalid SHA1 in commit: %s", command_buf.buf); -+ die(_("Invalid SHA1 in commit: %s"), command_buf.buf); ++ die(_("invalid SHA1 in commit: %s"), command_buf.buf); } free(buf); +@@ builtin/fast-import.c: static void build_mark_map(struct string_list *from, struct string_list *to) + for_each_string_list_item(fromp, from) { + top = string_list_lookup(to, fromp->string); + if (!fromp->util) { +- die(_("Missing from marks for submodule '%s'"), fromp->string); ++ die(_("missing from marks for submodule '%s'"), fromp->string); + } else if (!top || !top->util) { +- die(_("Missing to marks for submodule '%s'"), fromp->string); ++ die(_("missing to marks for submodule '%s'"), fromp->string); + } + build_mark_map_one(fromp->util, top->util); + } @@ builtin/fast-import.c: static struct object_entry *parse_treeish_dataref(const char **p) if (**p == ':') { /* <mark> */ e = find_mark(marks, parse_mark_ref_space(p)); if (!e) - die("Unknown mark: %s", command_buf.buf); -+ die(_("Unknown mark: %s"), command_buf.buf); ++ die(_("unknown mark: %s"), command_buf.buf); oidcpy(&oid, &e->idx.oid); } else { /* <sha1> */ if (parse_mapped_oid_hex(*p, &oid, p)) - die("Invalid dataref: %s", command_buf.buf); -+ die(_("Invalid dataref: %s"), command_buf.buf); ++ die(_("invalid dataref: %s"), command_buf.buf); e = find_object(&oid); if (*(*p)++ != ' ') - die("Missing space after tree-ish: %s", command_buf.buf); -+ die(_("Missing space after tree-ish: %s"), command_buf.buf); ++ die(_("missing space after tree-ish: %s"), command_buf.buf); } while (!e || e->type != OBJ_TREE) @@ builtin/fast-import.c: static void parse_ls(const char *p, struct branch *b) if (*p == '"') { if (!b) - die("Not in a commit: %s", command_buf.buf); -+ die(_("Not in a commit: %s"), command_buf.buf); ++ die(_("not in a commit: %s"), command_buf.buf); root = &b->branch_tree; } else { struct object_entry *e = parse_treeish_dataref(&p); +@@ builtin/fast-import.c: static void parse_alias(void) + /* mark ... */ + parse_mark(); + if (!next_mark) +- die(_("Expected 'mark' command, got %s"), command_buf.buf); ++ die(_("expected 'mark' command, got %s"), command_buf.buf); + + /* to ... */ + memset(&b, 0, sizeof(b)); + if (!parse_objectish_with_prefix(&b, "to ")) +- die(_("Expected 'to' command, got %s"), command_buf.buf); ++ die(_("expected 'to' command, got %s"), command_buf.buf); + e = find_object(&b.oid); + assert(e); + insert_mark(&marks, next_mark, e); @@ builtin/fast-import.c: static void option_import_marks(const char *marks, { if (import_marks_file) { if (from_stream) - die("Only one import-marks command allowed per stream"); -+ die(_("Only one import-marks command allowed per stream")); ++ die(_("only one import-marks command allowed per stream")); /* read previous mark file */ if(!import_marks_file_from_stream) @@ builtin/fast-import.c: static void option_cat_blob_fd(const char *fd) cat_blob_fd = (int) n; } +@@ builtin/fast-import.c: static void option_rewrite_submodules(const char *arg, struct string_list *list) + char *s = xstrdup(arg); + char *f = strchr(s, ':'); + if (!f) +- die(_("Expected format name:filename for submodule rewrite option")); ++ die(_("expected format name:filename for submodule rewrite option")); + *f = '\0'; + f++; + CALLOC_ARRAY(ms, 1); @@ builtin/fast-import.c: static void option_rewrite_submodules(const char *arg, struct string_list *list) f = prefix_filename(global_prefix, f); fp = fopen(f, "r"); @@ builtin/fast-import.c: static int parse_one_feature(const char *feature, int fro { if (seen_data_command) - die("Got feature command '%s' after data command", feature); -+ die(_("Got feature command '%s' after data command"), feature); ++ die(_("got feature command '%s' after data command"), feature); if (parse_one_feature(feature, 1)) return; - die("This version of fast-import does not support feature %s.", feature); -+ die(_("This version of fast-import does not support feature %s."), feature); ++ die(_("this version of fast-import does not support feature %s."), feature); } static void parse_option(const char *option) { if (seen_data_command) - die("Got option command '%s' after data command", option); -+ die(_("Got option command '%s' after data command"), option); ++ die(_("got option command '%s' after data command"), option); if (parse_one_option(option)) return; - die("This version of fast-import does not support option: %s", option); -+ die(_("This version of fast-import does not support option: %s"), option); ++ die(_("this version of fast-import does not support option: %s"), option); } static void git_pack_config(void) @@ builtin/fast-import.c: int cmd_fast_import(int argc, /* ignore non-git options*/; else - die("Unsupported command: %s", command_buf.buf); -+ die(_("Unsupported command: %s"), command_buf.buf); ++ die(_("unsupported command: %s"), command_buf.buf); if (checkpoint_requested) checkpoint(); @@ builtin/fast-import.c: int cmd_fast_import(int argc, end_packfile(); + + ## t/t9300-fast-import.sh ## +@@ t/t9300-fast-import.sh: test_expect_success 'R: blob appears only once' ' + # The error message when a space is missing not at the + # end of the line is: + # +-# Missing space after .. ++# missing space after .. + # + # or when extra characters come after the mark at the end + # of the line: + # +-# Garbage after .. ++# garbage after .. + # + # or when the dataref is neither "inline " or a known SHA1, + # +-# Invalid dataref .. ++# invalid dataref .. + # + test_expect_success 'S: initialize for S tests' ' + test_tick && +@@ t/t9300-fast-import.sh: test_path_fail () { + + test_path_base_fail () { + local change="$1" prefix="$2" field="$3" suffix="$4" +- test_path_fail "$change" 'unclosed " in '"$field" "$prefix" '"hello.c' "$suffix" "Invalid $field" +- test_path_fail "$change" "invalid escape in quoted $field" "$prefix" '"hello\xff"' "$suffix" "Invalid $field" ++ test_path_fail "$change" 'unclosed " in '"$field" "$prefix" '"hello.c' "$suffix" "invalid $field" ++ test_path_fail "$change" "invalid escape in quoted $field" "$prefix" '"hello\xff"' "$suffix" "invalid $field" + test_path_fail "$change" "escaped NUL in quoted $field" "$prefix" '"hello\000"' "$suffix" "NUL in $field" + } + test_path_eol_quoted_fail () { + local change="$1" prefix="$2" field="$3" + test_path_base_fail "$change" "$prefix" "$field" '' +- test_path_fail "$change" "garbage after quoted $field" "$prefix" '"hello.c"' 'x' "Garbage after $field" +- test_path_fail "$change" "space after quoted $field" "$prefix" '"hello.c"' ' ' "Garbage after $field" ++ test_path_fail "$change" "garbage after quoted $field" "$prefix" '"hello.c"' 'x' "garbage after $field" ++ test_path_fail "$change" "space after quoted $field" "$prefix" '"hello.c"' ' ' "garbage after $field" + } + test_path_eol_fail () { + local change="$1" prefix="$2" field="$3" +@@ t/t9300-fast-import.sh: test_path_eol_fail () { + test_path_space_fail () { + local change="$1" prefix="$2" field="$3" + test_path_base_fail "$change" "$prefix" "$field" ' world.c' +- test_path_fail "$change" "missing space after quoted $field" "$prefix" '"hello.c"' 'x world.c' "Missing space after $field" +- test_path_fail "$change" "missing space after unquoted $field" "$prefix" 'hello.c' '' "Missing space after $field" ++ test_path_fail "$change" "missing space after quoted $field" "$prefix" '"hello.c"' 'x world.c' "missing space after $field" ++ test_path_fail "$change" "missing space after unquoted $field" "$prefix" 'hello.c' '' "missing space after $field" + } + + test_path_eol_fail filemodify 'M 100644 :1 ' path +@@ t/t9300-fast-import.sh: test_expect_success 'X: replace ref that becomes useless is removed' ' + sed -e s/othername/somename/ tmp >tmp2 && + git fast-import --force <tmp2 2>msgs && + +- grep "Dropping.*since it would point to itself" msgs && ++ grep "dropping.*since it would point to itself" msgs && + git show-ref >refs && + ! grep refs/replace refs + ) 5: 4ad31e1014 = 5: 158c13c078 gpg-interface: mark a string for translation Christian Couder (5): gpg-interface: simplify ssh fingerprint parsing gpg-interface: use left shift to define GPG_VERIFY_* fast-export: mark strings for translation fast-import: mark strings for translation gpg-interface: mark a string for translation builtin/fast-export.c | 79 ++++++------ builtin/fast-import.c | 280 ++++++++++++++++++++--------------------- gpg-interface.c | 4 +- gpg-interface.h | 6 +- t/t9300-fast-import.sh | 20 +-- 5 files changed, 195 insertions(+), 194 deletions(-) -- 2.51.2.617.g2aaa867cd1 ^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 1/5] gpg-interface: simplify ssh fingerprint parsing 2025-10-30 12:33 ` [PATCH v2 0/5] fast-export/import: cleanups and translation Christian Couder @ 2025-10-30 12:33 ` Christian Couder 2025-10-30 12:33 ` [PATCH v2 2/5] gpg-interface: use left shift to define GPG_VERIFY_* Christian Couder ` (5 subsequent siblings) 6 siblings, 0 replies; 22+ messages in thread From: Christian Couder @ 2025-10-30 12:33 UTC (permalink / raw) To: git Cc: Junio C Hamano, Patrick Steinhardt, Elijah Newren, Jeff King, brian m . carlson, Johannes Schindelin, Christian Couder, Christian Couder In "gpg-interface.c", the 'parse_ssh_output()' function takes a 'struct signature_check *sigc' argument and populates many members of this 'sigc' using information parsed from 'sigc->output' which contains the ouput of an `ssh-keygen -Y ...` command that was used to verify an SSH signature. When it populates 'sigc->fingerprint' though, it uses `xstrdup(strstr(line, "key ") + 4)` while `strstr(line, "key ")` has already been computed a few lines above and is already available in the `key` variable. Let's simplify this. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> --- gpg-interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gpg-interface.c b/gpg-interface.c index 2f4f0e32cb..91d1b58cb4 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -443,7 +443,7 @@ static void parse_ssh_output(struct signature_check *sigc) key = strstr(line, "key "); if (key) { - sigc->fingerprint = xstrdup(strstr(line, "key ") + 4); + sigc->fingerprint = xstrdup(key + 4); sigc->key = xstrdup(sigc->fingerprint); } else { /* -- 2.51.2.617.g2aaa867cd1 ^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 2/5] gpg-interface: use left shift to define GPG_VERIFY_* 2025-10-30 12:33 ` [PATCH v2 0/5] fast-export/import: cleanups and translation Christian Couder 2025-10-30 12:33 ` [PATCH v2 1/5] gpg-interface: simplify ssh fingerprint parsing Christian Couder @ 2025-10-30 12:33 ` Christian Couder 2025-10-30 12:33 ` [PATCH v2 3/5] fast-export: mark strings for translation Christian Couder ` (4 subsequent siblings) 6 siblings, 0 replies; 22+ messages in thread From: Christian Couder @ 2025-10-30 12:33 UTC (permalink / raw) To: git Cc: Junio C Hamano, Patrick Steinhardt, Elijah Newren, Jeff King, brian m . carlson, Johannes Schindelin, Christian Couder, Christian Couder In "gpg-interface.h", the definitions of the GPG_VERIFY_* boolean flags are currently using 1, 2 and 4 while we often prefer the bitwise left shift operator, `<<`, for that purpose to make it clearer that they are boolean. Let's use the left shift operator here too. Let's also fix an indent issue with "4" while at it. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> --- gpg-interface.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gpg-interface.h b/gpg-interface.h index 50487aa148..ead1ed6967 100644 --- a/gpg-interface.h +++ b/gpg-interface.h @@ -3,9 +3,9 @@ struct strbuf; -#define GPG_VERIFY_VERBOSE 1 -#define GPG_VERIFY_RAW 2 -#define GPG_VERIFY_OMIT_STATUS 4 +#define GPG_VERIFY_VERBOSE (1<<0) +#define GPG_VERIFY_RAW (1<<1) +#define GPG_VERIFY_OMIT_STATUS (1<<2) enum signature_trust_level { TRUST_UNDEFINED, -- 2.51.2.617.g2aaa867cd1 ^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 3/5] fast-export: mark strings for translation 2025-10-30 12:33 ` [PATCH v2 0/5] fast-export/import: cleanups and translation Christian Couder 2025-10-30 12:33 ` [PATCH v2 1/5] gpg-interface: simplify ssh fingerprint parsing Christian Couder 2025-10-30 12:33 ` [PATCH v2 2/5] gpg-interface: use left shift to define GPG_VERIFY_* Christian Couder @ 2025-10-30 12:33 ` Christian Couder 2025-10-30 12:33 ` [PATCH v2 4/5] fast-import: " Christian Couder ` (3 subsequent siblings) 6 siblings, 0 replies; 22+ messages in thread From: Christian Couder @ 2025-10-30 12:33 UTC (permalink / raw) To: git Cc: Junio C Hamano, Patrick Steinhardt, Elijah Newren, Jeff King, brian m . carlson, Johannes Schindelin, Christian Couder, Christian Couder Some error or warning messages in "builtin/fast-export.c" are marked for translation, but many are not. To be more consistent and provide a better experience to people using a translated version, let's mark all the remaining error or warning messages for translation. While at it: - improve how some arguments to some error functions are indented, - remove "Error:" at the start of an error message, - downcase error and warning messages that start with an uppercase. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> --- builtin/fast-export.c | 79 ++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/builtin/fast-export.c b/builtin/fast-export.c index 7adbc55f0d..0421360ab7 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -65,7 +65,7 @@ static int parse_opt_sign_mode(const struct option *opt, return 0; if (parse_sign_mode(arg, val)) - return error("Unknown %s mode: %s", opt->long_name, arg); + return error(_("unknown %s mode: %s"), opt->long_name, arg); return 0; } @@ -82,7 +82,7 @@ static int parse_opt_tag_of_filtered_mode(const struct option *opt, else if (!strcmp(arg, "rewrite")) *val = REWRITE; else - return error("Unknown tag-of-filtered mode: %s", arg); + return error(_("unknown tag-of-filtered mode: %s"), arg); return 0; } @@ -107,7 +107,7 @@ static int parse_opt_reencode_mode(const struct option *opt, if (!strcasecmp(arg, "abort")) *val = REENCODE_ABORT; else - return error("Unknown reencoding mode: %s", arg); + return error(_("unknown reencoding mode: %s"), arg); } return 0; @@ -318,16 +318,16 @@ static void export_blob(const struct object_id *oid) } else { buf = odb_read_object(the_repository->objects, oid, &type, &size); if (!buf) - die("could not read blob %s", oid_to_hex(oid)); + die(_("could not read blob %s"), oid_to_hex(oid)); if (check_object_signature(the_repository, oid, buf, size, type) < 0) - die("oid mismatch in blob %s", oid_to_hex(oid)); + die(_("oid mismatch in blob %s"), oid_to_hex(oid)); object = parse_object_buffer(the_repository, oid, type, size, buf, &eaten); } if (!object) - die("Could not read blob %s", oid_to_hex(oid)); + die(_("could not read blob %s"), oid_to_hex(oid)); mark_next_object(object); @@ -336,7 +336,7 @@ static void export_blob(const struct object_id *oid) printf("original-oid %s\n", oid_to_hex(oid)); printf("data %"PRIuMAX"\n", (uintmax_t)size); if (size && fwrite(buf, size, 1, stdout) != 1) - die_errno("could not write blob '%s'", oid_to_hex(oid)); + die_errno(_("could not write blob '%s'"), oid_to_hex(oid)); printf("\n"); show_progress(); @@ -499,10 +499,10 @@ static void show_filemodify(struct diff_queue_struct *q, break; default: - die("Unexpected comparison status '%c' for %s, %s", - q->queue[i]->status, - ospec->path ? ospec->path : "none", - spec->path ? spec->path : "none"); + die(_("unexpected comparison status '%c' for %s, %s"), + q->queue[i]->status, + ospec->path ? ospec->path : _("none"), + spec->path ? spec->path : _("none")); } } } @@ -699,14 +699,14 @@ static void handle_commit(struct commit *commit, struct rev_info *rev, author = strstr(commit_buffer_cursor, "\nauthor "); if (!author) - die("could not find author in commit %s", + die(_("could not find author in commit %s"), oid_to_hex(&commit->object.oid)); author++; commit_buffer_cursor = author_end = strchrnul(author, '\n'); committer = strstr(commit_buffer_cursor, "\ncommitter "); if (!committer) - die("could not find committer in commit %s", + die(_("could not find committer in commit %s"), oid_to_hex(&commit->object.oid)); committer++; commit_buffer_cursor = committer_end = strchrnul(committer, '\n'); @@ -781,8 +781,8 @@ static void handle_commit(struct commit *commit, struct rev_info *rev, case REENCODE_NO: break; case REENCODE_ABORT: - die("Encountered commit-specific encoding %.*s in commit " - "%s; use --reencode=[yes|no] to handle it", + die(_("encountered commit-specific encoding %.*s in commit " + "%s; use --reencode=[yes|no] to handle it"), (int)encoding_len, encoding, oid_to_hex(&commit->object.oid)); } @@ -798,11 +798,11 @@ static void handle_commit(struct commit *commit, struct rev_info *rev, if (signatures.nr) { switch (signed_commit_mode) { case SIGN_ABORT: - die("encountered signed commit %s; use " - "--signed-commits=<mode> to handle it", + die(_("encountered signed commit %s; use " + "--signed-commits=<mode> to handle it"), oid_to_hex(&commit->object.oid)); case SIGN_WARN_VERBATIM: - warning("exporting %"PRIuMAX" signature(s) for commit %s", + warning(_("exporting %"PRIuMAX" signature(s) for commit %s"), (uintmax_t)signatures.nr, oid_to_hex(&commit->object.oid)); /* fallthru */ case SIGN_VERBATIM: @@ -812,7 +812,7 @@ static void handle_commit(struct commit *commit, struct rev_info *rev, } break; case SIGN_WARN_STRIP: - warning("stripping signature(s) from commit %s", + warning(_("stripping signature(s) from commit %s"), oid_to_hex(&commit->object.oid)); /* fallthru */ case SIGN_STRIP: @@ -890,7 +890,8 @@ static void handle_tag(const char *name, struct tag *tag) tagged = ((struct tag *)tagged)->tagged; } if (tagged->type == OBJ_TREE) { - warning("Omitting tag %s,\nsince tags of trees (or tags of tags of trees, etc.) are not supported.", + warning(_("omitting tag %s,\nsince tags of trees (or tags " + "of tags of trees, etc.) are not supported."), oid_to_hex(&tag->object.oid)); return; } @@ -898,7 +899,7 @@ static void handle_tag(const char *name, struct tag *tag) buf = odb_read_object(the_repository->objects, &tag->object.oid, &type, &size); if (!buf) - die("could not read tag %s", oid_to_hex(&tag->object.oid)); + die(_("could not read tag %s"), oid_to_hex(&tag->object.oid)); message = memmem(buf, size, "\n\n", 2); if (message) { message += 2; @@ -935,17 +936,17 @@ static void handle_tag(const char *name, struct tag *tag) if (sig_offset < message_size) switch (signed_tag_mode) { case SIGN_ABORT: - die("encountered signed tag %s; use " - "--signed-tags=<mode> to handle it", + die(_("encountered signed tag %s; use " + "--signed-tags=<mode> to handle it"), oid_to_hex(&tag->object.oid)); case SIGN_WARN_VERBATIM: - warning("exporting signed tag %s", + warning(_("exporting signed tag %s"), oid_to_hex(&tag->object.oid)); /* fallthru */ case SIGN_VERBATIM: break; case SIGN_WARN_STRIP: - warning("stripping signature from tag %s", + warning(_("stripping signature from tag %s"), oid_to_hex(&tag->object.oid)); /* fallthru */ case SIGN_STRIP: @@ -960,8 +961,8 @@ static void handle_tag(const char *name, struct tag *tag) if (!tagged_mark) { switch (tag_of_filtered_mode) { case TAG_FILTERING_ABORT: - die("tag %s tags unexported object; use " - "--tag-of-filtered-object=<mode> to handle it", + die(_("tag %s tags unexported object; use " + "--tag-of-filtered-object=<mode> to handle it"), oid_to_hex(&tag->object.oid)); case DROP: /* Ignore this tag altogether */ @@ -969,7 +970,7 @@ static void handle_tag(const char *name, struct tag *tag) return; case REWRITE: if (tagged->type == OBJ_TAG && !mark_tags) { - die(_("Error: Cannot export nested tags unless --mark-tags is specified.")); + die(_("cannot export nested tags unless --mark-tags is specified.")); } else if (tagged->type == OBJ_COMMIT) { p = rewrite_commit((struct commit *)tagged); if (!p) { @@ -1025,7 +1026,7 @@ static struct commit *get_commit(struct rev_cmdline_entry *e, const char *full_n tag = (struct tag *)tag->tagged; } if (!tag) - die("Tag %s points nowhere?", e->name); + die(_("tag %s points nowhere?"), e->name); return (struct commit *)tag; } default: @@ -1063,7 +1064,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info) commit = get_commit(e, full_name); if (!commit) { - warning("%s: Unexpected object of type %s, skipping.", + warning(_("%s: unexpected object of type %s, skipping."), e->name, type_name(e->item->type)); free(full_name); @@ -1078,7 +1079,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info) free(full_name); continue; default: /* OBJ_TAG (nested tags) is already handled */ - warning("Tag points to object of unexpected type %s, skipping.", + warning(_("tag points to object of unexpected type %s, skipping."), type_name(commit->object.type)); free(full_name); continue; @@ -1174,7 +1175,7 @@ static void export_marks(char *file) f = fopen_for_writing(file); if (!f) - die_errno("Unable to open marks file %s for writing.", file); + die_errno(_("unable to open marks file %s for writing."), file); for (i = 0; i < idnums.size; i++) { if (deco->base && deco->base->type == 1) { @@ -1191,7 +1192,7 @@ static void export_marks(char *file) e |= ferror(f); e |= fclose(f); if (e) - error("Unable to write marks file %s.", file); + error(_("unable to write marks file %s."), file); } static void import_marks(char *input_file, int check_exists) @@ -1214,20 +1215,20 @@ static void import_marks(char *input_file, int check_exists) line_end = strchr(line, '\n'); if (line[0] != ':' || !line_end) - die("corrupt mark line: %s", line); + die(_("corrupt mark line: %s"), line); *line_end = '\0'; mark = strtoumax(line + 1, &mark_end, 10); if (!mark || mark_end == line + 1 || *mark_end != ' ' || get_oid_hex(mark_end + 1, &oid)) - die("corrupt mark line: %s", line); + die(_("corrupt mark line: %s"), line); if (last_idnum < mark) last_idnum = mark; type = odb_read_object_info(the_repository->objects, &oid, NULL); if (type < 0) - die("object not found: %s", oid_to_hex(&oid)); + die(_("object not found: %s"), oid_to_hex(&oid)); if (type != OBJ_COMMIT) /* only commits */ @@ -1235,12 +1236,12 @@ static void import_marks(char *input_file, int check_exists) commit = lookup_commit(the_repository, &oid); if (!commit) - die("not a commit? can't happen: %s", oid_to_hex(&oid)); + die(_("not a commit? can't happen: %s"), oid_to_hex(&oid)); object = &commit->object; if (object->flags & SHOWN) - error("Object %s already has a mark", oid_to_hex(&oid)); + error(_("object %s already has a mark"), oid_to_hex(&oid)); mark_object(object, mark); @@ -1394,7 +1395,7 @@ int cmd_fast_export(int argc, get_tags_and_duplicates(&revs.cmdline); if (prepare_revision_walk(&revs)) - die("revision walk setup failed"); + die(_("revision walk setup failed")); revs.reverse = 1; revs.diffopt.format_callback = show_filemodify; -- 2.51.2.617.g2aaa867cd1 ^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 4/5] fast-import: mark strings for translation 2025-10-30 12:33 ` [PATCH v2 0/5] fast-export/import: cleanups and translation Christian Couder ` (2 preceding siblings ...) 2025-10-30 12:33 ` [PATCH v2 3/5] fast-export: mark strings for translation Christian Couder @ 2025-10-30 12:33 ` Christian Couder 2025-10-31 19:35 ` Elijah Newren 2025-10-30 12:33 ` [PATCH v2 5/5] gpg-interface: mark a string " Christian Couder ` (2 subsequent siblings) 6 siblings, 1 reply; 22+ messages in thread From: Christian Couder @ 2025-10-30 12:33 UTC (permalink / raw) To: git Cc: Junio C Hamano, Patrick Steinhardt, Elijah Newren, Jeff King, brian m . carlson, Johannes Schindelin, Christian Couder, Christian Couder Some error or warning messages in "builtin/fast-import.c" are marked for translation, but many are not. To be more consistent and provide a better experience to people using a translated version, let's mark all the remaining error or warning messages for translation. While at it, let's make the following small changes: - replace "GIT" or "git" in a few error messages to just "Git", - replace "Expected from command, got %s" to "expected 'from' command, got '%s'", which makes it clearer that "from" is a command and should not be translated, - downcase error and warning messages that start with an uppercase, - fix test cases in "t9300-fast-import.sh" that broke because an error or warning message was downcased, - split error and warning messages that are too long, - adjust the indentation of some arguments of the error functions. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> --- builtin/fast-import.c | 280 ++++++++++++++++++++--------------------- t/t9300-fast-import.sh | 20 +-- 2 files changed, 150 insertions(+), 150 deletions(-) diff --git a/builtin/fast-import.c b/builtin/fast-import.c index 8714edfc65..22d5deae9a 100644 --- a/builtin/fast-import.c +++ b/builtin/fast-import.c @@ -339,12 +339,12 @@ static void write_crash_report(const char *err) struct recent_command *rc; if (!rpt) { - error_errno("can't write crash report %s", loc); + error_errno(_("can't write crash report %s"), loc); free(loc); return; } - fprintf(stderr, "fast-import: dumping crash report to %s\n", loc); + fprintf(stderr, _("fast-import: dumping crash report to %s\n"), loc); fprintf(rpt, "fast-import crash report:\n"); fprintf(rpt, " fast-import process: %"PRIuMAX"\n", (uintmax_t) getpid()); @@ -588,7 +588,7 @@ static void *find_mark(struct mark_set *s, uintmax_t idnum) oe = s->data.marked[idnum]; } if (!oe) - die("mark :%" PRIuMAX " not declared", orig_idnum); + die(_("mark :%" PRIuMAX " not declared"), orig_idnum); return oe; } @@ -628,9 +628,9 @@ static struct branch *new_branch(const char *name) struct branch *b = lookup_branch(name); if (b) - die("Invalid attempt to create duplicate branch: %s", name); + die(_("invalid attempt to create duplicate branch: %s"), name); if (check_refname_format(name, REFNAME_ALLOW_ONELEVEL)) - die("Branch name doesn't conform to GIT standards: %s", name); + die(_("branch name doesn't conform to Git standards: %s"), name); b = mem_pool_calloc(&fi_mem_pool, 1, sizeof(struct branch)); b->name = mem_pool_strdup(&fi_mem_pool, name); @@ -801,7 +801,7 @@ static const char *create_index(void) *c++ = &e->idx; last = idx + object_count; if (c != last) - die("internal consistency error creating the index"); + die(_("internal consistency error creating the index")); tmpfile = write_idx_file(the_repository, NULL, idx, object_count, &pack_idx_opts, pack_data->hash); @@ -819,18 +819,18 @@ static char *keep_pack(const char *curr_index_name) keep_fd = safe_create_file_with_leading_directories(pack_data->repo, name.buf); if (keep_fd < 0) - die_errno("cannot create keep file"); + die_errno(_("cannot create keep file")); write_or_die(keep_fd, keep_msg, strlen(keep_msg)); if (close(keep_fd)) - die_errno("failed to write keep file"); + die_errno(_("failed to write keep file")); odb_pack_name(pack_data->repo, &name, pack_data->hash, "pack"); if (finalize_object_file(pack_data->repo, pack_data->pack_name, name.buf)) - die("cannot store pack file"); + die(_("cannot store pack file")); odb_pack_name(pack_data->repo, &name, pack_data->hash, "idx"); if (finalize_object_file(pack_data->repo, curr_index_name, name.buf)) - die("cannot store index file"); + die(_("cannot store index file")); free((void *)curr_index_name); return strbuf_detach(&name, NULL); } @@ -853,7 +853,7 @@ static int loosen_small_pack(const struct packed_git *p) struct child_process unpack = CHILD_PROCESS_INIT; if (lseek(p->pack_fd, 0, SEEK_SET) < 0) - die_errno("Failed seeking to start of '%s'", p->pack_name); + die_errno(_("failed seeking to start of '%s'"), p->pack_name); unpack.in = p->pack_fd; unpack.git_cmd = 1; @@ -903,7 +903,7 @@ static void end_packfile(void) new_p = packfile_store_load_pack(pack_data->repo->objects->packfiles, idx_name, 1); if (!new_p) - die("core git rejected index %s", idx_name); + die(_("core Git rejected index %s"), idx_name); all_packs[pack_id] = new_p; free(idx_name); @@ -1090,7 +1090,7 @@ static int store_object( static void truncate_pack(struct hashfile_checkpoint *checkpoint) { if (hashfile_truncate(pack_file, checkpoint)) - die_errno("cannot truncate pack to skip duplicate"); + die_errno(_("cannot truncate pack to skip duplicate")); pack_size = checkpoint->offset; } @@ -1138,7 +1138,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark) size_t cnt = in_sz < len ? in_sz : (size_t)len; size_t n = fread(in_buf, 1, cnt, stdin); if (!n && feof(stdin)) - die("EOF in data (%" PRIuMAX " bytes remaining)", len); + die(_("EOF in data (%" PRIuMAX " bytes remaining)"), len); git_hash_update(&c, in_buf, n); s.next_in = in_buf; @@ -1162,7 +1162,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark) case Z_STREAM_END: continue; default: - die("unexpected deflate failure: %d", status); + die(_("unexpected deflate failure: %d"), status); } } git_deflate_end(&s); @@ -1264,16 +1264,16 @@ static void load_tree(struct tree_entry *root) myoe = find_object(oid); if (myoe && myoe->pack_id != MAX_PACK_ID) { if (myoe->type != OBJ_TREE) - die("Not a tree: %s", oid_to_hex(oid)); + die(_("not a tree: %s"), oid_to_hex(oid)); t->delta_depth = myoe->depth; buf = gfi_unpack_entry(myoe, &size); if (!buf) - die("Can't load tree %s", oid_to_hex(oid)); + die(_("can't load tree %s"), oid_to_hex(oid)); } else { enum object_type type; buf = odb_read_object(the_repository->objects, oid, &type, &size); if (!buf || type != OBJ_TREE) - die("Can't load tree %s", oid_to_hex(oid)); + die(_("can't load tree %s"), oid_to_hex(oid)); } c = buf; @@ -1287,7 +1287,7 @@ static void load_tree(struct tree_entry *root) e->tree = NULL; c = parse_mode(c, &e->versions[1].mode); if (!c) - die("Corrupt mode in %s", oid_to_hex(oid)); + die(_("corrupt mode in %s"), oid_to_hex(oid)); e->versions[0].mode = e->versions[1].mode; e->name = to_atom(c, strlen(c)); c += e->name->str_len + 1; @@ -1399,7 +1399,7 @@ static void tree_content_replace( struct tree_content *newtree) { if (!S_ISDIR(mode)) - die("Root cannot be a non-directory"); + die(_("root cannot be a non-directory")); oidclr(&root->versions[0].oid, the_repository->hash_algo); oidcpy(&root->versions[1].oid, oid); if (root->tree) @@ -1422,9 +1422,9 @@ static int tree_content_set( slash1 = strchrnul(p, '/'); n = slash1 - p; if (!n) - die("Empty path component found in input"); + die(_("empty path component found in input")); if (!*slash1 && !S_ISDIR(mode) && subtree) - die("Non-directories cannot have subtrees"); + die(_("non-directories cannot have subtrees")); if (!root->tree) load_tree(root); @@ -1576,7 +1576,7 @@ static int tree_content_get( slash1 = strchrnul(p, '/'); n = slash1 - p; if (!n && !allow_root) - die("Empty path component found in input"); + die(_("empty path component found in input")); if (!root->tree) load_tree(root); @@ -1622,8 +1622,8 @@ static int update_branch(struct branch *b) !strcmp(b->name + strlen(replace_prefix), oid_to_hex(&b->oid))) { if (!quiet) - warning("Dropping %s since it would point to " - "itself (i.e. to %s)", + warning(_("dropping %s since it would point to " + "itself (i.e. to %s)"), b->name, oid_to_hex(&b->oid)); refs_delete_ref(get_main_ref_store(the_repository), NULL, b->name, NULL, 0); @@ -1646,14 +1646,14 @@ static int update_branch(struct branch *b) new_cmit = lookup_commit_reference_gently(the_repository, &b->oid, 0); if (!old_cmit || !new_cmit) - return error("Branch %s is missing commits.", b->name); + return error(_("branch %s is missing commits."), b->name); ret = repo_in_merge_bases(the_repository, old_cmit, new_cmit); if (ret < 0) exit(128); if (!ret) { - warning("Not updating %s" - " (new tip %s does not contain %s)", + warning(_("not updating %s" + " (new tip %s does not contain %s)"), b->name, oid_to_hex(&b->oid), oid_to_hex(&old_oid)); return -1; @@ -1729,13 +1729,13 @@ static void dump_marks(void) return; if (safe_create_leading_directories_const(the_repository, export_marks_file)) { - failure |= error_errno("unable to create leading directories of %s", + failure |= error_errno(_("unable to create leading directories of %s"), export_marks_file); return; } if (hold_lock_file_for_update(&mark_lock, export_marks_file, 0) < 0) { - failure |= error_errno("Unable to write marks file %s", + failure |= error_errno(_("unable to write marks file %s"), export_marks_file); return; } @@ -1744,14 +1744,14 @@ static void dump_marks(void) if (!f) { int saved_errno = errno; rollback_lock_file(&mark_lock); - failure |= error("Unable to write marks file %s: %s", + failure |= error(_("unable to write marks file %s: %s"), export_marks_file, strerror(saved_errno)); return; } for_each_mark(marks, 0, dump_marks_fn, f); if (commit_lock_file(&mark_lock)) { - failure |= error_errno("Unable to write file %s", + failure |= error_errno(_("unable to write file %s"), export_marks_file); return; } @@ -1765,7 +1765,7 @@ static void insert_object_entry(struct mark_set **s, struct object_id *oid, uint enum object_type type = odb_read_object_info(the_repository->objects, oid, NULL); if (type < 0) - die("object not found: %s", oid_to_hex(oid)); + die(_("object not found: %s"), oid_to_hex(oid)); e = insert_object(oid); e->type = type; e->pack_id = MAX_PACK_ID; @@ -1792,13 +1792,13 @@ static void read_mark_file(struct mark_set **s, FILE *f, mark_set_inserter_t ins end = strchr(line, '\n'); if (line[0] != ':' || !end) - die("corrupt mark line: %s", line); + die(_("corrupt mark line: %s"), line); *end = 0; mark = strtoumax(line + 1, &end, 10); if (!mark || end == line + 1 || *end != ' ' || get_oid_hex_any(end + 1, &oid) == GIT_HASH_UNKNOWN) - die("corrupt mark line: %s", line); + die(_("corrupt mark line: %s"), line); inserter(s, &oid, mark); } } @@ -1811,7 +1811,7 @@ static void read_marks(void) else if (import_marks_file_ignore_missing && errno == ENOENT) goto done; /* Marks file does not exist */ else - die_errno("cannot read '%s'", import_marks_file); + die_errno(_("cannot read '%s'"), import_marks_file); read_mark_file(&marks, f, insert_object_entry); fclose(f); done: @@ -1897,7 +1897,7 @@ static int parse_data(struct strbuf *sb, uintmax_t limit, uintmax_t *len_res) strbuf_reset(sb); if (!skip_prefix(command_buf.buf, "data ", &data)) - die("Expected 'data n' command, found: %s", command_buf.buf); + die(_("expected 'data n' command, found: %s"), command_buf.buf); if (skip_prefix(data, "<<", &data)) { char *term = xstrdup(data); @@ -1905,7 +1905,7 @@ static int parse_data(struct strbuf *sb, uintmax_t limit, uintmax_t *len_res) for (;;) { if (strbuf_getline_lf(&command_buf, stdin) == EOF) - die("EOF in data (terminator '%s' not found)", term); + die(_("EOF in data (terminator '%s' not found)"), term); if (term_len == command_buf.len && !strcmp(term, command_buf.buf)) break; @@ -1923,12 +1923,12 @@ static int parse_data(struct strbuf *sb, uintmax_t limit, uintmax_t *len_res) return 0; } if (length < len) - die("data is too large to use in this context"); + die(_("data is too large to use in this context")); while (n < length) { size_t s = strbuf_fread(sb, length - n, stdin); if (!s && feof(stdin)) - die("EOF in data (%lu bytes remaining)", + die(_("EOF in data (%lu bytes remaining)"), (unsigned long)(length - n)); n += s; } @@ -1985,15 +1985,15 @@ static char *parse_ident(const char *buf) ltgt = buf + strcspn(buf, "<>"); if (*ltgt != '<') - die("Missing < in ident string: %s", buf); + die(_("missing < in ident string: %s"), buf); if (ltgt != buf && ltgt[-1] != ' ') - die("Missing space before < in ident string: %s", buf); + die(_("missing space before < in ident string: %s"), buf); ltgt = ltgt + 1 + strcspn(ltgt + 1, "<>"); if (*ltgt != '>') - die("Missing > in ident string: %s", buf); + die(_("missing > in ident string: %s"), buf); ltgt++; if (*ltgt != ' ') - die("Missing space after > in ident string: %s", buf); + die(_("missing space after > in ident string: %s"), buf); ltgt++; name_len = ltgt - buf; strbuf_add(&ident, buf, name_len); @@ -2001,19 +2001,19 @@ static char *parse_ident(const char *buf) switch (whenspec) { case WHENSPEC_RAW: if (validate_raw_date(ltgt, &ident, 1) < 0) - die("Invalid raw date \"%s\" in ident: %s", ltgt, buf); + die(_("invalid raw date \"%s\" in ident: %s"), ltgt, buf); break; case WHENSPEC_RAW_PERMISSIVE: if (validate_raw_date(ltgt, &ident, 0) < 0) - die("Invalid raw date \"%s\" in ident: %s", ltgt, buf); + die(_("invalid raw date \"%s\" in ident: %s"), ltgt, buf); break; case WHENSPEC_RFC2822: if (parse_date(ltgt, &ident) < 0) - die("Invalid rfc2822 date \"%s\" in ident: %s", ltgt, buf); + die(_("invalid rfc2822 date \"%s\" in ident: %s"), ltgt, buf); break; case WHENSPEC_NOW: if (strcmp("now", ltgt)) - die("Date in ident must be 'now': %s", buf); + die(_("date in ident must be 'now': %s"), buf); datestamp(&ident); break; } @@ -2107,7 +2107,7 @@ static void construct_path_with_fanout(const char *hex_sha1, { unsigned int i = 0, j = 0; if (fanout >= the_hash_algo->rawsz) - die("Too large fanout (%u)", fanout); + die(_("too large fanout (%u)"), fanout); while (fanout) { path[i++] = hex_sha1[j++]; path[i++] = hex_sha1[j++]; @@ -2181,7 +2181,7 @@ static uintmax_t do_change_note_fanout( /* Rename fullpath to realpath */ if (!tree_content_remove(orig_root, fullpath, &leaf, 0)) - die("Failed to remove path %s", fullpath); + die(_("failed to remove path %s"), fullpath); tree_content_set(orig_root, realpath, &leaf.versions[1].oid, leaf.versions[1].mode, @@ -2254,7 +2254,7 @@ static uintmax_t parse_mark_ref(const char *p, char **endptr) p++; mark = strtoumax(p, endptr, 10); if (*endptr == p) - die("No value after ':' in mark: %s", command_buf.buf); + die(_("no value after ':' in mark: %s"), command_buf.buf); return mark; } @@ -2269,7 +2269,7 @@ static uintmax_t parse_mark_ref_eol(const char *p) mark = parse_mark_ref(p, &end); if (*end != '\0') - die("Garbage after mark: %s", command_buf.buf); + die(_("garbage after mark: %s"), command_buf.buf); return mark; } @@ -2284,7 +2284,7 @@ static uintmax_t parse_mark_ref_space(const char **p) mark = parse_mark_ref(*p, &end); if (*end++ != ' ') - die("Missing space after mark: %s", command_buf.buf); + die(_("missing space after mark: %s"), command_buf.buf); *p = end; return mark; } @@ -2300,9 +2300,9 @@ static void parse_path(struct strbuf *sb, const char *p, const char **endp, { if (*p == '"') { if (unquote_c_style(sb, p, endp)) - die("Invalid %s: %s", field, command_buf.buf); + die(_("invalid %s: %s"), field, command_buf.buf); if (strlen(sb->buf) != sb->len) - die("NUL in %s: %s", field, command_buf.buf); + die(_("NUL in %s: %s"), field, command_buf.buf); } else { /* * Unless we are parsing the last field of a line, @@ -2325,7 +2325,7 @@ static void parse_path_eol(struct strbuf *sb, const char *p, const char *field) parse_path(sb, p, &end, 1, field); if (*end) - die("Garbage after %s: %s", field, command_buf.buf); + die(_("garbage after %s: %s"), field, command_buf.buf); } /* @@ -2338,7 +2338,7 @@ static void parse_path_space(struct strbuf *sb, const char *p, { parse_path(sb, p, endp, 0, field); if (**endp != ' ') - die("Missing space after %s: %s", field, command_buf.buf); + die(_("missing space after %s: %s"), field, command_buf.buf); (*endp)++; } @@ -2351,7 +2351,7 @@ static void file_change_m(const char *p, struct branch *b) p = parse_mode(p, &mode); if (!p) - die("Corrupt mode: %s", command_buf.buf); + die(_("corrupt mode: %s"), command_buf.buf); switch (mode) { case 0644: case 0755: @@ -2364,7 +2364,7 @@ static void file_change_m(const char *p, struct branch *b) /* ok */ break; default: - die("Corrupt mode: %s", command_buf.buf); + die(_("corrupt mode: %s"), command_buf.buf); } if (*p == ':') { @@ -2375,10 +2375,10 @@ static void file_change_m(const char *p, struct branch *b) oe = NULL; /* not used with inline_data, but makes gcc happy */ } else { if (parse_mapped_oid_hex(p, &oid, &p)) - die("Invalid dataref: %s", command_buf.buf); + die(_("invalid dataref: %s"), command_buf.buf); oe = find_object(&oid); if (*p++ != ' ') - die("Missing space after SHA1: %s", command_buf.buf); + die(_("missing space after SHA1: %s"), command_buf.buf); } strbuf_reset(&path); @@ -2394,11 +2394,11 @@ static void file_change_m(const char *p, struct branch *b) if (S_ISGITLINK(mode)) { if (inline_data) - die("Git links cannot be specified 'inline': %s", + die(_("Git links cannot be specified 'inline': %s"), command_buf.buf); else if (oe) { if (oe->type != OBJ_COMMIT) - die("Not a commit (actually a %s): %s", + die(_("not a commit (actually a %s): %s"), type_name(oe->type), command_buf.buf); } /* @@ -2407,7 +2407,7 @@ static void file_change_m(const char *p, struct branch *b) */ } else if (inline_data) { if (S_ISDIR(mode)) - die("Directories cannot be specified 'inline': %s", + die(_("directories cannot be specified 'inline': %s"), command_buf.buf); while (read_next_command() != EOF) { const char *v; @@ -2425,11 +2425,11 @@ static void file_change_m(const char *p, struct branch *b) odb_read_object_info(the_repository->objects, &oid, NULL); if (type < 0) - die("%s not found: %s", - S_ISDIR(mode) ? "Tree" : "Blob", - command_buf.buf); + die(_("%s not found: %s"), + S_ISDIR(mode) ? _("tree") : _("blob"), + command_buf.buf); if (type != expected) - die("Not a %s (actually a %s): %s", + die(_("not a %s (actually a %s): %s"), type_name(expected), type_name(type), command_buf.buf); } @@ -2440,7 +2440,7 @@ static void file_change_m(const char *p, struct branch *b) } if (!verify_path(path.buf, mode)) - die("invalid path '%s'", path.buf); + die(_("invalid path '%s'"), path.buf); tree_content_set(&b->branch_tree, path.buf, &oid, mode, NULL); } @@ -2470,7 +2470,7 @@ static void file_change_cr(const char *p, struct branch *b, int rename) else tree_content_get(&b->branch_tree, source.buf, &leaf, 1); if (!leaf.versions[1].mode) - die("Path %s not in branch", source.buf); + die(_("path %s not in branch"), source.buf); if (!*dest.buf) { /* C "path/to/subdir" "" */ tree_content_replace(&b->branch_tree, &leaf.versions[1].oid, @@ -2479,7 +2479,7 @@ static void file_change_cr(const char *p, struct branch *b, int rename) return; } if (!verify_path(dest.buf, leaf.versions[1].mode)) - die("invalid path '%s'", dest.buf); + die(_("invalid path '%s'"), dest.buf); tree_content_set(&b->branch_tree, dest.buf, &leaf.versions[1].oid, leaf.versions[1].mode, @@ -2521,23 +2521,23 @@ static void note_change_n(const char *p, struct branch *b, unsigned char *old_fa oe = NULL; /* not used with inline_data, but makes gcc happy */ } else { if (parse_mapped_oid_hex(p, &oid, &p)) - die("Invalid dataref: %s", command_buf.buf); + die(_("invalid dataref: %s"), command_buf.buf); oe = find_object(&oid); if (*p++ != ' ') - die("Missing space after SHA1: %s", command_buf.buf); + die(_("missing space after SHA1: %s"), command_buf.buf); } /* <commit-ish> */ s = lookup_branch(p); if (s) { if (is_null_oid(&s->oid)) - die("Can't add a note on empty branch."); + die(_("can't add a note on empty branch.")); oidcpy(&commit_oid, &s->oid); } else if (*p == ':') { uintmax_t commit_mark = parse_mark_ref_eol(p); struct object_entry *commit_oe = find_mark(marks, commit_mark); if (commit_oe->type != OBJ_COMMIT) - die("Mark :%" PRIuMAX " not a commit", commit_mark); + die(_("mark :%" PRIuMAX " not a commit"), commit_mark); oidcpy(&commit_oid, &commit_oe->idx.oid); } else if (!repo_get_oid(the_repository, p, &commit_oid)) { unsigned long size; @@ -2545,25 +2545,25 @@ static void note_change_n(const char *p, struct branch *b, unsigned char *old_fa &commit_oid, OBJ_COMMIT, &size, &commit_oid); if (!buf || size < the_hash_algo->hexsz + 6) - die("Not a valid commit: %s", p); + die(_("not a valid commit: %s"), p); free(buf); } else - die("Invalid ref name or SHA1 expression: %s", p); + die(_("invalid ref name or SHA1 expression: %s"), p); if (inline_data) { read_next_command(); parse_and_store_blob(&last_blob, &oid, 0); } else if (oe) { if (oe->type != OBJ_BLOB) - die("Not a blob (actually a %s): %s", + die(_("not a blob (actually a %s): %s"), type_name(oe->type), command_buf.buf); } else if (!is_null_oid(&oid)) { enum object_type type = odb_read_object_info(the_repository->objects, &oid, NULL); if (type < 0) - die("Blob not found: %s", command_buf.buf); + die(_("blob not found: %s"), command_buf.buf); if (type != OBJ_BLOB) - die("Not a blob (actually a %s): %s", + die(_("not a blob (actually a %s): %s"), type_name(type), command_buf.buf); } @@ -2592,10 +2592,10 @@ static void file_change_deleteall(struct branch *b) static void parse_from_commit(struct branch *b, char *buf, unsigned long size) { if (!buf || size < the_hash_algo->hexsz + 6) - die("Not a valid commit: %s", oid_to_hex(&b->oid)); + die(_("not a valid commit: %s"), oid_to_hex(&b->oid)); if (memcmp("tree ", buf, 5) || get_oid_hex(buf + 5, &b->branch_tree.versions[1].oid)) - die("The commit %s is corrupt", oid_to_hex(&b->oid)); + die(_("the commit %s is corrupt"), oid_to_hex(&b->oid)); oidcpy(&b->branch_tree.versions[0].oid, &b->branch_tree.versions[1].oid); } @@ -2625,7 +2625,7 @@ static int parse_objectish(struct branch *b, const char *objectish) s = lookup_branch(objectish); if (b == s) - die("Can't create a branch from itself: %s", b->name); + die(_("can't create a branch from itself: %s"), b->name); else if (s) { struct object_id *t = &s->branch_tree.versions[1].oid; oidcpy(&b->oid, &s->oid); @@ -2635,7 +2635,7 @@ static int parse_objectish(struct branch *b, const char *objectish) uintmax_t idnum = parse_mark_ref_eol(objectish); struct object_entry *oe = find_mark(marks, idnum); if (oe->type != OBJ_COMMIT) - die("Mark :%" PRIuMAX " not a commit", idnum); + die(_("mark :%" PRIuMAX " not a commit"), idnum); if (!oideq(&b->oid, &oe->idx.oid)) { oidcpy(&b->oid, &oe->idx.oid); if (oe->pack_id != MAX_PACK_ID) { @@ -2652,7 +2652,7 @@ static int parse_objectish(struct branch *b, const char *objectish) b->delete = 1; } else - die("Invalid ref name or SHA1 expression: %s", objectish); + die(_("invalid ref name or SHA1 expression: %s"), objectish); if (b->branch_tree.tree && !oideq(&oid, &b->branch_tree.versions[1].oid)) { release_tree_content_recursive(b->branch_tree.tree); @@ -2699,7 +2699,7 @@ static struct hash_list *parse_merge(unsigned int *count) uintmax_t idnum = parse_mark_ref_eol(from); struct object_entry *oe = find_mark(marks, idnum); if (oe->type != OBJ_COMMIT) - die("Mark :%" PRIuMAX " not a commit", idnum); + die(_("mark :%" PRIuMAX " not a commit"), idnum); oidcpy(&n->oid, &oe->idx.oid); } else if (!repo_get_oid(the_repository, from, &n->oid)) { unsigned long size; @@ -2707,10 +2707,10 @@ static struct hash_list *parse_merge(unsigned int *count) &n->oid, OBJ_COMMIT, &size, &n->oid); if (!buf || size < the_hash_algo->hexsz + 6) - die("Not a valid commit: %s", from); + die(_("not a valid commit: %s"), from); free(buf); } else - die("Invalid ref name or SHA1 expression: %s", from); + die(_("invalid ref name or SHA1 expression: %s"), from); n->next = NULL; *tail = n; @@ -2734,8 +2734,8 @@ static void parse_one_signature(struct signature_data *sig, const char *v) char *space = strchr(args, ' '); if (!space) - die("Expected gpgsig format: 'gpgsig <hash-algo> <signature-format>', " - "got 'gpgsig %s'", args); + die(_("expected gpgsig format: 'gpgsig <hash-algo> <signature-format>', " + "got 'gpgsig %s'"), args); *space = '\0'; sig->hash_algo = args; @@ -2744,13 +2744,13 @@ static void parse_one_signature(struct signature_data *sig, const char *v) /* Validate hash algorithm */ if (strcmp(sig->hash_algo, "sha1") && strcmp(sig->hash_algo, "sha256")) - die("Unknown git hash algorithm in gpgsig: '%s'", sig->hash_algo); + die(_("unknown git hash algorithm in gpgsig: '%s'"), sig->hash_algo); /* Validate signature format */ if (!valid_signature_format(sig->sig_format)) - die("Invalid signature format in gpgsig: '%s'", sig->sig_format); + die(_("invalid signature format in gpgsig: '%s'"), sig->sig_format); if (!strcmp(sig->sig_format, "unknown")) - warning("'unknown' signature format in gpgsig"); + warning(_("'unknown' signature format in gpgsig")); /* Read signature data */ read_next_command(); @@ -2789,8 +2789,8 @@ static void store_signature(struct signature_data *stored_sig, const char *hash_type) { if (stored_sig->hash_algo) { - warning("multiple %s signatures found, " - "ignoring additional signature", + warning(_("multiple %s signatures found, " + "ignoring additional signature"), hash_type); strbuf_release(&new_sig->data); free(new_sig->hash_algo); @@ -2845,15 +2845,15 @@ static void parse_new_commit(const char *arg) read_next_command(); } if (!committer) - die("Expected committer but didn't get one"); + die(_("expected committer but didn't get one")); while (skip_prefix(command_buf.buf, "gpgsig ", &v)) { switch (signed_commit_mode) { /* First, modes that don't need the signature to be parsed */ case SIGN_ABORT: - die("encountered signed commit; use " - "--signed-commits=<mode> to handle it"); + die(_("encountered signed commit; use " + "--signed-commits=<mode> to handle it")); case SIGN_WARN_STRIP: warning(_("stripping a commit signature")); /* fallthru */ @@ -3025,11 +3025,11 @@ static void parse_new_tag(const char *arg) /* from ... */ if (!skip_prefix(command_buf.buf, "from ", &from)) - die("Expected from command, got %s", command_buf.buf); + die(_("expected 'from' command, got '%s'"), command_buf.buf); s = lookup_branch(from); if (s) { if (is_null_oid(&s->oid)) - die("Can't tag an empty branch."); + die(_("can't tag an empty branch.")); oidcpy(&oid, &s->oid); type = OBJ_COMMIT; } else if (*from == ':') { @@ -3044,11 +3044,11 @@ static void parse_new_tag(const char *arg) type = odb_read_object_info(the_repository->objects, &oid, NULL); if (type < 0) - die("Not a valid object: %s", from); + die(_("not a valid object: %s"), from); } else type = oe->type; } else - die("Invalid ref name or SHA1 expression: %s", from); + die(_("invalid ref name or SHA1 expression: %s"), from); read_next_command(); /* original-oid ... */ @@ -3139,7 +3139,7 @@ static void parse_reset_branch(const char *arg) static void cat_blob_write(const char *buf, unsigned long size) { if (write_in_full(cat_blob_fd, buf, size) < 0) - die_errno("Write to frontend failed"); + die_errno(_("write to frontend failed")); } static void cat_blob(struct object_entry *oe, struct object_id *oid) @@ -3168,9 +3168,9 @@ static void cat_blob(struct object_entry *oe, struct object_id *oid) return; } if (!buf) - die("Can't read object %s", oid_to_hex(oid)); + die(_("can't read object %s"), oid_to_hex(oid)); if (type != OBJ_BLOB) - die("Object %s is a %s but a blob was expected.", + die(_("object %s is a %s but a blob was expected."), oid_to_hex(oid), type_name(type)); strbuf_reset(&line); strbuf_addf(&line, "%s %s %"PRIuMAX"\n", oid_to_hex(oid), @@ -3194,11 +3194,11 @@ static void parse_get_mark(const char *p) /* get-mark SP <object> LF */ if (*p != ':') - die("Not a mark: %s", p); + die(_("not a mark: %s"), p); oe = find_mark(marks, parse_mark_ref_eol(p)); if (!oe) - die("Unknown mark: %s", command_buf.buf); + die(_("unknown mark: %s"), command_buf.buf); xsnprintf(output, sizeof(output), "%s\n", oid_to_hex(&oe->idx.oid)); cat_blob_write(output, the_hash_algo->hexsz + 1); @@ -3213,13 +3213,13 @@ static void parse_cat_blob(const char *p) if (*p == ':') { oe = find_mark(marks, parse_mark_ref_eol(p)); if (!oe) - die("Unknown mark: %s", command_buf.buf); + die(_("unknown mark: %s"), command_buf.buf); oidcpy(&oid, &oe->idx.oid); } else { if (parse_mapped_oid_hex(p, &oid, &p)) - die("Invalid dataref: %s", command_buf.buf); + die(_("invalid dataref: %s"), command_buf.buf); if (*p) - die("Garbage after SHA1: %s", command_buf.buf); + die(_("garbage after SHA1: %s"), command_buf.buf); oe = find_object(&oid); } @@ -3237,7 +3237,7 @@ static struct object_entry *dereference(struct object_entry *oe, enum object_type type = odb_read_object_info(the_repository->objects, oid, NULL); if (type < 0) - die("object not found: %s", oid_to_hex(oid)); + die(_("object not found: %s"), oid_to_hex(oid)); /* cache it! */ oe = insert_object(oid); oe->type = type; @@ -3251,7 +3251,7 @@ static struct object_entry *dereference(struct object_entry *oe, case OBJ_TAG: break; default: - die("Not a tree-ish: %s", command_buf.buf); + die(_("not a tree-ish: %s"), command_buf.buf); } if (oe->pack_id != MAX_PACK_ID) { /* in a pack being written */ @@ -3262,19 +3262,19 @@ static struct object_entry *dereference(struct object_entry *oe, &unused, &size); } if (!buf) - die("Can't load object %s", oid_to_hex(oid)); + die(_("can't load object %s"), oid_to_hex(oid)); /* Peel one layer. */ switch (oe->type) { case OBJ_TAG: if (size < hexsz + strlen("object ") || get_oid_hex(buf + strlen("object "), oid)) - die("Invalid SHA1 in tag: %s", command_buf.buf); + die(_("invalid SHA1 in tag: %s"), command_buf.buf); break; case OBJ_COMMIT: if (size < hexsz + strlen("tree ") || get_oid_hex(buf + strlen("tree "), oid)) - die("Invalid SHA1 in commit: %s", command_buf.buf); + die(_("invalid SHA1 in commit: %s"), command_buf.buf); } free(buf); @@ -3309,9 +3309,9 @@ static void build_mark_map(struct string_list *from, struct string_list *to) for_each_string_list_item(fromp, from) { top = string_list_lookup(to, fromp->string); if (!fromp->util) { - die(_("Missing from marks for submodule '%s'"), fromp->string); + die(_("missing from marks for submodule '%s'"), fromp->string); } else if (!top || !top->util) { - die(_("Missing to marks for submodule '%s'"), fromp->string); + die(_("missing to marks for submodule '%s'"), fromp->string); } build_mark_map_one(fromp->util, top->util); } @@ -3325,14 +3325,14 @@ static struct object_entry *parse_treeish_dataref(const char **p) if (**p == ':') { /* <mark> */ e = find_mark(marks, parse_mark_ref_space(p)); if (!e) - die("Unknown mark: %s", command_buf.buf); + die(_("unknown mark: %s"), command_buf.buf); oidcpy(&oid, &e->idx.oid); } else { /* <sha1> */ if (parse_mapped_oid_hex(*p, &oid, p)) - die("Invalid dataref: %s", command_buf.buf); + die(_("invalid dataref: %s"), command_buf.buf); e = find_object(&oid); if (*(*p)++ != ' ') - die("Missing space after tree-ish: %s", command_buf.buf); + die(_("missing space after tree-ish: %s"), command_buf.buf); } while (!e || e->type != OBJ_TREE) @@ -3376,7 +3376,7 @@ static void parse_ls(const char *p, struct branch *b) /* ls SP (<tree-ish> SP)? <path> */ if (*p == '"') { if (!b) - die("Not in a commit: %s", command_buf.buf); + die(_("not in a commit: %s"), command_buf.buf); root = &b->branch_tree; } else { struct object_entry *e = parse_treeish_dataref(&p); @@ -3439,12 +3439,12 @@ static void parse_alias(void) /* mark ... */ parse_mark(); if (!next_mark) - die(_("Expected 'mark' command, got %s"), command_buf.buf); + die(_("expected 'mark' command, got %s"), command_buf.buf); /* to ... */ memset(&b, 0, sizeof(b)); if (!parse_objectish_with_prefix(&b, "to ")) - die(_("Expected 'to' command, got %s"), command_buf.buf); + die(_("expected 'to' command, got %s"), command_buf.buf); e = find_object(&b.oid); assert(e); insert_mark(&marks, next_mark, e); @@ -3462,7 +3462,7 @@ static void option_import_marks(const char *marks, { if (import_marks_file) { if (from_stream) - die("Only one import-marks command allowed per stream"); + die(_("only one import-marks command allowed per stream")); /* read previous mark file */ if(!import_marks_file_from_stream) @@ -3486,7 +3486,7 @@ static void option_date_format(const char *fmt) else if (!strcmp(fmt, "now")) whenspec = WHENSPEC_NOW; else - die("unknown --date-format argument %s", fmt); + die(_("unknown --date-format argument %s"), fmt); } static unsigned long ulong_arg(const char *option, const char *arg) @@ -3494,7 +3494,7 @@ static unsigned long ulong_arg(const char *option, const char *arg) char *endptr; unsigned long rv = strtoul(arg, &endptr, 0); if (strchr(arg, '-') || endptr == arg || *endptr) - die("%s: argument must be a non-negative integer", option); + die(_("%s: argument must be a non-negative integer"), option); return rv; } @@ -3502,7 +3502,7 @@ static void option_depth(const char *depth) { max_depth = ulong_arg("--depth", depth); if (max_depth > MAX_DEPTH) - die("--depth cannot exceed %u", MAX_DEPTH); + die(_("--depth cannot exceed %u"), MAX_DEPTH); } static void option_active_branches(const char *branches) @@ -3520,7 +3520,7 @@ static void option_cat_blob_fd(const char *fd) { unsigned long n = ulong_arg("--cat-blob-fd", fd); if (n > (unsigned long) INT_MAX) - die("--cat-blob-fd cannot exceed %d", INT_MAX); + die(_("--cat-blob-fd cannot exceed %d"), INT_MAX); cat_blob_fd = (int) n; } @@ -3540,7 +3540,7 @@ static void option_rewrite_submodules(const char *arg, struct string_list *list) char *s = xstrdup(arg); char *f = strchr(s, ':'); if (!f) - die(_("Expected format name:filename for submodule rewrite option")); + die(_("expected format name:filename for submodule rewrite option")); *f = '\0'; f++; CALLOC_ARRAY(ms, 1); @@ -3548,7 +3548,7 @@ static void option_rewrite_submodules(const char *arg, struct string_list *list) f = prefix_filename(global_prefix, f); fp = fopen(f, "r"); if (!fp) - die_errno("cannot read '%s'", f); + die_errno(_("cannot read '%s'"), f); read_mark_file(&ms, fp, insert_oid_entry); fclose(fp); free(f); @@ -3565,10 +3565,10 @@ static int parse_one_option(const char *option) if (!git_parse_ulong(option, &v)) return 0; if (v < 8192) { - warning("max-pack-size is now in bytes, assuming --max-pack-size=%lum", v); + warning(_("max-pack-size is now in bytes, assuming --max-pack-size=%lum"), v); v *= 1024 * 1024; } else if (v < 1024 * 1024) { - warning("minimum max-pack-size is 1 MiB"); + warning(_("minimum max-pack-size is 1 MiB")); v = 1024 * 1024; } max_packsize = v; @@ -3655,23 +3655,23 @@ static int parse_one_feature(const char *feature, int from_stream) static void parse_feature(const char *feature) { if (seen_data_command) - die("Got feature command '%s' after data command", feature); + die(_("got feature command '%s' after data command"), feature); if (parse_one_feature(feature, 1)) return; - die("This version of fast-import does not support feature %s.", feature); + die(_("this version of fast-import does not support feature %s."), feature); } static void parse_option(const char *option) { if (seen_data_command) - die("Got option command '%s' after data command", option); + die(_("got option command '%s' after data command"), option); if (parse_one_option(option)) return; - die("This version of fast-import does not support option: %s", option); + die(_("this version of fast-import does not support option: %s"), option); } static void git_pack_config(void) @@ -3715,7 +3715,7 @@ static void parse_argv(void) break; if (!skip_prefix(a, "--", &a)) - die("unknown option %s", a); + die(_("unknown option %s"), a); if (parse_one_option(a)) continue; @@ -3728,7 +3728,7 @@ static void parse_argv(void) continue; } - die("unknown option --%s", a); + die(_("unknown option --%s"), a); } if (i != global_argc) usage(fast_import_usage); @@ -3817,7 +3817,7 @@ int cmd_fast_import(int argc, else if (starts_with(command_buf.buf, "option ")) /* ignore non-git options*/; else - die("Unsupported command: %s", command_buf.buf); + die(_("unsupported command: %s"), command_buf.buf); if (checkpoint_requested) checkpoint(); @@ -3828,7 +3828,7 @@ int cmd_fast_import(int argc, parse_argv(); if (require_explicit_termination && feof(stdin)) - die("stream ends early"); + die(_("stream ends early")); end_packfile(); diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index 4dc3d645bf..5685cce6fe 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -2927,16 +2927,16 @@ test_expect_success 'R: blob appears only once' ' # The error message when a space is missing not at the # end of the line is: # -# Missing space after .. +# missing space after .. # # or when extra characters come after the mark at the end # of the line: # -# Garbage after .. +# garbage after .. # # or when the dataref is neither "inline " or a known SHA1, # -# Invalid dataref .. +# invalid dataref .. # test_expect_success 'S: initialize for S tests' ' test_tick && @@ -3405,15 +3405,15 @@ test_path_fail () { test_path_base_fail () { local change="$1" prefix="$2" field="$3" suffix="$4" - test_path_fail "$change" 'unclosed " in '"$field" "$prefix" '"hello.c' "$suffix" "Invalid $field" - test_path_fail "$change" "invalid escape in quoted $field" "$prefix" '"hello\xff"' "$suffix" "Invalid $field" + test_path_fail "$change" 'unclosed " in '"$field" "$prefix" '"hello.c' "$suffix" "invalid $field" + test_path_fail "$change" "invalid escape in quoted $field" "$prefix" '"hello\xff"' "$suffix" "invalid $field" test_path_fail "$change" "escaped NUL in quoted $field" "$prefix" '"hello\000"' "$suffix" "NUL in $field" } test_path_eol_quoted_fail () { local change="$1" prefix="$2" field="$3" test_path_base_fail "$change" "$prefix" "$field" '' - test_path_fail "$change" "garbage after quoted $field" "$prefix" '"hello.c"' 'x' "Garbage after $field" - test_path_fail "$change" "space after quoted $field" "$prefix" '"hello.c"' ' ' "Garbage after $field" + test_path_fail "$change" "garbage after quoted $field" "$prefix" '"hello.c"' 'x' "garbage after $field" + test_path_fail "$change" "space after quoted $field" "$prefix" '"hello.c"' ' ' "garbage after $field" } test_path_eol_fail () { local change="$1" prefix="$2" field="$3" @@ -3422,8 +3422,8 @@ test_path_eol_fail () { test_path_space_fail () { local change="$1" prefix="$2" field="$3" test_path_base_fail "$change" "$prefix" "$field" ' world.c' - test_path_fail "$change" "missing space after quoted $field" "$prefix" '"hello.c"' 'x world.c' "Missing space after $field" - test_path_fail "$change" "missing space after unquoted $field" "$prefix" 'hello.c' '' "Missing space after $field" + test_path_fail "$change" "missing space after quoted $field" "$prefix" '"hello.c"' 'x world.c' "missing space after $field" + test_path_fail "$change" "missing space after unquoted $field" "$prefix" 'hello.c' '' "missing space after $field" } test_path_eol_fail filemodify 'M 100644 :1 ' path @@ -3820,7 +3820,7 @@ test_expect_success 'X: replace ref that becomes useless is removed' ' sed -e s/othername/somename/ tmp >tmp2 && git fast-import --force <tmp2 2>msgs && - grep "Dropping.*since it would point to itself" msgs && + grep "dropping.*since it would point to itself" msgs && git show-ref >refs && ! grep refs/replace refs ) -- 2.51.2.617.g2aaa867cd1 ^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH v2 4/5] fast-import: mark strings for translation 2025-10-30 12:33 ` [PATCH v2 4/5] fast-import: " Christian Couder @ 2025-10-31 19:35 ` Elijah Newren 0 siblings, 0 replies; 22+ messages in thread From: Elijah Newren @ 2025-10-31 19:35 UTC (permalink / raw) To: Christian Couder Cc: git, Junio C Hamano, Patrick Steinhardt, Jeff King, brian m . carlson, Johannes Schindelin, Christian Couder On Thu, Oct 30, 2025 at 5:33 AM Christian Couder <christian.couder@gmail.com> wrote: > > Some error or warning messages in "builtin/fast-import.c" are marked > for translation, but many are not. > > To be more consistent and provide a better experience to people using a > translated version, let's mark all the remaining error or warning > messages for translation. > > While at it, let's make the following small changes: > > - replace "GIT" or "git" in a few error messages to just "Git", > - replace "Expected from command, got %s" to "expected 'from' > command, got '%s'", which makes it clearer that "from" is a command > and should not be translated, These are all good fixes you are making, but I _especially_ appreciate this fix. I think you might undersell it, though, not only will it help translators, it'll help English readers who might assume the message is garbled or hard to parse realize that 'from' is not a preposition as used here. > - downcase error and warning messages that start with an uppercase, > - fix test cases in "t9300-fast-import.sh" that broke because an > error or warning message was downcased, > - split error and warning messages that are too long, > - adjust the indentation of some arguments of the error functions. > > Signed-off-by: Christian Couder <chriscool@tuxfamily.org> > --- > builtin/fast-import.c | 280 ++++++++++++++++++++--------------------- > t/t9300-fast-import.sh | 20 +-- > 2 files changed, 150 insertions(+), 150 deletions(-) > > diff --git a/builtin/fast-import.c b/builtin/fast-import.c > index 8714edfc65..22d5deae9a 100644 > --- a/builtin/fast-import.c > +++ b/builtin/fast-import.c > @@ -339,12 +339,12 @@ static void write_crash_report(const char *err) > struct recent_command *rc; > > if (!rpt) { > - error_errno("can't write crash report %s", loc); > + error_errno(_("can't write crash report %s"), loc); > free(loc); > return; > } > > - fprintf(stderr, "fast-import: dumping crash report to %s\n", loc); > + fprintf(stderr, _("fast-import: dumping crash report to %s\n"), loc); > > fprintf(rpt, "fast-import crash report:\n"); > fprintf(rpt, " fast-import process: %"PRIuMAX"\n", (uintmax_t) getpid()); > @@ -588,7 +588,7 @@ static void *find_mark(struct mark_set *s, uintmax_t idnum) > oe = s->data.marked[idnum]; > } > if (!oe) > - die("mark :%" PRIuMAX " not declared", orig_idnum); > + die(_("mark :%" PRIuMAX " not declared"), orig_idnum); > return oe; > } > > @@ -628,9 +628,9 @@ static struct branch *new_branch(const char *name) > struct branch *b = lookup_branch(name); > > if (b) > - die("Invalid attempt to create duplicate branch: %s", name); > + die(_("invalid attempt to create duplicate branch: %s"), name); > if (check_refname_format(name, REFNAME_ALLOW_ONELEVEL)) > - die("Branch name doesn't conform to GIT standards: %s", name); > + die(_("branch name doesn't conform to Git standards: %s"), name); > > b = mem_pool_calloc(&fi_mem_pool, 1, sizeof(struct branch)); > b->name = mem_pool_strdup(&fi_mem_pool, name); > @@ -801,7 +801,7 @@ static const char *create_index(void) > *c++ = &e->idx; > last = idx + object_count; > if (c != last) > - die("internal consistency error creating the index"); > + die(_("internal consistency error creating the index")); > > tmpfile = write_idx_file(the_repository, NULL, idx, object_count, > &pack_idx_opts, pack_data->hash); > @@ -819,18 +819,18 @@ static char *keep_pack(const char *curr_index_name) > keep_fd = safe_create_file_with_leading_directories(pack_data->repo, > name.buf); > if (keep_fd < 0) > - die_errno("cannot create keep file"); > + die_errno(_("cannot create keep file")); > write_or_die(keep_fd, keep_msg, strlen(keep_msg)); > if (close(keep_fd)) > - die_errno("failed to write keep file"); > + die_errno(_("failed to write keep file")); > > odb_pack_name(pack_data->repo, &name, pack_data->hash, "pack"); > if (finalize_object_file(pack_data->repo, pack_data->pack_name, name.buf)) > - die("cannot store pack file"); > + die(_("cannot store pack file")); > > odb_pack_name(pack_data->repo, &name, pack_data->hash, "idx"); > if (finalize_object_file(pack_data->repo, curr_index_name, name.buf)) > - die("cannot store index file"); > + die(_("cannot store index file")); > free((void *)curr_index_name); > return strbuf_detach(&name, NULL); > } > @@ -853,7 +853,7 @@ static int loosen_small_pack(const struct packed_git *p) > struct child_process unpack = CHILD_PROCESS_INIT; > > if (lseek(p->pack_fd, 0, SEEK_SET) < 0) > - die_errno("Failed seeking to start of '%s'", p->pack_name); > + die_errno(_("failed seeking to start of '%s'"), p->pack_name); > > unpack.in = p->pack_fd; > unpack.git_cmd = 1; > @@ -903,7 +903,7 @@ static void end_packfile(void) > new_p = packfile_store_load_pack(pack_data->repo->objects->packfiles, > idx_name, 1); > if (!new_p) > - die("core git rejected index %s", idx_name); > + die(_("core Git rejected index %s"), idx_name); > all_packs[pack_id] = new_p; > free(idx_name); > > @@ -1090,7 +1090,7 @@ static int store_object( > static void truncate_pack(struct hashfile_checkpoint *checkpoint) > { > if (hashfile_truncate(pack_file, checkpoint)) > - die_errno("cannot truncate pack to skip duplicate"); > + die_errno(_("cannot truncate pack to skip duplicate")); > pack_size = checkpoint->offset; > } > > @@ -1138,7 +1138,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark) > size_t cnt = in_sz < len ? in_sz : (size_t)len; > size_t n = fread(in_buf, 1, cnt, stdin); > if (!n && feof(stdin)) > - die("EOF in data (%" PRIuMAX " bytes remaining)", len); > + die(_("EOF in data (%" PRIuMAX " bytes remaining)"), len); > > git_hash_update(&c, in_buf, n); > s.next_in = in_buf; > @@ -1162,7 +1162,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark) > case Z_STREAM_END: > continue; > default: > - die("unexpected deflate failure: %d", status); > + die(_("unexpected deflate failure: %d"), status); > } > } > git_deflate_end(&s); > @@ -1264,16 +1264,16 @@ static void load_tree(struct tree_entry *root) > myoe = find_object(oid); > if (myoe && myoe->pack_id != MAX_PACK_ID) { > if (myoe->type != OBJ_TREE) > - die("Not a tree: %s", oid_to_hex(oid)); > + die(_("not a tree: %s"), oid_to_hex(oid)); > t->delta_depth = myoe->depth; > buf = gfi_unpack_entry(myoe, &size); > if (!buf) > - die("Can't load tree %s", oid_to_hex(oid)); > + die(_("can't load tree %s"), oid_to_hex(oid)); > } else { > enum object_type type; > buf = odb_read_object(the_repository->objects, oid, &type, &size); > if (!buf || type != OBJ_TREE) > - die("Can't load tree %s", oid_to_hex(oid)); > + die(_("can't load tree %s"), oid_to_hex(oid)); > } > > c = buf; > @@ -1287,7 +1287,7 @@ static void load_tree(struct tree_entry *root) > e->tree = NULL; > c = parse_mode(c, &e->versions[1].mode); > if (!c) > - die("Corrupt mode in %s", oid_to_hex(oid)); > + die(_("corrupt mode in %s"), oid_to_hex(oid)); > e->versions[0].mode = e->versions[1].mode; > e->name = to_atom(c, strlen(c)); > c += e->name->str_len + 1; > @@ -1399,7 +1399,7 @@ static void tree_content_replace( > struct tree_content *newtree) > { > if (!S_ISDIR(mode)) > - die("Root cannot be a non-directory"); > + die(_("root cannot be a non-directory")); > oidclr(&root->versions[0].oid, the_repository->hash_algo); > oidcpy(&root->versions[1].oid, oid); > if (root->tree) > @@ -1422,9 +1422,9 @@ static int tree_content_set( > slash1 = strchrnul(p, '/'); > n = slash1 - p; > if (!n) > - die("Empty path component found in input"); > + die(_("empty path component found in input")); > if (!*slash1 && !S_ISDIR(mode) && subtree) > - die("Non-directories cannot have subtrees"); > + die(_("non-directories cannot have subtrees")); > > if (!root->tree) > load_tree(root); > @@ -1576,7 +1576,7 @@ static int tree_content_get( > slash1 = strchrnul(p, '/'); > n = slash1 - p; > if (!n && !allow_root) > - die("Empty path component found in input"); > + die(_("empty path component found in input")); > > if (!root->tree) > load_tree(root); > @@ -1622,8 +1622,8 @@ static int update_branch(struct branch *b) > !strcmp(b->name + strlen(replace_prefix), > oid_to_hex(&b->oid))) { > if (!quiet) > - warning("Dropping %s since it would point to " > - "itself (i.e. to %s)", > + warning(_("dropping %s since it would point to " > + "itself (i.e. to %s)"), > b->name, oid_to_hex(&b->oid)); > refs_delete_ref(get_main_ref_store(the_repository), > NULL, b->name, NULL, 0); > @@ -1646,14 +1646,14 @@ static int update_branch(struct branch *b) > new_cmit = lookup_commit_reference_gently(the_repository, > &b->oid, 0); > if (!old_cmit || !new_cmit) > - return error("Branch %s is missing commits.", b->name); > + return error(_("branch %s is missing commits."), b->name); > > ret = repo_in_merge_bases(the_repository, old_cmit, new_cmit); > if (ret < 0) > exit(128); > if (!ret) { > - warning("Not updating %s" > - " (new tip %s does not contain %s)", > + warning(_("not updating %s" > + " (new tip %s does not contain %s)"), > b->name, oid_to_hex(&b->oid), > oid_to_hex(&old_oid)); > return -1; > @@ -1729,13 +1729,13 @@ static void dump_marks(void) > return; > > if (safe_create_leading_directories_const(the_repository, export_marks_file)) { > - failure |= error_errno("unable to create leading directories of %s", > + failure |= error_errno(_("unable to create leading directories of %s"), > export_marks_file); > return; > } > > if (hold_lock_file_for_update(&mark_lock, export_marks_file, 0) < 0) { > - failure |= error_errno("Unable to write marks file %s", > + failure |= error_errno(_("unable to write marks file %s"), > export_marks_file); > return; > } > @@ -1744,14 +1744,14 @@ static void dump_marks(void) > if (!f) { > int saved_errno = errno; > rollback_lock_file(&mark_lock); > - failure |= error("Unable to write marks file %s: %s", > + failure |= error(_("unable to write marks file %s: %s"), > export_marks_file, strerror(saved_errno)); > return; > } > > for_each_mark(marks, 0, dump_marks_fn, f); > if (commit_lock_file(&mark_lock)) { > - failure |= error_errno("Unable to write file %s", > + failure |= error_errno(_("unable to write file %s"), > export_marks_file); > return; > } > @@ -1765,7 +1765,7 @@ static void insert_object_entry(struct mark_set **s, struct object_id *oid, uint > enum object_type type = odb_read_object_info(the_repository->objects, > oid, NULL); > if (type < 0) > - die("object not found: %s", oid_to_hex(oid)); > + die(_("object not found: %s"), oid_to_hex(oid)); > e = insert_object(oid); > e->type = type; > e->pack_id = MAX_PACK_ID; > @@ -1792,13 +1792,13 @@ static void read_mark_file(struct mark_set **s, FILE *f, mark_set_inserter_t ins > > end = strchr(line, '\n'); > if (line[0] != ':' || !end) > - die("corrupt mark line: %s", line); > + die(_("corrupt mark line: %s"), line); > *end = 0; > mark = strtoumax(line + 1, &end, 10); > if (!mark || end == line + 1 > || *end != ' ' > || get_oid_hex_any(end + 1, &oid) == GIT_HASH_UNKNOWN) > - die("corrupt mark line: %s", line); > + die(_("corrupt mark line: %s"), line); > inserter(s, &oid, mark); > } > } > @@ -1811,7 +1811,7 @@ static void read_marks(void) > else if (import_marks_file_ignore_missing && errno == ENOENT) > goto done; /* Marks file does not exist */ > else > - die_errno("cannot read '%s'", import_marks_file); > + die_errno(_("cannot read '%s'"), import_marks_file); > read_mark_file(&marks, f, insert_object_entry); > fclose(f); > done: > @@ -1897,7 +1897,7 @@ static int parse_data(struct strbuf *sb, uintmax_t limit, uintmax_t *len_res) > strbuf_reset(sb); > > if (!skip_prefix(command_buf.buf, "data ", &data)) > - die("Expected 'data n' command, found: %s", command_buf.buf); > + die(_("expected 'data n' command, found: %s"), command_buf.buf); > > if (skip_prefix(data, "<<", &data)) { > char *term = xstrdup(data); > @@ -1905,7 +1905,7 @@ static int parse_data(struct strbuf *sb, uintmax_t limit, uintmax_t *len_res) > > for (;;) { > if (strbuf_getline_lf(&command_buf, stdin) == EOF) > - die("EOF in data (terminator '%s' not found)", term); > + die(_("EOF in data (terminator '%s' not found)"), term); > if (term_len == command_buf.len > && !strcmp(term, command_buf.buf)) > break; > @@ -1923,12 +1923,12 @@ static int parse_data(struct strbuf *sb, uintmax_t limit, uintmax_t *len_res) > return 0; > } > if (length < len) > - die("data is too large to use in this context"); > + die(_("data is too large to use in this context")); > > while (n < length) { > size_t s = strbuf_fread(sb, length - n, stdin); > if (!s && feof(stdin)) > - die("EOF in data (%lu bytes remaining)", > + die(_("EOF in data (%lu bytes remaining)"), > (unsigned long)(length - n)); > n += s; > } > @@ -1985,15 +1985,15 @@ static char *parse_ident(const char *buf) > > ltgt = buf + strcspn(buf, "<>"); > if (*ltgt != '<') > - die("Missing < in ident string: %s", buf); > + die(_("missing < in ident string: %s"), buf); > if (ltgt != buf && ltgt[-1] != ' ') > - die("Missing space before < in ident string: %s", buf); > + die(_("missing space before < in ident string: %s"), buf); > ltgt = ltgt + 1 + strcspn(ltgt + 1, "<>"); > if (*ltgt != '>') > - die("Missing > in ident string: %s", buf); > + die(_("missing > in ident string: %s"), buf); > ltgt++; > if (*ltgt != ' ') > - die("Missing space after > in ident string: %s", buf); > + die(_("missing space after > in ident string: %s"), buf); > ltgt++; > name_len = ltgt - buf; > strbuf_add(&ident, buf, name_len); > @@ -2001,19 +2001,19 @@ static char *parse_ident(const char *buf) > switch (whenspec) { > case WHENSPEC_RAW: > if (validate_raw_date(ltgt, &ident, 1) < 0) > - die("Invalid raw date \"%s\" in ident: %s", ltgt, buf); > + die(_("invalid raw date \"%s\" in ident: %s"), ltgt, buf); > break; > case WHENSPEC_RAW_PERMISSIVE: > if (validate_raw_date(ltgt, &ident, 0) < 0) > - die("Invalid raw date \"%s\" in ident: %s", ltgt, buf); > + die(_("invalid raw date \"%s\" in ident: %s"), ltgt, buf); > break; > case WHENSPEC_RFC2822: > if (parse_date(ltgt, &ident) < 0) > - die("Invalid rfc2822 date \"%s\" in ident: %s", ltgt, buf); > + die(_("invalid rfc2822 date \"%s\" in ident: %s"), ltgt, buf); > break; > case WHENSPEC_NOW: > if (strcmp("now", ltgt)) > - die("Date in ident must be 'now': %s", buf); > + die(_("date in ident must be 'now': %s"), buf); > datestamp(&ident); > break; > } > @@ -2107,7 +2107,7 @@ static void construct_path_with_fanout(const char *hex_sha1, > { > unsigned int i = 0, j = 0; > if (fanout >= the_hash_algo->rawsz) > - die("Too large fanout (%u)", fanout); > + die(_("too large fanout (%u)"), fanout); > while (fanout) { > path[i++] = hex_sha1[j++]; > path[i++] = hex_sha1[j++]; > @@ -2181,7 +2181,7 @@ static uintmax_t do_change_note_fanout( > > /* Rename fullpath to realpath */ > if (!tree_content_remove(orig_root, fullpath, &leaf, 0)) > - die("Failed to remove path %s", fullpath); > + die(_("failed to remove path %s"), fullpath); > tree_content_set(orig_root, realpath, > &leaf.versions[1].oid, > leaf.versions[1].mode, > @@ -2254,7 +2254,7 @@ static uintmax_t parse_mark_ref(const char *p, char **endptr) > p++; > mark = strtoumax(p, endptr, 10); > if (*endptr == p) > - die("No value after ':' in mark: %s", command_buf.buf); > + die(_("no value after ':' in mark: %s"), command_buf.buf); > return mark; > } > > @@ -2269,7 +2269,7 @@ static uintmax_t parse_mark_ref_eol(const char *p) > > mark = parse_mark_ref(p, &end); > if (*end != '\0') > - die("Garbage after mark: %s", command_buf.buf); > + die(_("garbage after mark: %s"), command_buf.buf); > return mark; > } > > @@ -2284,7 +2284,7 @@ static uintmax_t parse_mark_ref_space(const char **p) > > mark = parse_mark_ref(*p, &end); > if (*end++ != ' ') > - die("Missing space after mark: %s", command_buf.buf); > + die(_("missing space after mark: %s"), command_buf.buf); > *p = end; > return mark; > } > @@ -2300,9 +2300,9 @@ static void parse_path(struct strbuf *sb, const char *p, const char **endp, > { > if (*p == '"') { > if (unquote_c_style(sb, p, endp)) > - die("Invalid %s: %s", field, command_buf.buf); > + die(_("invalid %s: %s"), field, command_buf.buf); > if (strlen(sb->buf) != sb->len) > - die("NUL in %s: %s", field, command_buf.buf); > + die(_("NUL in %s: %s"), field, command_buf.buf); > } else { > /* > * Unless we are parsing the last field of a line, > @@ -2325,7 +2325,7 @@ static void parse_path_eol(struct strbuf *sb, const char *p, const char *field) > > parse_path(sb, p, &end, 1, field); > if (*end) > - die("Garbage after %s: %s", field, command_buf.buf); > + die(_("garbage after %s: %s"), field, command_buf.buf); > } > > /* > @@ -2338,7 +2338,7 @@ static void parse_path_space(struct strbuf *sb, const char *p, > { > parse_path(sb, p, endp, 0, field); > if (**endp != ' ') > - die("Missing space after %s: %s", field, command_buf.buf); > + die(_("missing space after %s: %s"), field, command_buf.buf); > (*endp)++; > } > > @@ -2351,7 +2351,7 @@ static void file_change_m(const char *p, struct branch *b) > > p = parse_mode(p, &mode); > if (!p) > - die("Corrupt mode: %s", command_buf.buf); > + die(_("corrupt mode: %s"), command_buf.buf); > switch (mode) { > case 0644: > case 0755: > @@ -2364,7 +2364,7 @@ static void file_change_m(const char *p, struct branch *b) > /* ok */ > break; > default: > - die("Corrupt mode: %s", command_buf.buf); > + die(_("corrupt mode: %s"), command_buf.buf); > } > > if (*p == ':') { > @@ -2375,10 +2375,10 @@ static void file_change_m(const char *p, struct branch *b) > oe = NULL; /* not used with inline_data, but makes gcc happy */ > } else { > if (parse_mapped_oid_hex(p, &oid, &p)) > - die("Invalid dataref: %s", command_buf.buf); > + die(_("invalid dataref: %s"), command_buf.buf); > oe = find_object(&oid); > if (*p++ != ' ') > - die("Missing space after SHA1: %s", command_buf.buf); > + die(_("missing space after SHA1: %s"), command_buf.buf); > } > > strbuf_reset(&path); > @@ -2394,11 +2394,11 @@ static void file_change_m(const char *p, struct branch *b) > > if (S_ISGITLINK(mode)) { > if (inline_data) > - die("Git links cannot be specified 'inline': %s", > + die(_("Git links cannot be specified 'inline': %s"), > command_buf.buf); > else if (oe) { > if (oe->type != OBJ_COMMIT) > - die("Not a commit (actually a %s): %s", > + die(_("not a commit (actually a %s): %s"), > type_name(oe->type), command_buf.buf); > } > /* > @@ -2407,7 +2407,7 @@ static void file_change_m(const char *p, struct branch *b) > */ > } else if (inline_data) { > if (S_ISDIR(mode)) > - die("Directories cannot be specified 'inline': %s", > + die(_("directories cannot be specified 'inline': %s"), > command_buf.buf); > while (read_next_command() != EOF) { > const char *v; > @@ -2425,11 +2425,11 @@ static void file_change_m(const char *p, struct branch *b) > odb_read_object_info(the_repository->objects, > &oid, NULL); > if (type < 0) > - die("%s not found: %s", > - S_ISDIR(mode) ? "Tree" : "Blob", > - command_buf.buf); > + die(_("%s not found: %s"), > + S_ISDIR(mode) ? _("tree") : _("blob"), > + command_buf.buf); > if (type != expected) > - die("Not a %s (actually a %s): %s", > + die(_("not a %s (actually a %s): %s"), > type_name(expected), type_name(type), > command_buf.buf); > } > @@ -2440,7 +2440,7 @@ static void file_change_m(const char *p, struct branch *b) > } > > if (!verify_path(path.buf, mode)) > - die("invalid path '%s'", path.buf); > + die(_("invalid path '%s'"), path.buf); > tree_content_set(&b->branch_tree, path.buf, &oid, mode, NULL); > } > > @@ -2470,7 +2470,7 @@ static void file_change_cr(const char *p, struct branch *b, int rename) > else > tree_content_get(&b->branch_tree, source.buf, &leaf, 1); > if (!leaf.versions[1].mode) > - die("Path %s not in branch", source.buf); > + die(_("path %s not in branch"), source.buf); > if (!*dest.buf) { /* C "path/to/subdir" "" */ > tree_content_replace(&b->branch_tree, > &leaf.versions[1].oid, > @@ -2479,7 +2479,7 @@ static void file_change_cr(const char *p, struct branch *b, int rename) > return; > } > if (!verify_path(dest.buf, leaf.versions[1].mode)) > - die("invalid path '%s'", dest.buf); > + die(_("invalid path '%s'"), dest.buf); > tree_content_set(&b->branch_tree, dest.buf, > &leaf.versions[1].oid, > leaf.versions[1].mode, > @@ -2521,23 +2521,23 @@ static void note_change_n(const char *p, struct branch *b, unsigned char *old_fa > oe = NULL; /* not used with inline_data, but makes gcc happy */ > } else { > if (parse_mapped_oid_hex(p, &oid, &p)) > - die("Invalid dataref: %s", command_buf.buf); > + die(_("invalid dataref: %s"), command_buf.buf); > oe = find_object(&oid); > if (*p++ != ' ') > - die("Missing space after SHA1: %s", command_buf.buf); > + die(_("missing space after SHA1: %s"), command_buf.buf); > } > > /* <commit-ish> */ > s = lookup_branch(p); > if (s) { > if (is_null_oid(&s->oid)) > - die("Can't add a note on empty branch."); > + die(_("can't add a note on empty branch.")); > oidcpy(&commit_oid, &s->oid); > } else if (*p == ':') { > uintmax_t commit_mark = parse_mark_ref_eol(p); > struct object_entry *commit_oe = find_mark(marks, commit_mark); > if (commit_oe->type != OBJ_COMMIT) > - die("Mark :%" PRIuMAX " not a commit", commit_mark); > + die(_("mark :%" PRIuMAX " not a commit"), commit_mark); > oidcpy(&commit_oid, &commit_oe->idx.oid); > } else if (!repo_get_oid(the_repository, p, &commit_oid)) { > unsigned long size; > @@ -2545,25 +2545,25 @@ static void note_change_n(const char *p, struct branch *b, unsigned char *old_fa > &commit_oid, OBJ_COMMIT, &size, > &commit_oid); > if (!buf || size < the_hash_algo->hexsz + 6) > - die("Not a valid commit: %s", p); > + die(_("not a valid commit: %s"), p); > free(buf); > } else > - die("Invalid ref name or SHA1 expression: %s", p); > + die(_("invalid ref name or SHA1 expression: %s"), p); > > if (inline_data) { > read_next_command(); > parse_and_store_blob(&last_blob, &oid, 0); > } else if (oe) { > if (oe->type != OBJ_BLOB) > - die("Not a blob (actually a %s): %s", > + die(_("not a blob (actually a %s): %s"), > type_name(oe->type), command_buf.buf); > } else if (!is_null_oid(&oid)) { > enum object_type type = odb_read_object_info(the_repository->objects, &oid, > NULL); > if (type < 0) > - die("Blob not found: %s", command_buf.buf); > + die(_("blob not found: %s"), command_buf.buf); > if (type != OBJ_BLOB) > - die("Not a blob (actually a %s): %s", > + die(_("not a blob (actually a %s): %s"), > type_name(type), command_buf.buf); > } > > @@ -2592,10 +2592,10 @@ static void file_change_deleteall(struct branch *b) > static void parse_from_commit(struct branch *b, char *buf, unsigned long size) > { > if (!buf || size < the_hash_algo->hexsz + 6) > - die("Not a valid commit: %s", oid_to_hex(&b->oid)); > + die(_("not a valid commit: %s"), oid_to_hex(&b->oid)); > if (memcmp("tree ", buf, 5) > || get_oid_hex(buf + 5, &b->branch_tree.versions[1].oid)) > - die("The commit %s is corrupt", oid_to_hex(&b->oid)); > + die(_("the commit %s is corrupt"), oid_to_hex(&b->oid)); > oidcpy(&b->branch_tree.versions[0].oid, > &b->branch_tree.versions[1].oid); > } > @@ -2625,7 +2625,7 @@ static int parse_objectish(struct branch *b, const char *objectish) > > s = lookup_branch(objectish); > if (b == s) > - die("Can't create a branch from itself: %s", b->name); > + die(_("can't create a branch from itself: %s"), b->name); > else if (s) { > struct object_id *t = &s->branch_tree.versions[1].oid; > oidcpy(&b->oid, &s->oid); > @@ -2635,7 +2635,7 @@ static int parse_objectish(struct branch *b, const char *objectish) > uintmax_t idnum = parse_mark_ref_eol(objectish); > struct object_entry *oe = find_mark(marks, idnum); > if (oe->type != OBJ_COMMIT) > - die("Mark :%" PRIuMAX " not a commit", idnum); > + die(_("mark :%" PRIuMAX " not a commit"), idnum); > if (!oideq(&b->oid, &oe->idx.oid)) { > oidcpy(&b->oid, &oe->idx.oid); > if (oe->pack_id != MAX_PACK_ID) { > @@ -2652,7 +2652,7 @@ static int parse_objectish(struct branch *b, const char *objectish) > b->delete = 1; > } > else > - die("Invalid ref name or SHA1 expression: %s", objectish); > + die(_("invalid ref name or SHA1 expression: %s"), objectish); > > if (b->branch_tree.tree && !oideq(&oid, &b->branch_tree.versions[1].oid)) { > release_tree_content_recursive(b->branch_tree.tree); > @@ -2699,7 +2699,7 @@ static struct hash_list *parse_merge(unsigned int *count) > uintmax_t idnum = parse_mark_ref_eol(from); > struct object_entry *oe = find_mark(marks, idnum); > if (oe->type != OBJ_COMMIT) > - die("Mark :%" PRIuMAX " not a commit", idnum); > + die(_("mark :%" PRIuMAX " not a commit"), idnum); > oidcpy(&n->oid, &oe->idx.oid); > } else if (!repo_get_oid(the_repository, from, &n->oid)) { > unsigned long size; > @@ -2707,10 +2707,10 @@ static struct hash_list *parse_merge(unsigned int *count) > &n->oid, OBJ_COMMIT, > &size, &n->oid); > if (!buf || size < the_hash_algo->hexsz + 6) > - die("Not a valid commit: %s", from); > + die(_("not a valid commit: %s"), from); > free(buf); > } else > - die("Invalid ref name or SHA1 expression: %s", from); > + die(_("invalid ref name or SHA1 expression: %s"), from); > > n->next = NULL; > *tail = n; > @@ -2734,8 +2734,8 @@ static void parse_one_signature(struct signature_data *sig, const char *v) > char *space = strchr(args, ' '); > > if (!space) > - die("Expected gpgsig format: 'gpgsig <hash-algo> <signature-format>', " > - "got 'gpgsig %s'", args); > + die(_("expected gpgsig format: 'gpgsig <hash-algo> <signature-format>', " > + "got 'gpgsig %s'"), args); > *space = '\0'; > > sig->hash_algo = args; > @@ -2744,13 +2744,13 @@ static void parse_one_signature(struct signature_data *sig, const char *v) > /* Validate hash algorithm */ > if (strcmp(sig->hash_algo, "sha1") && > strcmp(sig->hash_algo, "sha256")) > - die("Unknown git hash algorithm in gpgsig: '%s'", sig->hash_algo); > + die(_("unknown git hash algorithm in gpgsig: '%s'"), sig->hash_algo); > > /* Validate signature format */ > if (!valid_signature_format(sig->sig_format)) > - die("Invalid signature format in gpgsig: '%s'", sig->sig_format); > + die(_("invalid signature format in gpgsig: '%s'"), sig->sig_format); > if (!strcmp(sig->sig_format, "unknown")) > - warning("'unknown' signature format in gpgsig"); > + warning(_("'unknown' signature format in gpgsig")); > > /* Read signature data */ > read_next_command(); > @@ -2789,8 +2789,8 @@ static void store_signature(struct signature_data *stored_sig, > const char *hash_type) > { > if (stored_sig->hash_algo) { > - warning("multiple %s signatures found, " > - "ignoring additional signature", > + warning(_("multiple %s signatures found, " > + "ignoring additional signature"), > hash_type); > strbuf_release(&new_sig->data); > free(new_sig->hash_algo); > @@ -2845,15 +2845,15 @@ static void parse_new_commit(const char *arg) > read_next_command(); > } > if (!committer) > - die("Expected committer but didn't get one"); > + die(_("expected committer but didn't get one")); > > while (skip_prefix(command_buf.buf, "gpgsig ", &v)) { > switch (signed_commit_mode) { > > /* First, modes that don't need the signature to be parsed */ > case SIGN_ABORT: > - die("encountered signed commit; use " > - "--signed-commits=<mode> to handle it"); > + die(_("encountered signed commit; use " > + "--signed-commits=<mode> to handle it")); > case SIGN_WARN_STRIP: > warning(_("stripping a commit signature")); > /* fallthru */ > @@ -3025,11 +3025,11 @@ static void parse_new_tag(const char *arg) > > /* from ... */ > if (!skip_prefix(command_buf.buf, "from ", &from)) > - die("Expected from command, got %s", command_buf.buf); > + die(_("expected 'from' command, got '%s'"), command_buf.buf); > s = lookup_branch(from); > if (s) { > if (is_null_oid(&s->oid)) > - die("Can't tag an empty branch."); > + die(_("can't tag an empty branch.")); > oidcpy(&oid, &s->oid); > type = OBJ_COMMIT; > } else if (*from == ':') { > @@ -3044,11 +3044,11 @@ static void parse_new_tag(const char *arg) > type = odb_read_object_info(the_repository->objects, > &oid, NULL); > if (type < 0) > - die("Not a valid object: %s", from); > + die(_("not a valid object: %s"), from); > } else > type = oe->type; > } else > - die("Invalid ref name or SHA1 expression: %s", from); > + die(_("invalid ref name or SHA1 expression: %s"), from); > read_next_command(); > > /* original-oid ... */ > @@ -3139,7 +3139,7 @@ static void parse_reset_branch(const char *arg) > static void cat_blob_write(const char *buf, unsigned long size) > { > if (write_in_full(cat_blob_fd, buf, size) < 0) > - die_errno("Write to frontend failed"); > + die_errno(_("write to frontend failed")); > } > > static void cat_blob(struct object_entry *oe, struct object_id *oid) > @@ -3168,9 +3168,9 @@ static void cat_blob(struct object_entry *oe, struct object_id *oid) > return; > } > if (!buf) > - die("Can't read object %s", oid_to_hex(oid)); > + die(_("can't read object %s"), oid_to_hex(oid)); > if (type != OBJ_BLOB) > - die("Object %s is a %s but a blob was expected.", > + die(_("object %s is a %s but a blob was expected."), > oid_to_hex(oid), type_name(type)); > strbuf_reset(&line); > strbuf_addf(&line, "%s %s %"PRIuMAX"\n", oid_to_hex(oid), > @@ -3194,11 +3194,11 @@ static void parse_get_mark(const char *p) > > /* get-mark SP <object> LF */ > if (*p != ':') > - die("Not a mark: %s", p); > + die(_("not a mark: %s"), p); > > oe = find_mark(marks, parse_mark_ref_eol(p)); > if (!oe) > - die("Unknown mark: %s", command_buf.buf); > + die(_("unknown mark: %s"), command_buf.buf); > > xsnprintf(output, sizeof(output), "%s\n", oid_to_hex(&oe->idx.oid)); > cat_blob_write(output, the_hash_algo->hexsz + 1); > @@ -3213,13 +3213,13 @@ static void parse_cat_blob(const char *p) > if (*p == ':') { > oe = find_mark(marks, parse_mark_ref_eol(p)); > if (!oe) > - die("Unknown mark: %s", command_buf.buf); > + die(_("unknown mark: %s"), command_buf.buf); > oidcpy(&oid, &oe->idx.oid); > } else { > if (parse_mapped_oid_hex(p, &oid, &p)) > - die("Invalid dataref: %s", command_buf.buf); > + die(_("invalid dataref: %s"), command_buf.buf); > if (*p) > - die("Garbage after SHA1: %s", command_buf.buf); > + die(_("garbage after SHA1: %s"), command_buf.buf); > oe = find_object(&oid); > } > > @@ -3237,7 +3237,7 @@ static struct object_entry *dereference(struct object_entry *oe, > enum object_type type = odb_read_object_info(the_repository->objects, > oid, NULL); > if (type < 0) > - die("object not found: %s", oid_to_hex(oid)); > + die(_("object not found: %s"), oid_to_hex(oid)); > /* cache it! */ > oe = insert_object(oid); > oe->type = type; > @@ -3251,7 +3251,7 @@ static struct object_entry *dereference(struct object_entry *oe, > case OBJ_TAG: > break; > default: > - die("Not a tree-ish: %s", command_buf.buf); > + die(_("not a tree-ish: %s"), command_buf.buf); > } > > if (oe->pack_id != MAX_PACK_ID) { /* in a pack being written */ > @@ -3262,19 +3262,19 @@ static struct object_entry *dereference(struct object_entry *oe, > &unused, &size); > } > if (!buf) > - die("Can't load object %s", oid_to_hex(oid)); > + die(_("can't load object %s"), oid_to_hex(oid)); > > /* Peel one layer. */ > switch (oe->type) { > case OBJ_TAG: > if (size < hexsz + strlen("object ") || > get_oid_hex(buf + strlen("object "), oid)) > - die("Invalid SHA1 in tag: %s", command_buf.buf); > + die(_("invalid SHA1 in tag: %s"), command_buf.buf); > break; > case OBJ_COMMIT: > if (size < hexsz + strlen("tree ") || > get_oid_hex(buf + strlen("tree "), oid)) > - die("Invalid SHA1 in commit: %s", command_buf.buf); > + die(_("invalid SHA1 in commit: %s"), command_buf.buf); > } > > free(buf); > @@ -3309,9 +3309,9 @@ static void build_mark_map(struct string_list *from, struct string_list *to) > for_each_string_list_item(fromp, from) { > top = string_list_lookup(to, fromp->string); > if (!fromp->util) { > - die(_("Missing from marks for submodule '%s'"), fromp->string); > + die(_("missing from marks for submodule '%s'"), fromp->string); > } else if (!top || !top->util) { > - die(_("Missing to marks for submodule '%s'"), fromp->string); > + die(_("missing to marks for submodule '%s'"), fromp->string); > } > build_mark_map_one(fromp->util, top->util); > } > @@ -3325,14 +3325,14 @@ static struct object_entry *parse_treeish_dataref(const char **p) > if (**p == ':') { /* <mark> */ > e = find_mark(marks, parse_mark_ref_space(p)); > if (!e) > - die("Unknown mark: %s", command_buf.buf); > + die(_("unknown mark: %s"), command_buf.buf); > oidcpy(&oid, &e->idx.oid); > } else { /* <sha1> */ > if (parse_mapped_oid_hex(*p, &oid, p)) > - die("Invalid dataref: %s", command_buf.buf); > + die(_("invalid dataref: %s"), command_buf.buf); > e = find_object(&oid); > if (*(*p)++ != ' ') > - die("Missing space after tree-ish: %s", command_buf.buf); > + die(_("missing space after tree-ish: %s"), command_buf.buf); > } > > while (!e || e->type != OBJ_TREE) > @@ -3376,7 +3376,7 @@ static void parse_ls(const char *p, struct branch *b) > /* ls SP (<tree-ish> SP)? <path> */ > if (*p == '"') { > if (!b) > - die("Not in a commit: %s", command_buf.buf); > + die(_("not in a commit: %s"), command_buf.buf); > root = &b->branch_tree; > } else { > struct object_entry *e = parse_treeish_dataref(&p); > @@ -3439,12 +3439,12 @@ static void parse_alias(void) > /* mark ... */ > parse_mark(); > if (!next_mark) > - die(_("Expected 'mark' command, got %s"), command_buf.buf); > + die(_("expected 'mark' command, got %s"), command_buf.buf); > > /* to ... */ > memset(&b, 0, sizeof(b)); > if (!parse_objectish_with_prefix(&b, "to ")) > - die(_("Expected 'to' command, got %s"), command_buf.buf); > + die(_("expected 'to' command, got %s"), command_buf.buf); > e = find_object(&b.oid); > assert(e); > insert_mark(&marks, next_mark, e); > @@ -3462,7 +3462,7 @@ static void option_import_marks(const char *marks, > { > if (import_marks_file) { > if (from_stream) > - die("Only one import-marks command allowed per stream"); > + die(_("only one import-marks command allowed per stream")); > > /* read previous mark file */ > if(!import_marks_file_from_stream) > @@ -3486,7 +3486,7 @@ static void option_date_format(const char *fmt) > else if (!strcmp(fmt, "now")) > whenspec = WHENSPEC_NOW; > else > - die("unknown --date-format argument %s", fmt); > + die(_("unknown --date-format argument %s"), fmt); > } > > static unsigned long ulong_arg(const char *option, const char *arg) > @@ -3494,7 +3494,7 @@ static unsigned long ulong_arg(const char *option, const char *arg) > char *endptr; > unsigned long rv = strtoul(arg, &endptr, 0); > if (strchr(arg, '-') || endptr == arg || *endptr) > - die("%s: argument must be a non-negative integer", option); > + die(_("%s: argument must be a non-negative integer"), option); > return rv; > } > > @@ -3502,7 +3502,7 @@ static void option_depth(const char *depth) > { > max_depth = ulong_arg("--depth", depth); > if (max_depth > MAX_DEPTH) > - die("--depth cannot exceed %u", MAX_DEPTH); > + die(_("--depth cannot exceed %u"), MAX_DEPTH); > } > > static void option_active_branches(const char *branches) > @@ -3520,7 +3520,7 @@ static void option_cat_blob_fd(const char *fd) > { > unsigned long n = ulong_arg("--cat-blob-fd", fd); > if (n > (unsigned long) INT_MAX) > - die("--cat-blob-fd cannot exceed %d", INT_MAX); > + die(_("--cat-blob-fd cannot exceed %d"), INT_MAX); > cat_blob_fd = (int) n; > } > > @@ -3540,7 +3540,7 @@ static void option_rewrite_submodules(const char *arg, struct string_list *list) > char *s = xstrdup(arg); > char *f = strchr(s, ':'); > if (!f) > - die(_("Expected format name:filename for submodule rewrite option")); > + die(_("expected format name:filename for submodule rewrite option")); > *f = '\0'; > f++; > CALLOC_ARRAY(ms, 1); > @@ -3548,7 +3548,7 @@ static void option_rewrite_submodules(const char *arg, struct string_list *list) > f = prefix_filename(global_prefix, f); > fp = fopen(f, "r"); > if (!fp) > - die_errno("cannot read '%s'", f); > + die_errno(_("cannot read '%s'"), f); > read_mark_file(&ms, fp, insert_oid_entry); > fclose(fp); > free(f); > @@ -3565,10 +3565,10 @@ static int parse_one_option(const char *option) > if (!git_parse_ulong(option, &v)) > return 0; > if (v < 8192) { > - warning("max-pack-size is now in bytes, assuming --max-pack-size=%lum", v); > + warning(_("max-pack-size is now in bytes, assuming --max-pack-size=%lum"), v); > v *= 1024 * 1024; > } else if (v < 1024 * 1024) { > - warning("minimum max-pack-size is 1 MiB"); > + warning(_("minimum max-pack-size is 1 MiB")); > v = 1024 * 1024; > } > max_packsize = v; > @@ -3655,23 +3655,23 @@ static int parse_one_feature(const char *feature, int from_stream) > static void parse_feature(const char *feature) > { > if (seen_data_command) > - die("Got feature command '%s' after data command", feature); > + die(_("got feature command '%s' after data command"), feature); > > if (parse_one_feature(feature, 1)) > return; > > - die("This version of fast-import does not support feature %s.", feature); > + die(_("this version of fast-import does not support feature %s."), feature); > } > > static void parse_option(const char *option) > { > if (seen_data_command) > - die("Got option command '%s' after data command", option); > + die(_("got option command '%s' after data command"), option); > > if (parse_one_option(option)) > return; > > - die("This version of fast-import does not support option: %s", option); > + die(_("this version of fast-import does not support option: %s"), option); > } > > static void git_pack_config(void) > @@ -3715,7 +3715,7 @@ static void parse_argv(void) > break; > > if (!skip_prefix(a, "--", &a)) > - die("unknown option %s", a); > + die(_("unknown option %s"), a); > > if (parse_one_option(a)) > continue; > @@ -3728,7 +3728,7 @@ static void parse_argv(void) > continue; > } > > - die("unknown option --%s", a); > + die(_("unknown option --%s"), a); > } > if (i != global_argc) > usage(fast_import_usage); > @@ -3817,7 +3817,7 @@ int cmd_fast_import(int argc, > else if (starts_with(command_buf.buf, "option ")) > /* ignore non-git options*/; > else > - die("Unsupported command: %s", command_buf.buf); > + die(_("unsupported command: %s"), command_buf.buf); > > if (checkpoint_requested) > checkpoint(); > @@ -3828,7 +3828,7 @@ int cmd_fast_import(int argc, > parse_argv(); > > if (require_explicit_termination && feof(stdin)) > - die("stream ends early"); > + die(_("stream ends early")); > > end_packfile(); > > diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh > index 4dc3d645bf..5685cce6fe 100755 > --- a/t/t9300-fast-import.sh > +++ b/t/t9300-fast-import.sh > @@ -2927,16 +2927,16 @@ test_expect_success 'R: blob appears only once' ' > # The error message when a space is missing not at the > # end of the line is: > # > -# Missing space after .. > +# missing space after .. > # > # or when extra characters come after the mark at the end > # of the line: > # > -# Garbage after .. > +# garbage after .. > # > # or when the dataref is neither "inline " or a known SHA1, > # > -# Invalid dataref .. > +# invalid dataref .. > # > test_expect_success 'S: initialize for S tests' ' > test_tick && > @@ -3405,15 +3405,15 @@ test_path_fail () { > > test_path_base_fail () { > local change="$1" prefix="$2" field="$3" suffix="$4" > - test_path_fail "$change" 'unclosed " in '"$field" "$prefix" '"hello.c' "$suffix" "Invalid $field" > - test_path_fail "$change" "invalid escape in quoted $field" "$prefix" '"hello\xff"' "$suffix" "Invalid $field" > + test_path_fail "$change" 'unclosed " in '"$field" "$prefix" '"hello.c' "$suffix" "invalid $field" > + test_path_fail "$change" "invalid escape in quoted $field" "$prefix" '"hello\xff"' "$suffix" "invalid $field" > test_path_fail "$change" "escaped NUL in quoted $field" "$prefix" '"hello\000"' "$suffix" "NUL in $field" > } > test_path_eol_quoted_fail () { > local change="$1" prefix="$2" field="$3" > test_path_base_fail "$change" "$prefix" "$field" '' > - test_path_fail "$change" "garbage after quoted $field" "$prefix" '"hello.c"' 'x' "Garbage after $field" > - test_path_fail "$change" "space after quoted $field" "$prefix" '"hello.c"' ' ' "Garbage after $field" > + test_path_fail "$change" "garbage after quoted $field" "$prefix" '"hello.c"' 'x' "garbage after $field" > + test_path_fail "$change" "space after quoted $field" "$prefix" '"hello.c"' ' ' "garbage after $field" > } > test_path_eol_fail () { > local change="$1" prefix="$2" field="$3" > @@ -3422,8 +3422,8 @@ test_path_eol_fail () { > test_path_space_fail () { > local change="$1" prefix="$2" field="$3" > test_path_base_fail "$change" "$prefix" "$field" ' world.c' > - test_path_fail "$change" "missing space after quoted $field" "$prefix" '"hello.c"' 'x world.c' "Missing space after $field" > - test_path_fail "$change" "missing space after unquoted $field" "$prefix" 'hello.c' '' "Missing space after $field" > + test_path_fail "$change" "missing space after quoted $field" "$prefix" '"hello.c"' 'x world.c' "missing space after $field" > + test_path_fail "$change" "missing space after unquoted $field" "$prefix" 'hello.c' '' "missing space after $field" > } > > test_path_eol_fail filemodify 'M 100644 :1 ' path > @@ -3820,7 +3820,7 @@ test_expect_success 'X: replace ref that becomes useless is removed' ' > sed -e s/othername/somename/ tmp >tmp2 && > git fast-import --force <tmp2 2>msgs && > > - grep "Dropping.*since it would point to itself" msgs && > + grep "dropping.*since it would point to itself" msgs && > git show-ref >refs && > ! grep refs/replace refs > ) > -- > 2.51.2.617.g2aaa867cd1 > ^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 5/5] gpg-interface: mark a string for translation 2025-10-30 12:33 ` [PATCH v2 0/5] fast-export/import: cleanups and translation Christian Couder ` (3 preceding siblings ...) 2025-10-30 12:33 ` [PATCH v2 4/5] fast-import: " Christian Couder @ 2025-10-30 12:33 ` Christian Couder 2025-10-30 18:14 ` [PATCH v2 0/5] fast-export/import: cleanups and translation Junio C Hamano 2025-10-31 19:37 ` Elijah Newren 6 siblings, 0 replies; 22+ messages in thread From: Christian Couder @ 2025-10-30 12:33 UTC (permalink / raw) To: git Cc: Junio C Hamano, Patrick Steinhardt, Elijah Newren, Jeff King, brian m . carlson, Johannes Schindelin, Christian Couder, Christian Couder Previous commits have marked a number of error or warning messages in "builtin/fast-export.c" and "builtin/fast-import.c" for translation. As "gpg-interface.c" code is used by the fast-export and fast-import code, we should make sure that error or warning messages are also all marked for translation in "gpg-interface.c". To ensure that, let's mark for translation an error message in a die() function. With this, all the error and warning messages emitted by fast-export and fast-import can be properly translated. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> --- gpg-interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gpg-interface.c b/gpg-interface.c index 91d1b58cb4..6b895f83ed 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -876,7 +876,7 @@ static char *get_default_ssh_signing_key(void) n = split_cmdline(key_command, &argv); if (n < 0) - die("malformed build-time gpg.ssh.defaultKeyCommand: %s", + die(_("malformed build-time gpg.ssh.defaultKeyCommand: %s"), split_cmdline_strerror(n)); strvec_pushv(&ssh_default_key.args, argv); -- 2.51.2.617.g2aaa867cd1 ^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH v2 0/5] fast-export/import: cleanups and translation 2025-10-30 12:33 ` [PATCH v2 0/5] fast-export/import: cleanups and translation Christian Couder ` (4 preceding siblings ...) 2025-10-30 12:33 ` [PATCH v2 5/5] gpg-interface: mark a string " Christian Couder @ 2025-10-30 18:14 ` Junio C Hamano 2025-10-31 19:37 ` Elijah Newren 6 siblings, 0 replies; 22+ messages in thread From: Junio C Hamano @ 2025-10-30 18:14 UTC (permalink / raw) To: Christian Couder Cc: git, Patrick Steinhardt, Elijah Newren, Jeff King, brian m . carlson, Johannes Schindelin Christian Couder <christian.couder@gmail.com> writes: > There are only small changes in patches 3/5 and 4/5. Mostly some > uppercase letters at the start of error and warning messages have been > downcased according to our style. > > In patch 3/5, an error message that started with "Error: " has been > changed to remove that part. > > In patch 4/5, some tests in "t9300-fast-import.sh" had to be adjusted > because they were testing error or warning messages where the first > letter was downcased. > > The commit messages of patches 3/5 and 4/5 have also been adjusted to > mention these changes. Thanks, looking good. ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 0/5] fast-export/import: cleanups and translation 2025-10-30 12:33 ` [PATCH v2 0/5] fast-export/import: cleanups and translation Christian Couder ` (5 preceding siblings ...) 2025-10-30 18:14 ` [PATCH v2 0/5] fast-export/import: cleanups and translation Junio C Hamano @ 2025-10-31 19:37 ` Elijah Newren 2025-11-01 15:16 ` Christian Couder 6 siblings, 1 reply; 22+ messages in thread From: Elijah Newren @ 2025-10-31 19:37 UTC (permalink / raw) To: Christian Couder Cc: git, Junio C Hamano, Patrick Steinhardt, Jeff King, brian m . carlson, Johannes Schindelin On Thu, Oct 30, 2025 at 5:33 AM Christian Couder <christian.couder@gmail.com> wrote: > > > Introduction > ------------ > > In a previous v2 patch series[1] that I sent last May, there were two > preparatory cleanup patches[2][3] that have been dropped in the v3 and > next versions. I think these two cleanup patches are worth resending > in their own series though. > > While at cleaning things up, I realized that, when working in this > area of the code, I have often been annoyed by the fact that few error > and warning messages were marked for translation. So I decided to also > address this here. > > So patches 1/5 and 2/5 are small code cleanups that are resent, while > patches 3/5, 4/5 and 5/5 are about marking strings for translation. > > [1] https://lore.kernel.org/git/20250526103314.1542316-1-christian.couder@gmail.com/ > [2] https://lore.kernel.org/git/20250526103314.1542316-2-christian.couder@gmail.com/ > [3] https://lore.kernel.org/git/20250526103314.1542316-3-christian.couder@gmail.com/ These all look like simple sensible fixes to me. The only problem I found looking over the patch is that you undersell the benefits of one of the changes in the commit message, but that's not even really a problem. Series looks good to me. ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 0/5] fast-export/import: cleanups and translation 2025-10-31 19:37 ` Elijah Newren @ 2025-11-01 15:16 ` Christian Couder 0 siblings, 0 replies; 22+ messages in thread From: Christian Couder @ 2025-11-01 15:16 UTC (permalink / raw) To: Elijah Newren Cc: git, Junio C Hamano, Patrick Steinhardt, Jeff King, brian m . carlson, Johannes Schindelin On Fri, Oct 31, 2025 at 8:37 PM Elijah Newren <newren@gmail.com> wrote: > These all look like simple sensible fixes to me. The only problem I > found looking over the patch is that you undersell the benefits of one > of the changes in the commit message, but that's not even really a > problem. > > Series looks good to me. Thanks for your review! ^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2025-11-01 15:16 UTC | newest] Thread overview: 22+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-10-28 8:12 [PATCH 0/5] fast-export/import: cleanups and translation Christian Couder 2025-10-28 8:12 ` [PATCH 1/5] gpg-interface: simplify ssh fingerprint parsing Christian Couder 2025-10-28 16:45 ` Junio C Hamano 2025-10-28 8:12 ` [PATCH 2/5] gpg-interface: use left shift to define GPG_VERIFY_* Christian Couder 2025-10-28 8:12 ` [PATCH 3/5] fast-export: mark strings for translation Christian Couder 2025-10-28 13:43 ` Junio C Hamano 2025-10-29 14:29 ` Christian Couder 2025-10-29 16:12 ` Junio C Hamano 2025-10-30 12:39 ` Christian Couder 2025-10-28 8:12 ` [PATCH 4/5] fast-import: " Christian Couder 2025-10-28 16:46 ` Junio C Hamano 2025-10-28 8:12 ` [PATCH 5/5] gpg-interface: mark a string " Christian Couder 2025-10-30 12:33 ` [PATCH v2 0/5] fast-export/import: cleanups and translation Christian Couder 2025-10-30 12:33 ` [PATCH v2 1/5] gpg-interface: simplify ssh fingerprint parsing Christian Couder 2025-10-30 12:33 ` [PATCH v2 2/5] gpg-interface: use left shift to define GPG_VERIFY_* Christian Couder 2025-10-30 12:33 ` [PATCH v2 3/5] fast-export: mark strings for translation Christian Couder 2025-10-30 12:33 ` [PATCH v2 4/5] fast-import: " Christian Couder 2025-10-31 19:35 ` Elijah Newren 2025-10-30 12:33 ` [PATCH v2 5/5] gpg-interface: mark a string " Christian Couder 2025-10-30 18:14 ` [PATCH v2 0/5] fast-export/import: cleanups and translation Junio C Hamano 2025-10-31 19:37 ` Elijah Newren 2025-11-01 15:16 ` Christian Couder
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).