Merge branch 'nd/i18n'

Many more strings are prepared for l10n.

* nd/i18n: (23 commits)
  transport-helper.c: mark more strings for translation
  transport.c: mark more strings for translation
  sha1-file.c: mark more strings for translation
  sequencer.c: mark more strings for translation
  replace-object.c: mark more strings for translation
  refspec.c: mark more strings for translation
  refs.c: mark more strings for translation
  pkt-line.c: mark more strings for translation
  object.c: mark more strings for translation
  exec-cmd.c: mark more strings for translation
  environment.c: mark more strings for translation
  dir.c: mark more strings for translation
  convert.c: mark more strings for translation
  connect.c: mark more strings for translation
  config.c: mark more strings for translation
  commit-graph.c: mark more strings for translation
  builtin/replace.c: mark more strings for translation
  builtin/pack-objects.c: mark more strings for translation
  builtin/grep.c: mark strings for translation
  builtin/config.c: mark more strings for translation
  ...
This commit is contained in:
Junio C Hamano 2018-08-15 15:08:23 -07:00
commit 4bea8485e3
47 changed files with 502 additions and 483 deletions

View File

@ -122,7 +122,7 @@ static int stream_blocked(const struct object_id *oid)
st = open_istream(oid, &type, &sz, NULL); st = open_istream(oid, &type, &sz, NULL);
if (!st) if (!st)
return error("cannot stream blob %s", oid_to_hex(oid)); return error(_("cannot stream blob %s"), oid_to_hex(oid));
for (;;) { for (;;) {
readlen = read_istream(st, buf, sizeof(buf)); readlen = read_istream(st, buf, sizeof(buf));
if (readlen <= 0) if (readlen <= 0)
@ -257,7 +257,7 @@ static int write_tar_entry(struct archiver_args *args,
*header.typeflag = TYPEFLAG_REG; *header.typeflag = TYPEFLAG_REG;
mode = (mode | ((mode & 0100) ? 0777 : 0666)) & ~tar_umask; mode = (mode | ((mode & 0100) ? 0777 : 0666)) & ~tar_umask;
} else { } else {
return error("unsupported file mode: 0%o (SHA1: %s)", return error(_("unsupported file mode: 0%o (SHA1: %s)"),
mode, oid_to_hex(oid)); mode, oid_to_hex(oid));
} }
if (pathlen > sizeof(header.name)) { if (pathlen > sizeof(header.name)) {
@ -284,7 +284,7 @@ static int write_tar_entry(struct archiver_args *args,
enum object_type type; enum object_type type;
buffer = object_file_to_archive(args, path, oid, old_mode, &type, &size); buffer = object_file_to_archive(args, path, oid, old_mode, &type, &size);
if (!buffer) if (!buffer)
return error("cannot read %s", oid_to_hex(oid)); return error(_("cannot read %s"), oid_to_hex(oid));
} else { } else {
buffer = NULL; buffer = NULL;
size = 0; size = 0;
@ -455,17 +455,17 @@ static int write_tar_filter_archive(const struct archiver *ar,
filter.in = -1; filter.in = -1;
if (start_command(&filter) < 0) if (start_command(&filter) < 0)
die_errno("unable to start '%s' filter", argv[0]); die_errno(_("unable to start '%s' filter"), argv[0]);
close(1); close(1);
if (dup2(filter.in, 1) < 0) if (dup2(filter.in, 1) < 0)
die_errno("unable to redirect descriptor"); die_errno(_("unable to redirect descriptor"));
close(filter.in); close(filter.in);
r = write_tar_archive(ar, args); r = write_tar_archive(ar, args);
close(1); close(1);
if (finish_command(&filter) != 0) if (finish_command(&filter) != 0)
die("'%s' filter reported error", argv[0]); die(_("'%s' filter reported error"), argv[0]);
strbuf_release(&cmd); strbuf_release(&cmd);
return r; return r;

View File

@ -310,11 +310,11 @@ static int write_zip_entry(struct archiver_args *args,
if (is_utf8(path)) if (is_utf8(path))
flags |= ZIP_UTF8; flags |= ZIP_UTF8;
else else
warning("Path is not valid UTF-8: %s", path); warning(_("path is not valid UTF-8: %s"), path);
} }
if (pathlen > 0xffff) { if (pathlen > 0xffff) {
return error("path too long (%d chars, SHA1: %s): %s", return error(_("path too long (%d chars, SHA1: %s): %s"),
(int)pathlen, oid_to_hex(oid), path); (int)pathlen, oid_to_hex(oid), path);
} }
@ -341,7 +341,7 @@ static int write_zip_entry(struct archiver_args *args,
size > big_file_threshold) { size > big_file_threshold) {
stream = open_istream(oid, &type, &size, NULL); stream = open_istream(oid, &type, &size, NULL);
if (!stream) if (!stream)
return error("cannot stream blob %s", return error(_("cannot stream blob %s"),
oid_to_hex(oid)); oid_to_hex(oid));
flags |= ZIP_STREAM; flags |= ZIP_STREAM;
out = buffer = NULL; out = buffer = NULL;
@ -349,7 +349,7 @@ static int write_zip_entry(struct archiver_args *args,
buffer = object_file_to_archive(args, path, oid, mode, buffer = object_file_to_archive(args, path, oid, mode,
&type, &size); &type, &size);
if (!buffer) if (!buffer)
return error("cannot read %s", return error(_("cannot read %s"),
oid_to_hex(oid)); oid_to_hex(oid));
crc = crc32(crc, buffer, size); crc = crc32(crc, buffer, size);
is_binary = entry_is_binary(path_without_prefix, is_binary = entry_is_binary(path_without_prefix,
@ -358,7 +358,7 @@ static int write_zip_entry(struct archiver_args *args,
} }
compressed_size = (method == 0) ? size : 0; compressed_size = (method == 0) ? size : 0;
} else { } else {
return error("unsupported file mode: 0%o (SHA1: %s)", mode, return error(_("unsupported file mode: 0%o (SHA1: %s)"), mode,
oid_to_hex(oid)); oid_to_hex(oid));
} }
@ -467,7 +467,7 @@ static int write_zip_entry(struct archiver_args *args,
zstream.avail_in = readlen; zstream.avail_in = readlen;
result = git_deflate(&zstream, 0); result = git_deflate(&zstream, 0);
if (result != Z_OK) if (result != Z_OK)
die("deflate error (%d)", result); die(_("deflate error (%d)"), result);
out_len = zstream.next_out - compressed; out_len = zstream.next_out - compressed;
if (out_len > 0) { if (out_len > 0) {
@ -602,7 +602,7 @@ static void dos_time(timestamp_t *timestamp, int *dos_date, int *dos_time)
struct tm *t; struct tm *t;
if (date_overflows(*timestamp)) if (date_overflows(*timestamp))
die("timestamp too large for this system: %"PRItime, die(_("timestamp too large for this system: %"PRItime),
*timestamp); *timestamp);
time = (time_t)*timestamp; time = (time_t)*timestamp;
t = localtime(&time); t = localtime(&time);

View File

@ -410,7 +410,7 @@ static void parse_color_fields(const char *s)
} }
if (next == EXPECT_COLOR) if (next == EXPECT_COLOR)
die (_("must end with a color")); die(_("must end with a color"));
colorfield[colorfield_nr].hop = TIME_MAX; colorfield[colorfield_nr].hop = TIME_MAX;
string_list_clear(&l, 0); string_list_clear(&l, 0);

View File

@ -1198,12 +1198,12 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
if (opts.track != BRANCH_TRACK_UNSPECIFIED && !opts.new_branch) { if (opts.track != BRANCH_TRACK_UNSPECIFIED && !opts.new_branch) {
const char *argv0 = argv[0]; const char *argv0 = argv[0];
if (!argc || !strcmp(argv0, "--")) if (!argc || !strcmp(argv0, "--"))
die (_("--track needs a branch name")); die(_("--track needs a branch name"));
skip_prefix(argv0, "refs/", &argv0); skip_prefix(argv0, "refs/", &argv0);
skip_prefix(argv0, "remotes/", &argv0); skip_prefix(argv0, "remotes/", &argv0);
argv0 = strchr(argv0, '/'); argv0 = strchr(argv0, '/');
if (!argv0 || !argv0[1]) if (!argv0 || !argv0[1])
die (_("Missing branch name; try -b")); die(_("missing branch name; try -b"));
opts.new_branch = argv0 + 1; opts.new_branch = argv0 + 1;
} }

View File

@ -1647,9 +1647,9 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
unlink(git_path_squash_msg(the_repository)); unlink(git_path_squash_msg(the_repository));
if (commit_index_files()) if (commit_index_files())
die (_("Repository has been updated, but unable to write\n" die(_("repository has been updated, but unable to write\n"
"new_index file. Check that disk is not full and quota is\n" "new_index file. Check that disk is not full and quota is\n"
"not exceeded, and then \"git reset HEAD\" to recover.")); "not exceeded, and then \"git reset HEAD\" to recover."));
rerere(0); rerere(0);
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD); run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);

View File

@ -110,7 +110,7 @@ static int option_parse_type(const struct option *opt, const char *arg,
* --int' and '--type=bool * --int' and '--type=bool
* --type=int'. * --type=int'.
*/ */
error("only one type at a time."); error(_("only one type at a time"));
usage_builtin_config(); usage_builtin_config();
} }
*to_type = new_type; *to_type = new_type;
@ -164,7 +164,11 @@ static NORETURN void usage_builtin_config(void)
static void check_argc(int argc, int min, int max) { static void check_argc(int argc, int min, int max) {
if (argc >= min && argc <= max) if (argc >= min && argc <= max)
return; return;
error("wrong number of arguments"); if (min == max)
error(_("wrong number of arguments, should be %d"), min);
else
error(_("wrong number of arguments, should be from %d to %d"),
min, max);
usage_builtin_config(); usage_builtin_config();
} }
@ -297,7 +301,7 @@ static int get_value(const char *key_, const char *regex_)
key_regexp = (regex_t*)xmalloc(sizeof(regex_t)); key_regexp = (regex_t*)xmalloc(sizeof(regex_t));
if (regcomp(key_regexp, key, REG_EXTENDED)) { if (regcomp(key_regexp, key, REG_EXTENDED)) {
error("invalid key pattern: %s", key_); error(_("invalid key pattern: %s"), key_);
FREE_AND_NULL(key_regexp); FREE_AND_NULL(key_regexp);
ret = CONFIG_INVALID_PATTERN; ret = CONFIG_INVALID_PATTERN;
goto free_strings; goto free_strings;
@ -317,7 +321,7 @@ static int get_value(const char *key_, const char *regex_)
regexp = (regex_t*)xmalloc(sizeof(regex_t)); regexp = (regex_t*)xmalloc(sizeof(regex_t));
if (regcomp(regexp, regex_, REG_EXTENDED)) { if (regcomp(regexp, regex_, REG_EXTENDED)) {
error("invalid pattern: %s", regex_); error(_("invalid pattern: %s"), regex_);
FREE_AND_NULL(regexp); FREE_AND_NULL(regexp);
ret = CONFIG_INVALID_PATTERN; ret = CONFIG_INVALID_PATTERN;
goto free_strings; goto free_strings;
@ -390,7 +394,7 @@ static char *normalize_value(const char *key, const char *value)
if (type == TYPE_COLOR) { if (type == TYPE_COLOR) {
char v[COLOR_MAXLEN]; char v[COLOR_MAXLEN];
if (git_config_color(v, key, value)) if (git_config_color(v, key, value))
die("cannot parse color '%s'", value); die(_("cannot parse color '%s'"), value);
/* /*
* The contents of `v` now contain an ANSI escape * The contents of `v` now contain an ANSI escape
@ -485,13 +489,13 @@ static int get_colorbool(const char *var, int print)
static void check_write(void) static void check_write(void)
{ {
if (!given_config_source.file && !startup_info->have_repository) if (!given_config_source.file && !startup_info->have_repository)
die("not in a git directory"); die(_("not in a git directory"));
if (given_config_source.use_stdin) if (given_config_source.use_stdin)
die("writing to stdin is not supported"); die(_("writing to stdin is not supported"));
if (given_config_source.blob) if (given_config_source.blob)
die("writing config blobs is not supported"); die(_("writing config blobs is not supported"));
} }
struct urlmatch_current_candidate_value { struct urlmatch_current_candidate_value {
@ -599,7 +603,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
if (use_global_config + use_system_config + use_local_config + if (use_global_config + use_system_config + use_local_config +
!!given_config_source.file + !!given_config_source.blob > 1) { !!given_config_source.file + !!given_config_source.blob > 1) {
error("only one config file at a time."); error(_("only one config file at a time"));
usage_builtin_config(); usage_builtin_config();
} }
@ -626,7 +630,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
* location; error out even if XDG_CONFIG_HOME * location; error out even if XDG_CONFIG_HOME
* is set and points at a sane location. * is set and points at a sane location.
*/ */
die("$HOME not set"); die(_("$HOME not set"));
if (access_or_warn(user_config, R_OK, 0) && if (access_or_warn(user_config, R_OK, 0) &&
xdg_config && !access_or_warn(xdg_config, R_OK, 0)) { xdg_config && !access_or_warn(xdg_config, R_OK, 0)) {
@ -663,12 +667,12 @@ int cmd_config(int argc, const char **argv, const char *prefix)
} }
if ((actions & (ACTION_GET_COLOR|ACTION_GET_COLORBOOL)) && type) { if ((actions & (ACTION_GET_COLOR|ACTION_GET_COLORBOOL)) && type) {
error("--get-color and variable type are incoherent"); error(_("--get-color and variable type are incoherent"));
usage_builtin_config(); usage_builtin_config();
} }
if (HAS_MULTI_BITS(actions)) { if (HAS_MULTI_BITS(actions)) {
error("only one action at a time."); error(_("only one action at a time"));
usage_builtin_config(); usage_builtin_config();
} }
if (actions == 0) if (actions == 0)
@ -681,19 +685,19 @@ int cmd_config(int argc, const char **argv, const char *prefix)
} }
if (omit_values && if (omit_values &&
!(actions == ACTION_LIST || actions == ACTION_GET_REGEXP)) { !(actions == ACTION_LIST || actions == ACTION_GET_REGEXP)) {
error("--name-only is only applicable to --list or --get-regexp"); error(_("--name-only is only applicable to --list or --get-regexp"));
usage_builtin_config(); usage_builtin_config();
} }
if (show_origin && !(actions & if (show_origin && !(actions &
(ACTION_GET|ACTION_GET_ALL|ACTION_GET_REGEXP|ACTION_LIST))) { (ACTION_GET|ACTION_GET_ALL|ACTION_GET_REGEXP|ACTION_LIST))) {
error("--show-origin is only applicable to --get, --get-all, " error(_("--show-origin is only applicable to --get, --get-all, "
"--get-regexp, and --list."); "--get-regexp, and --list"));
usage_builtin_config(); usage_builtin_config();
} }
if (default_value && !(actions & ACTION_GET)) { if (default_value && !(actions & ACTION_GET)) {
error("--default is only applicable to --get"); error(_("--default is only applicable to --get"));
usage_builtin_config(); usage_builtin_config();
} }
@ -706,10 +710,10 @@ int cmd_config(int argc, const char **argv, const char *prefix)
&given_config_source, &given_config_source,
&config_options) < 0) { &config_options) < 0) {
if (given_config_source.file) if (given_config_source.file)
die_errno("unable to read config file '%s'", die_errno(_("unable to read config file '%s'"),
given_config_source.file); given_config_source.file);
else else
die("error processing config file(s)"); die(_("error processing config file(s)"));
} }
} }
else if (actions == ACTION_EDIT) { else if (actions == ACTION_EDIT) {
@ -717,11 +721,11 @@ int cmd_config(int argc, const char **argv, const char *prefix)
check_argc(argc, 0, 0); check_argc(argc, 0, 0);
if (!given_config_source.file && nongit) if (!given_config_source.file && nongit)
die("not in a git directory"); die(_("not in a git directory"));
if (given_config_source.use_stdin) if (given_config_source.use_stdin)
die("editing stdin is not supported"); die(_("editing stdin is not supported"));
if (given_config_source.blob) if (given_config_source.blob)
die("editing blobs is not supported"); die(_("editing blobs is not supported"));
git_config(git_default_config, NULL); git_config(git_default_config, NULL);
config_file = given_config_source.file ? config_file = given_config_source.file ?
xstrdup(given_config_source.file) : xstrdup(given_config_source.file) :
@ -822,7 +826,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
if (ret < 0) if (ret < 0)
return ret; return ret;
if (ret == 0) if (ret == 0)
die("No such section!"); die(_("no such section: %s"), argv[0]);
} }
else if (actions == ACTION_REMOVE_SECTION) { else if (actions == ACTION_REMOVE_SECTION) {
int ret; int ret;
@ -833,7 +837,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
if (ret < 0) if (ret < 0)
return ret; return ret;
if (ret == 0) if (ret == 0)
die("No such section!"); die(_("no such section: %s"), argv[0]);
} }
else if (actions == ACTION_GET_COLOR) { else if (actions == ACTION_GET_COLOR) {
check_argc(argc, 1, 2); check_argc(argc, 1, 2);

View File

@ -241,7 +241,7 @@ static void export_blob(const struct object_id *oid)
} else { } else {
buf = read_object_file(oid, &type, &size); buf = read_object_file(oid, &type, &size);
if (!buf) 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(oid, buf, size, type_name(type)) < 0) if (check_object_signature(oid, buf, size, type_name(type)) < 0)
die("sha1 mismatch in blob %s", oid_to_hex(oid)); die("sha1 mismatch in blob %s", oid_to_hex(oid));
object = parse_object_buffer(the_repository, oid, type, object = parse_object_buffer(the_repository, oid, type,
@ -255,7 +255,7 @@ static void export_blob(const struct object_id *oid)
printf("blob\nmark :%"PRIu32"\ndata %lu\n", last_idnum, size); printf("blob\nmark :%"PRIu32"\ndata %lu\n", last_idnum, size);
if (size && fwrite(buf, size, 1, stdout) != 1) 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"); printf("\n");
show_progress(); show_progress();
@ -563,14 +563,14 @@ static void handle_commit(struct commit *commit, struct rev_info *rev,
commit_buffer = get_commit_buffer(commit, NULL); commit_buffer = get_commit_buffer(commit, NULL);
author = strstr(commit_buffer, "\nauthor "); author = strstr(commit_buffer, "\nauthor ");
if (!author) if (!author)
die ("Could not find author in commit %s", die("could not find author in commit %s",
oid_to_hex(&commit->object.oid)); oid_to_hex(&commit->object.oid));
author++; author++;
author_end = strchrnul(author, '\n'); author_end = strchrnul(author, '\n');
committer = strstr(author_end, "\ncommitter "); committer = strstr(author_end, "\ncommitter ");
if (!committer) if (!committer)
die ("Could not find committer in commit %s", die("could not find committer in commit %s",
oid_to_hex(&commit->object.oid)); oid_to_hex(&commit->object.oid));
committer++; committer++;
committer_end = strchrnul(committer, '\n'); committer_end = strchrnul(committer, '\n');
message = strstr(committer_end, "\n\n"); message = strstr(committer_end, "\n\n");
@ -691,7 +691,7 @@ static void handle_tag(const char *name, struct tag *tag)
buf = read_object_file(&tag->object.oid, &type, &size); buf = read_object_file(&tag->object.oid, &type, &size);
if (!buf) 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); message = memmem(buf, size, "\n\n", 2);
if (message) { if (message) {
message += 2; message += 2;
@ -728,18 +728,18 @@ static void handle_tag(const char *name, struct tag *tag)
if (signature) if (signature)
switch(signed_tag_mode) { switch(signed_tag_mode) {
case ABORT: case ABORT:
die ("Encountered signed tag %s; use " die("encountered signed tag %s; use "
"--signed-tags=<mode> to handle it.", "--signed-tags=<mode> to handle it",
oid_to_hex(&tag->object.oid)); oid_to_hex(&tag->object.oid));
case WARN: case WARN:
warning ("Exporting signed tag %s", warning("exporting signed tag %s",
oid_to_hex(&tag->object.oid)); oid_to_hex(&tag->object.oid));
/* fallthru */ /* fallthru */
case VERBATIM: case VERBATIM:
break; break;
case WARN_STRIP: case WARN_STRIP:
warning ("Stripping signature from tag %s", warning("stripping signature from tag %s",
oid_to_hex(&tag->object.oid)); oid_to_hex(&tag->object.oid));
/* fallthru */ /* fallthru */
case STRIP: case STRIP:
message_size = signature + 1 - message; message_size = signature + 1 - message;
@ -753,18 +753,18 @@ static void handle_tag(const char *name, struct tag *tag)
if (!tagged_mark) { if (!tagged_mark) {
switch(tag_of_filtered_mode) { switch(tag_of_filtered_mode) {
case ABORT: case ABORT:
die ("Tag %s tags unexported object; use " die("tag %s tags unexported object; use "
"--tag-of-filtered-object=<mode> to handle it.", "--tag-of-filtered-object=<mode> to handle it",
oid_to_hex(&tag->object.oid)); oid_to_hex(&tag->object.oid));
case DROP: case DROP:
/* Ignore this tag altogether */ /* Ignore this tag altogether */
free(buf); free(buf);
return; return;
case REWRITE: case REWRITE:
if (tagged->type != OBJ_COMMIT) { if (tagged->type != OBJ_COMMIT) {
die ("Tag %s tags unexported %s!", die("tag %s tags unexported %s!",
oid_to_hex(&tag->object.oid), oid_to_hex(&tag->object.oid),
type_name(tagged->type)); type_name(tagged->type));
} }
p = (struct commit *)tagged; p = (struct commit *)tagged;
for (;;) { for (;;) {
@ -775,7 +775,7 @@ static void handle_tag(const char *name, struct tag *tag)
if (!(p->object.flags & TREESAME)) if (!(p->object.flags & TREESAME))
break; break;
if (!p->parents) if (!p->parents)
die ("Can't find replacement commit for tag %s\n", die("can't find replacement commit for tag %s",
oid_to_hex(&tag->object.oid)); oid_to_hex(&tag->object.oid));
p = p->parents->item; p = p->parents->item;
} }

View File

@ -628,7 +628,7 @@ int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
i++; i++;
p[len] = 0; p[len] = 0;
if (handle_line(p, &merge_parents)) if (handle_line(p, &merge_parents))
die ("Error in line %d: %.*s", i, len, p); die("error in line %d: %.*s", i, len, p);
} }
if (opts->add_title && srcs.nr) if (opts->add_title && srcs.nr)

View File

@ -489,7 +489,7 @@ static int grep_cache(struct grep_opt *opt, struct repository *repo,
} }
if (repo_read_index(repo) < 0) if (repo_read_index(repo) < 0)
die("index file corrupt"); die(_("index file corrupt"));
for (nr = 0; nr < repo->index->cache_nr; nr++) { for (nr = 0; nr < repo->index->cache_nr; nr++) {
const struct cache_entry *ce = repo->index->cache[nr]; const struct cache_entry *ce = repo->index->cache[nr];
@ -963,7 +963,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
} }
if (!opt.pattern_list) if (!opt.pattern_list)
die(_("no pattern given.")); die(_("no pattern given"));
/* --only-matching has no effect with --invert. */ /* --only-matching has no effect with --invert. */
if (opt.invert) if (opt.invert)
@ -1093,19 +1093,19 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
} }
if (recurse_submodules && (!use_index || untracked)) if (recurse_submodules && (!use_index || untracked))
die(_("option not supported with --recurse-submodules.")); die(_("option not supported with --recurse-submodules"));
if (!show_in_pager && !opt.status_only) if (!show_in_pager && !opt.status_only)
setup_pager(); setup_pager();
if (!use_index && (untracked || cached)) if (!use_index && (untracked || cached))
die(_("--cached or --untracked cannot be used with --no-index.")); die(_("--cached or --untracked cannot be used with --no-index"));
if (!use_index || untracked) { if (!use_index || untracked) {
int use_exclude = (opt_exclude < 0) ? use_index : !!opt_exclude; int use_exclude = (opt_exclude < 0) ? use_index : !!opt_exclude;
hit = grep_directory(&opt, &pathspec, use_exclude, use_index); hit = grep_directory(&opt, &pathspec, use_exclude, use_index);
} else if (0 <= opt_exclude) { } else if (0 <= opt_exclude) {
die(_("--[no-]exclude-standard cannot be used for tracked contents.")); die(_("--[no-]exclude-standard cannot be used for tracked contents"));
} else if (!list.nr) { } else if (!list.nr) {
if (!cached) if (!cached)
setup_work_tree(); setup_work_tree();
@ -1113,7 +1113,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
hit = grep_cache(&opt, the_repository, &pathspec, cached); hit = grep_cache(&opt, the_repository, &pathspec, cached);
} else { } else {
if (cached) if (cached)
die(_("both --cached and trees are given.")); die(_("both --cached and trees are given"));
hit = grep_objects(&opt, &pathspec, &list); hit = grep_objects(&opt, &pathspec, &list);
} }

View File

@ -1608,14 +1608,14 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
numbered = 0; numbered = 0;
if (numbered && keep_subject) if (numbered && keep_subject)
die (_("-n and -k are mutually exclusive.")); die(_("-n and -k are mutually exclusive"));
if (keep_subject && subject_prefix) if (keep_subject && subject_prefix)
die (_("--subject-prefix/--rfc and -k are mutually exclusive.")); die(_("--subject-prefix/--rfc and -k are mutually exclusive"));
rev.preserve_subject = keep_subject; rev.preserve_subject = keep_subject;
argc = setup_revisions(argc, argv, &rev, &s_r_opt); argc = setup_revisions(argc, argv, &rev, &s_r_opt);
if (argc > 1) if (argc > 1)
die (_("unrecognized argument: %s"), argv[1]); die(_("unrecognized argument: %s"), argv[1]);
if (rev.diffopt.output_format & DIFF_FORMAT_NAME) if (rev.diffopt.output_format & DIFF_FORMAT_NAME)
die(_("--name-only does not make sense")); die(_("--name-only does not make sense"));

View File

@ -725,7 +725,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
exit(128); exit(128);
if (write_locked_index(&the_index, &lock, if (write_locked_index(&the_index, &lock,
COMMIT_LOCK | SKIP_IF_UNCHANGED)) COMMIT_LOCK | SKIP_IF_UNCHANGED))
die (_("unable to write %s"), get_index_file()); die(_("unable to write %s"), get_index_file());
return clean ? 0 : 1; return clean ? 0 : 1;
} else { } else {
return try_merge_command(strategy, xopts_nr, xopts, return try_merge_command(strategy, xopts_nr, xopts,

View File

@ -140,7 +140,7 @@ static void *get_delta(struct object_entry *entry)
buf = read_object_file(&entry->idx.oid, &type, &size); buf = read_object_file(&entry->idx.oid, &type, &size);
if (!buf) if (!buf)
die("unable to read %s", oid_to_hex(&entry->idx.oid)); die(_("unable to read %s"), oid_to_hex(&entry->idx.oid));
base_buf = read_object_file(&DELTA(entry)->idx.oid, &type, base_buf = read_object_file(&DELTA(entry)->idx.oid, &type,
&base_size); &base_size);
if (!base_buf) if (!base_buf)
@ -148,8 +148,13 @@ static void *get_delta(struct object_entry *entry)
oid_to_hex(&DELTA(entry)->idx.oid)); oid_to_hex(&DELTA(entry)->idx.oid));
delta_buf = diff_delta(base_buf, base_size, delta_buf = diff_delta(base_buf, base_size,
buf, size, &delta_size, 0); buf, size, &delta_size, 0);
/*
* We succesfully computed this delta once but dropped it for
* memory reasons. Something is very wrong if this time we
* recompute and create a different delta.
*/
if (!delta_buf || delta_size != DELTA_SIZE(entry)) if (!delta_buf || delta_size != DELTA_SIZE(entry))
die("delta size changed"); BUG("delta size changed");
free(buf); free(buf);
free(base_buf); free(base_buf);
return delta_buf; return delta_buf;
@ -406,7 +411,7 @@ static off_t write_reuse_object(struct hashfile *f, struct object_entry *entry,
datalen = revidx[1].offset - offset; datalen = revidx[1].offset - offset;
if (!pack_to_stdout && p->index_version > 1 && if (!pack_to_stdout && p->index_version > 1 &&
check_pack_crc(p, &w_curs, offset, datalen, revidx->nr)) { check_pack_crc(p, &w_curs, offset, datalen, revidx->nr)) {
error("bad packed object CRC for %s", error(_("bad packed object CRC for %s"),
oid_to_hex(&entry->idx.oid)); oid_to_hex(&entry->idx.oid));
unuse_pack(&w_curs); unuse_pack(&w_curs);
return write_no_reuse_object(f, entry, limit, usable_delta); return write_no_reuse_object(f, entry, limit, usable_delta);
@ -417,7 +422,7 @@ static off_t write_reuse_object(struct hashfile *f, struct object_entry *entry,
if (!pack_to_stdout && p->index_version == 1 && if (!pack_to_stdout && p->index_version == 1 &&
check_pack_inflate(p, &w_curs, offset, datalen, entry_size)) { check_pack_inflate(p, &w_curs, offset, datalen, entry_size)) {
error("corrupt packed object for %s", error(_("corrupt packed object for %s"),
oid_to_hex(&entry->idx.oid)); oid_to_hex(&entry->idx.oid));
unuse_pack(&w_curs); unuse_pack(&w_curs);
return write_no_reuse_object(f, entry, limit, usable_delta); return write_no_reuse_object(f, entry, limit, usable_delta);
@ -548,7 +553,7 @@ static enum write_one_status write_one(struct hashfile *f,
*/ */
recursing = (e->idx.offset == 1); recursing = (e->idx.offset == 1);
if (recursing) { if (recursing) {
warning("recursive delta detected for object %s", warning(_("recursive delta detected for object %s"),
oid_to_hex(&e->idx.oid)); oid_to_hex(&e->idx.oid));
return WRITE_ONE_RECURSIVE; return WRITE_ONE_RECURSIVE;
} else if (e->idx.offset || e->preferred_base) { } else if (e->idx.offset || e->preferred_base) {
@ -582,7 +587,7 @@ static enum write_one_status write_one(struct hashfile *f,
/* make sure off_t is sufficiently large not to wrap */ /* make sure off_t is sufficiently large not to wrap */
if (signed_add_overflows(*offset, size)) if (signed_add_overflows(*offset, size))
die("pack too large for current definition of off_t"); die(_("pack too large for current definition of off_t"));
*offset += size; *offset += size;
return WRITE_ONE_WRITTEN; return WRITE_ONE_WRITTEN;
} }
@ -748,7 +753,8 @@ static struct object_entry **compute_write_order(void)
} }
if (wo_end != to_pack.nr_objects) if (wo_end != to_pack.nr_objects)
die("ordered %u objects, expected %"PRIu32, wo_end, to_pack.nr_objects); die(_("ordered %u objects, expected %"PRIu32),
wo_end, to_pack.nr_objects);
return wo; return wo;
} }
@ -760,15 +766,15 @@ static off_t write_reused_pack(struct hashfile *f)
int fd; int fd;
if (!is_pack_valid(reuse_packfile)) if (!is_pack_valid(reuse_packfile))
die("packfile is invalid: %s", reuse_packfile->pack_name); die(_("packfile is invalid: %s"), reuse_packfile->pack_name);
fd = git_open(reuse_packfile->pack_name); fd = git_open(reuse_packfile->pack_name);
if (fd < 0) if (fd < 0)
die_errno("unable to open packfile for reuse: %s", die_errno(_("unable to open packfile for reuse: %s"),
reuse_packfile->pack_name); reuse_packfile->pack_name);
if (lseek(fd, sizeof(struct pack_header), SEEK_SET) == -1) if (lseek(fd, sizeof(struct pack_header), SEEK_SET) == -1)
die_errno("unable to seek in reused packfile"); die_errno(_("unable to seek in reused packfile"));
if (reuse_packfile_offset < 0) if (reuse_packfile_offset < 0)
reuse_packfile_offset = reuse_packfile->pack_size - the_hash_algo->rawsz; reuse_packfile_offset = reuse_packfile->pack_size - the_hash_algo->rawsz;
@ -779,7 +785,7 @@ static off_t write_reused_pack(struct hashfile *f)
int read_pack = xread(fd, buffer, sizeof(buffer)); int read_pack = xread(fd, buffer, sizeof(buffer));
if (read_pack <= 0) if (read_pack <= 0)
die_errno("unable to read from reused packfile"); die_errno(_("unable to read from reused packfile"));
if (read_pack > to_write) if (read_pack > to_write)
read_pack = to_write; read_pack = to_write;
@ -882,7 +888,7 @@ static void write_pack_file(void)
* to preserve this property. * to preserve this property.
*/ */
if (stat(pack_tmp_name, &st) < 0) { if (stat(pack_tmp_name, &st) < 0) {
warning_errno("failed to stat %s", pack_tmp_name); warning_errno(_("failed to stat %s"), pack_tmp_name);
} else if (!last_mtime) { } else if (!last_mtime) {
last_mtime = st.st_mtime; last_mtime = st.st_mtime;
} else { } else {
@ -890,7 +896,7 @@ static void write_pack_file(void)
utb.actime = st.st_atime; utb.actime = st.st_atime;
utb.modtime = --last_mtime; utb.modtime = --last_mtime;
if (utime(pack_tmp_name, &utb) < 0) if (utime(pack_tmp_name, &utb) < 0)
warning_errno("failed utime() on %s", pack_tmp_name); warning_errno(_("failed utime() on %s"), pack_tmp_name);
} }
strbuf_addf(&tmpname, "%s-", base_name); strbuf_addf(&tmpname, "%s-", base_name);
@ -935,8 +941,8 @@ static void write_pack_file(void)
free(write_order); free(write_order);
stop_progress(&progress_state); stop_progress(&progress_state);
if (written != nr_result) if (written != nr_result)
die("wrote %"PRIu32" objects while expecting %"PRIu32, die(_("wrote %"PRIu32" objects while expecting %"PRIu32),
written, nr_result); written, nr_result);
} }
static int no_try_delta(const char *path) static int no_try_delta(const char *path)
@ -1480,7 +1486,7 @@ static void check_object(struct object_entry *entry)
while (c & 128) { while (c & 128) {
ofs += 1; ofs += 1;
if (!ofs || MSB(ofs, 7)) { if (!ofs || MSB(ofs, 7)) {
error("delta base offset overflow in pack for %s", error(_("delta base offset overflow in pack for %s"),
oid_to_hex(&entry->idx.oid)); oid_to_hex(&entry->idx.oid));
goto give_up; goto give_up;
} }
@ -1489,7 +1495,7 @@ static void check_object(struct object_entry *entry)
} }
ofs = entry->in_pack_offset - ofs; ofs = entry->in_pack_offset - ofs;
if (ofs <= 0 || ofs >= entry->in_pack_offset) { if (ofs <= 0 || ofs >= entry->in_pack_offset) {
error("delta base offset out of bound for %s", error(_("delta base offset out of bound for %s"),
oid_to_hex(&entry->idx.oid)); oid_to_hex(&entry->idx.oid));
goto give_up; goto give_up;
} }
@ -1974,10 +1980,10 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
trg->data = read_object_file(&trg_entry->idx.oid, &type, &sz); trg->data = read_object_file(&trg_entry->idx.oid, &type, &sz);
read_unlock(); read_unlock();
if (!trg->data) if (!trg->data)
die("object %s cannot be read", die(_("object %s cannot be read"),
oid_to_hex(&trg_entry->idx.oid)); oid_to_hex(&trg_entry->idx.oid));
if (sz != trg_size) if (sz != trg_size)
die("object %s inconsistent object length (%lu vs %lu)", die(_("object %s inconsistent object length (%lu vs %lu)"),
oid_to_hex(&trg_entry->idx.oid), sz, oid_to_hex(&trg_entry->idx.oid), sz,
trg_size); trg_size);
*mem_usage += sz; *mem_usage += sz;
@ -1990,7 +1996,7 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
if (src_entry->preferred_base) { if (src_entry->preferred_base) {
static int warned = 0; static int warned = 0;
if (!warned++) if (!warned++)
warning("object %s cannot be read", warning(_("object %s cannot be read"),
oid_to_hex(&src_entry->idx.oid)); oid_to_hex(&src_entry->idx.oid));
/* /*
* Those objects are not included in the * Those objects are not included in the
@ -2000,11 +2006,11 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
*/ */
return 0; return 0;
} }
die("object %s cannot be read", die(_("object %s cannot be read"),
oid_to_hex(&src_entry->idx.oid)); oid_to_hex(&src_entry->idx.oid));
} }
if (sz != src_size) if (sz != src_size)
die("object %s inconsistent object length (%lu vs %lu)", die(_("object %s inconsistent object length (%lu vs %lu)"),
oid_to_hex(&src_entry->idx.oid), sz, oid_to_hex(&src_entry->idx.oid), sz,
src_size); src_size);
*mem_usage += sz; *mem_usage += sz;
@ -2014,7 +2020,7 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
if (!src->index) { if (!src->index) {
static int warned = 0; static int warned = 0;
if (!warned++) if (!warned++)
warning("suboptimal pack - out of memory"); warning(_("suboptimal pack - out of memory"));
return 0; return 0;
} }
*mem_usage += sizeof_delta_index(src->index); *mem_usage += sizeof_delta_index(src->index);
@ -2341,8 +2347,8 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
return; return;
} }
if (progress > pack_to_stdout) if (progress > pack_to_stdout)
fprintf(stderr, "Delta compression using up to %d threads.\n", fprintf_ln(stderr, _("Delta compression using up to %d threads"),
delta_search_threads); delta_search_threads);
p = xcalloc(delta_search_threads, sizeof(*p)); p = xcalloc(delta_search_threads, sizeof(*p));
/* Partition the work amongst work threads. */ /* Partition the work amongst work threads. */
@ -2382,7 +2388,7 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
ret = pthread_create(&p[i].thread, NULL, ret = pthread_create(&p[i].thread, NULL,
threaded_find_deltas, &p[i]); threaded_find_deltas, &p[i]);
if (ret) if (ret)
die("unable to create thread: %s", strerror(ret)); die(_("unable to create thread: %s"), strerror(ret));
active_threads++; active_threads++;
} }
@ -2477,7 +2483,7 @@ static void add_tag_chain(const struct object_id *oid)
tag = lookup_tag(the_repository, oid); tag = lookup_tag(the_repository, oid);
while (1) { while (1) {
if (!tag || parse_tag(tag) || !tag->tagged) if (!tag || parse_tag(tag) || !tag->tagged)
die("unable to pack objects reachable from tag %s", die(_("unable to pack objects reachable from tag %s"),
oid_to_hex(oid)); oid_to_hex(oid));
add_object_entry(&tag->object.oid, OBJ_TAG, NULL, 0); add_object_entry(&tag->object.oid, OBJ_TAG, NULL, 0);
@ -2543,7 +2549,7 @@ static void prepare_pack(int window, int depth)
if (!entry->preferred_base) { if (!entry->preferred_base) {
nr_deltas++; nr_deltas++;
if (oe_type(entry) < 0) if (oe_type(entry) < 0)
die("unable to get type of object %s", die(_("unable to get type of object %s"),
oid_to_hex(&entry->idx.oid)); oid_to_hex(&entry->idx.oid));
} else { } else {
if (oe_type(entry) < 0) { if (oe_type(entry) < 0) {
@ -2567,7 +2573,7 @@ static void prepare_pack(int window, int depth)
ll_find_deltas(delta_list, n, window+1, depth, &nr_done); ll_find_deltas(delta_list, n, window+1, depth, &nr_done);
stop_progress(&progress_state); stop_progress(&progress_state);
if (nr_done != nr_deltas) if (nr_done != nr_deltas)
die("inconsistency with delta count"); die(_("inconsistency with delta count"));
} }
free(delta_list); free(delta_list);
} }
@ -2607,11 +2613,11 @@ static int git_pack_config(const char *k, const char *v, void *cb)
if (!strcmp(k, "pack.threads")) { if (!strcmp(k, "pack.threads")) {
delta_search_threads = git_config_int(k, v); delta_search_threads = git_config_int(k, v);
if (delta_search_threads < 0) if (delta_search_threads < 0)
die("invalid number of threads specified (%d)", die(_("invalid number of threads specified (%d)"),
delta_search_threads); delta_search_threads);
#ifdef NO_PTHREADS #ifdef NO_PTHREADS
if (delta_search_threads != 1) { if (delta_search_threads != 1) {
warning("no threads support, ignoring %s", k); warning(_("no threads support, ignoring %s"), k);
delta_search_threads = 0; delta_search_threads = 0;
} }
#endif #endif
@ -2620,7 +2626,7 @@ static int git_pack_config(const char *k, const char *v, void *cb)
if (!strcmp(k, "pack.indexversion")) { if (!strcmp(k, "pack.indexversion")) {
pack_idx_opts.version = git_config_int(k, v); pack_idx_opts.version = git_config_int(k, v);
if (pack_idx_opts.version > 2) if (pack_idx_opts.version > 2)
die("bad pack.indexversion=%"PRIu32, die(_("bad pack.indexversion=%"PRIu32),
pack_idx_opts.version); pack_idx_opts.version);
return 0; return 0;
} }
@ -2638,7 +2644,7 @@ static void read_object_list_from_stdin(void)
if (feof(stdin)) if (feof(stdin))
break; break;
if (!ferror(stdin)) if (!ferror(stdin))
die("fgets returned NULL, not EOF, not error!"); die("BUG: fgets returned NULL, not EOF, not error!");
if (errno != EINTR) if (errno != EINTR)
die_errno("fgets"); die_errno("fgets");
clearerr(stdin); clearerr(stdin);
@ -2646,13 +2652,13 @@ static void read_object_list_from_stdin(void)
} }
if (line[0] == '-') { if (line[0] == '-') {
if (get_oid_hex(line+1, &oid)) if (get_oid_hex(line+1, &oid))
die("expected edge object ID, got garbage:\n %s", die(_("expected edge object ID, got garbage:\n %s"),
line); line);
add_preferred_base(&oid); add_preferred_base(&oid);
continue; continue;
} }
if (parse_oid_hex(line, &oid, &p)) if (parse_oid_hex(line, &oid, &p))
die("expected object ID, got garbage:\n %s", line); die(_("expected object ID, got garbage:\n %s"), line);
add_preferred_base_object(p + 1); add_preferred_base_object(p + 1);
add_object_entry(&oid, OBJ_NONE, p + 1, 0); add_object_entry(&oid, OBJ_NONE, p + 1, 0);
@ -2791,7 +2797,7 @@ static void add_objects_in_unpacked_packs(struct rev_info *revs)
if (!p->pack_local || p->pack_keep || p->pack_keep_in_core) if (!p->pack_local || p->pack_keep || p->pack_keep_in_core)
continue; continue;
if (open_pack_index(p)) if (open_pack_index(p))
die("cannot open pack index"); die(_("cannot open pack index"));
ALLOC_GROW(in_pack.array, ALLOC_GROW(in_pack.array,
in_pack.nr + p->num_objects, in_pack.nr + p->num_objects,
@ -2822,7 +2828,7 @@ static int add_loose_object(const struct object_id *oid, const char *path,
enum object_type type = oid_object_info(the_repository, oid, NULL); enum object_type type = oid_object_info(the_repository, oid, NULL);
if (type < 0) { if (type < 0) {
warning("loose object at %s could not be examined", path); warning(_("loose object at %s could not be examined"), path);
return 0; return 0;
} }
@ -2899,7 +2905,7 @@ static void loosen_unused_packed_objects(struct rev_info *revs)
continue; continue;
if (open_pack_index(p)) if (open_pack_index(p))
die("cannot open pack index"); die(_("cannot open pack index"));
for (i = 0; i < p->num_objects; i++) { for (i = 0; i < p->num_objects; i++) {
nth_packed_object_oid(&oid, p, i); nth_packed_object_oid(&oid, p, i);
@ -2907,7 +2913,7 @@ static void loosen_unused_packed_objects(struct rev_info *revs)
!has_sha1_pack_kept_or_nonlocal(&oid) && !has_sha1_pack_kept_or_nonlocal(&oid) &&
!loosened_object_can_be_discarded(&oid, p->mtime)) !loosened_object_can_be_discarded(&oid, p->mtime))
if (force_object_loose(&oid, p->mtime)) if (force_object_loose(&oid, p->mtime))
die("unable to force loose object"); die(_("unable to force loose object"));
} }
} }
} }
@ -2994,17 +3000,17 @@ static void get_object_list(int ac, const char **av)
use_bitmap_index = 0; use_bitmap_index = 0;
continue; continue;
} }
die("not a rev '%s'", line); die(_("not a rev '%s'"), line);
} }
if (handle_revision_arg(line, &revs, flags, REVARG_CANNOT_BE_FILENAME)) if (handle_revision_arg(line, &revs, flags, REVARG_CANNOT_BE_FILENAME))
die("bad revision '%s'", line); die(_("bad revision '%s'"), line);
} }
if (use_bitmap_index && !get_object_list_from_bitmap(&revs)) if (use_bitmap_index && !get_object_list_from_bitmap(&revs))
return; return;
if (prepare_revision_walk(&revs)) if (prepare_revision_walk(&revs))
die("revision walk setup failed"); die(_("revision walk setup failed"));
mark_edges_uninteresting(&revs, show_edge); mark_edges_uninteresting(&revs, show_edge);
if (!fn_show_object) if (!fn_show_object)
@ -3017,9 +3023,9 @@ static void get_object_list(int ac, const char **av)
revs.ignore_missing_links = 1; revs.ignore_missing_links = 1;
if (add_unseen_recent_objects_to_traversal(&revs, if (add_unseen_recent_objects_to_traversal(&revs,
unpack_unreachable_expiration)) unpack_unreachable_expiration))
die("unable to add recent objects"); die(_("unable to add recent objects"));
if (prepare_revision_walk(&revs)) if (prepare_revision_walk(&revs))
die("revision walk setup failed"); die(_("revision walk setup failed"));
traverse_commit_list(&revs, record_recent_commit, traverse_commit_list(&revs, record_recent_commit,
record_recent_object, NULL); record_recent_object, NULL);
} }
@ -3254,35 +3260,35 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
if (pack_compression_level == -1) if (pack_compression_level == -1)
pack_compression_level = Z_DEFAULT_COMPRESSION; pack_compression_level = Z_DEFAULT_COMPRESSION;
else if (pack_compression_level < 0 || pack_compression_level > Z_BEST_COMPRESSION) else if (pack_compression_level < 0 || pack_compression_level > Z_BEST_COMPRESSION)
die("bad pack compression level %d", pack_compression_level); die(_("bad pack compression level %d"), pack_compression_level);
if (!delta_search_threads) /* --threads=0 means autodetect */ if (!delta_search_threads) /* --threads=0 means autodetect */
delta_search_threads = online_cpus(); delta_search_threads = online_cpus();
#ifdef NO_PTHREADS #ifdef NO_PTHREADS
if (delta_search_threads != 1) if (delta_search_threads != 1)
warning("no threads support, ignoring --threads"); warning(_("no threads support, ignoring --threads"));
#endif #endif
if (!pack_to_stdout && !pack_size_limit) if (!pack_to_stdout && !pack_size_limit)
pack_size_limit = pack_size_limit_cfg; pack_size_limit = pack_size_limit_cfg;
if (pack_to_stdout && pack_size_limit) if (pack_to_stdout && pack_size_limit)
die("--max-pack-size cannot be used to build a pack for transfer."); die(_("--max-pack-size cannot be used to build a pack for transfer"));
if (pack_size_limit && pack_size_limit < 1024*1024) { if (pack_size_limit && pack_size_limit < 1024*1024) {
warning("minimum pack size limit is 1 MiB"); warning(_("minimum pack size limit is 1 MiB"));
pack_size_limit = 1024*1024; pack_size_limit = 1024*1024;
} }
if (!pack_to_stdout && thin) if (!pack_to_stdout && thin)
die("--thin cannot be used to build an indexable pack."); die(_("--thin cannot be used to build an indexable pack"));
if (keep_unreachable && unpack_unreachable) if (keep_unreachable && unpack_unreachable)
die("--keep-unreachable and --unpack-unreachable are incompatible."); die(_("--keep-unreachable and --unpack-unreachable are incompatible"));
if (!rev_list_all || !rev_list_reflog || !rev_list_index) if (!rev_list_all || !rev_list_reflog || !rev_list_index)
unpack_unreachable_expiration = 0; unpack_unreachable_expiration = 0;
if (filter_options.choice) { if (filter_options.choice) {
if (!pack_to_stdout) if (!pack_to_stdout)
die("cannot use --filter without --stdout."); die(_("cannot use --filter without --stdout"));
use_bitmap_index = 0; use_bitmap_index = 0;
} }
@ -3356,8 +3362,9 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
prepare_pack(window, depth); prepare_pack(window, depth);
write_pack_file(); write_pack_file();
if (progress) if (progress)
fprintf(stderr, "Total %"PRIu32" (delta %"PRIu32")," fprintf_ln(stderr,
" reused %"PRIu32" (delta %"PRIu32")\n", _("Total %"PRIu32" (delta %"PRIu32"),"
written, written_delta, reused, reused_delta); " reused %"PRIu32" (delta %"PRIu32")"),
written, written_delta, reused, reused_delta);
return 0; return 0;
} }

View File

@ -54,7 +54,7 @@ static int show_reference(const char *refname, const struct object_id *oid,
enum object_type obj_type, repl_type; enum object_type obj_type, repl_type;
if (get_oid(refname, &object)) if (get_oid(refname, &object))
return error("Failed to resolve '%s' as a valid ref.", refname); return error(_("failed to resolve '%s' as a valid ref"), refname);
obj_type = oid_object_info(the_repository, &object, obj_type = oid_object_info(the_repository, &object,
NULL); NULL);
@ -83,8 +83,8 @@ static int list_replace_refs(const char *pattern, const char *format)
else if (!strcmp(format, "long")) else if (!strcmp(format, "long"))
data.format = REPLACE_FORMAT_LONG; data.format = REPLACE_FORMAT_LONG;
else else
return error("invalid replace format '%s'\n" return error(_("invalid replace format '%s'\n"
"valid formats are 'short', 'medium' and 'long'\n", "valid formats are 'short', 'medium' and 'long'"),
format); format);
for_each_replace_ref(the_repository, show_reference, (void *)&data); for_each_replace_ref(the_repository, show_reference, (void *)&data);
@ -108,7 +108,7 @@ static int for_each_replace_name(const char **argv, each_replace_name_fn fn)
for (p = argv; *p; p++) { for (p = argv; *p; p++) {
if (get_oid(*p, &oid)) { if (get_oid(*p, &oid)) {
error("Failed to resolve '%s' as a valid ref.", *p); error("failed to resolve '%s' as a valid ref", *p);
had_error = 1; had_error = 1;
continue; continue;
} }
@ -118,7 +118,7 @@ static int for_each_replace_name(const char **argv, each_replace_name_fn fn)
full_hex = ref.buf + base_len; full_hex = ref.buf + base_len;
if (read_ref(ref.buf, &oid)) { if (read_ref(ref.buf, &oid)) {
error("replace ref '%s' not found.", full_hex); error(_("replace ref '%s' not found"), full_hex);
had_error = 1; had_error = 1;
continue; continue;
} }
@ -134,7 +134,7 @@ static int delete_replace_ref(const char *name, const char *ref,
{ {
if (delete_ref(NULL, ref, oid, 0)) if (delete_ref(NULL, ref, oid, 0))
return 1; return 1;
printf("Deleted replace ref '%s'\n", name); printf_ln(_("Deleted replace ref '%s'"), name);
return 0; return 0;
} }
@ -146,12 +146,12 @@ static int check_ref_valid(struct object_id *object,
strbuf_reset(ref); strbuf_reset(ref);
strbuf_addf(ref, "%s%s", git_replace_ref_base, oid_to_hex(object)); strbuf_addf(ref, "%s%s", git_replace_ref_base, oid_to_hex(object));
if (check_refname_format(ref->buf, 0)) if (check_refname_format(ref->buf, 0))
return error("'%s' is not a valid ref name.", ref->buf); return error(_("'%s' is not a valid ref name"), ref->buf);
if (read_ref(ref->buf, prev)) if (read_ref(ref->buf, prev))
oidclr(prev); oidclr(prev);
else if (!force) else if (!force)
return error("replace ref '%s' already exists", ref->buf); return error(_("replace ref '%s' already exists"), ref->buf);
return 0; return 0;
} }
@ -171,10 +171,10 @@ static int replace_object_oid(const char *object_ref,
obj_type = oid_object_info(the_repository, object, NULL); obj_type = oid_object_info(the_repository, object, NULL);
repl_type = oid_object_info(the_repository, repl, NULL); repl_type = oid_object_info(the_repository, repl, NULL);
if (!force && obj_type != repl_type) if (!force && obj_type != repl_type)
return error("Objects must be of the same type.\n" return error(_("Objects must be of the same type.\n"
"'%s' points to a replaced object of type '%s'\n" "'%s' points to a replaced object of type '%s'\n"
"while '%s' points to a replacement object of " "while '%s' points to a replacement object of "
"type '%s'.", "type '%s'."),
object_ref, type_name(obj_type), object_ref, type_name(obj_type),
replace_ref, type_name(repl_type)); replace_ref, type_name(repl_type));
@ -200,10 +200,10 @@ static int replace_object(const char *object_ref, const char *replace_ref, int f
struct object_id object, repl; struct object_id object, repl;
if (get_oid(object_ref, &object)) if (get_oid(object_ref, &object))
return error("Failed to resolve '%s' as a valid ref.", return error(_("failed to resolve '%s' as a valid ref"),
object_ref); object_ref);
if (get_oid(replace_ref, &repl)) if (get_oid(replace_ref, &repl))
return error("Failed to resolve '%s' as a valid ref.", return error(_("failed to resolve '%s' as a valid ref"),
replace_ref); replace_ref);
return replace_object_oid(object_ref, &object, replace_ref, &repl, force); return replace_object_oid(object_ref, &object, replace_ref, &repl, force);
@ -222,7 +222,7 @@ static int export_object(const struct object_id *oid, enum object_type type,
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0666); fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0666);
if (fd < 0) if (fd < 0)
return error_errno("unable to open %s for writing", filename); return error_errno(_("unable to open %s for writing"), filename);
argv_array_push(&cmd.args, "--no-replace-objects"); argv_array_push(&cmd.args, "--no-replace-objects");
argv_array_push(&cmd.args, "cat-file"); argv_array_push(&cmd.args, "cat-file");
@ -235,7 +235,7 @@ static int export_object(const struct object_id *oid, enum object_type type,
cmd.out = fd; cmd.out = fd;
if (run_command(&cmd)) if (run_command(&cmd))
return error("cat-file reported failure"); return error(_("cat-file reported failure"));
return 0; return 0;
} }
@ -251,7 +251,7 @@ static int import_object(struct object_id *oid, enum object_type type,
fd = open(filename, O_RDONLY); fd = open(filename, O_RDONLY);
if (fd < 0) if (fd < 0)
return error_errno("unable to open %s for reading", filename); return error_errno(_("unable to open %s for reading"), filename);
if (!raw && type == OBJ_TREE) { if (!raw && type == OBJ_TREE) {
const char *argv[] = { "mktree", NULL }; const char *argv[] = { "mktree", NULL };
@ -265,11 +265,11 @@ static int import_object(struct object_id *oid, enum object_type type,
if (start_command(&cmd)) { if (start_command(&cmd)) {
close(fd); close(fd);
return error("unable to spawn mktree"); return error(_("unable to spawn mktree"));
} }
if (strbuf_read(&result, cmd.out, 41) < 0) { if (strbuf_read(&result, cmd.out, 41) < 0) {
error_errno("unable to read from mktree"); error_errno(_("unable to read from mktree"));
close(fd); close(fd);
close(cmd.out); close(cmd.out);
return -1; return -1;
@ -278,11 +278,11 @@ static int import_object(struct object_id *oid, enum object_type type,
if (finish_command(&cmd)) { if (finish_command(&cmd)) {
strbuf_release(&result); strbuf_release(&result);
return error("mktree reported failure"); return error(_("mktree reported failure"));
} }
if (get_oid_hex(result.buf, oid) < 0) { if (get_oid_hex(result.buf, oid) < 0) {
strbuf_release(&result); strbuf_release(&result);
return error("mktree did not return an object name"); return error(_("mktree did not return an object name"));
} }
strbuf_release(&result); strbuf_release(&result);
@ -291,12 +291,12 @@ static int import_object(struct object_id *oid, enum object_type type,
int flags = HASH_FORMAT_CHECK | HASH_WRITE_OBJECT; int flags = HASH_FORMAT_CHECK | HASH_WRITE_OBJECT;
if (fstat(fd, &st) < 0) { if (fstat(fd, &st) < 0) {
error_errno("unable to fstat %s", filename); error_errno(_("unable to fstat %s"), filename);
close(fd); close(fd);
return -1; return -1;
} }
if (index_fd(oid, fd, &st, type, NULL, flags) < 0) if (index_fd(oid, fd, &st, type, NULL, flags) < 0)
return error("unable to write object to database"); return error(_("unable to write object to database"));
/* index_fd close()s fd for us */ /* index_fd close()s fd for us */
} }
@ -315,11 +315,11 @@ static int edit_and_replace(const char *object_ref, int force, int raw)
struct strbuf ref = STRBUF_INIT; struct strbuf ref = STRBUF_INIT;
if (get_oid(object_ref, &old_oid) < 0) if (get_oid(object_ref, &old_oid) < 0)
return error("Not a valid object name: '%s'", object_ref); return error(_("not a valid object name: '%s'"), object_ref);
type = oid_object_info(the_repository, &old_oid, NULL); type = oid_object_info(the_repository, &old_oid, NULL);
if (type < 0) if (type < 0)
return error("unable to get object type for %s", return error(_("unable to get object type for %s"),
oid_to_hex(&old_oid)); oid_to_hex(&old_oid));
if (check_ref_valid(&old_oid, &prev, &ref, force)) { if (check_ref_valid(&old_oid, &prev, &ref, force)) {
@ -335,7 +335,7 @@ static int edit_and_replace(const char *object_ref, int force, int raw)
} }
if (launch_editor(tmpfile, NULL, NULL) < 0) { if (launch_editor(tmpfile, NULL, NULL) < 0) {
free(tmpfile); free(tmpfile);
return error("editing object file failed"); return error(_("editing object file failed"));
} }
if (import_object(&new_oid, type, raw, tmpfile)) { if (import_object(&new_oid, type, raw, tmpfile)) {
free(tmpfile); free(tmpfile);
@ -344,7 +344,7 @@ static int edit_and_replace(const char *object_ref, int force, int raw)
free(tmpfile); free(tmpfile);
if (!oidcmp(&old_oid, &new_oid)) if (!oidcmp(&old_oid, &new_oid))
return error("new object is the same as the old one: '%s'", oid_to_hex(&old_oid)); return error(_("new object is the same as the old one: '%s'"), oid_to_hex(&old_oid));
return replace_object_oid(object_ref, &old_oid, "replacement", &new_oid, force); return replace_object_oid(object_ref, &old_oid, "replacement", &new_oid, force);
} }
@ -368,7 +368,7 @@ static int replace_parents(struct strbuf *buf, int argc, const char **argv)
struct object_id oid; struct object_id oid;
if (get_oid(argv[i], &oid) < 0) { if (get_oid(argv[i], &oid) < 0) {
strbuf_release(&new_parents); strbuf_release(&new_parents);
return error(_("Not a valid object name: '%s'"), return error(_("not a valid object name: '%s'"),
argv[i]); argv[i]);
} }
if (!lookup_commit_reference(the_repository, &oid)) { if (!lookup_commit_reference(the_repository, &oid)) {
@ -412,7 +412,7 @@ static int check_one_mergetag(struct commit *commit,
for (i = 1; i < mergetag_data->argc; i++) { for (i = 1; i < mergetag_data->argc; i++) {
struct object_id oid; struct object_id oid;
if (get_oid(mergetag_data->argv[i], &oid) < 0) if (get_oid(mergetag_data->argv[i], &oid) < 0)
return error(_("Not a valid object name: '%s'"), return error(_("not a valid object name: '%s'"),
mergetag_data->argv[i]); mergetag_data->argv[i]);
if (!oidcmp(&tag->tagged->oid, &oid)) if (!oidcmp(&tag->tagged->oid, &oid))
return 0; /* found */ return 0; /* found */
@ -442,7 +442,7 @@ static int create_graft(int argc, const char **argv, int force, int gentle)
unsigned long size; unsigned long size;
if (get_oid(old_ref, &old_oid) < 0) if (get_oid(old_ref, &old_oid) < 0)
return error(_("Not a valid object name: '%s'"), old_ref); return error(_("not a valid object name: '%s'"), old_ref);
commit = lookup_commit_reference(the_repository, &old_oid); commit = lookup_commit_reference(the_repository, &old_oid);
if (!commit) if (!commit)
return error(_("could not parse %s"), old_ref); return error(_("could not parse %s"), old_ref);
@ -457,7 +457,7 @@ static int create_graft(int argc, const char **argv, int force, int gentle)
} }
if (remove_signature(&buf)) { if (remove_signature(&buf)) {
warning(_("the original commit '%s' has a gpg signature."), old_ref); warning(_("the original commit '%s' has a gpg signature"), old_ref);
warning(_("the signature will be removed in the replacement commit!")); warning(_("the signature will be removed in the replacement commit!"));
} }
@ -476,10 +476,10 @@ static int create_graft(int argc, const char **argv, int force, int gentle)
if (!oidcmp(&old_oid, &new_oid)) { if (!oidcmp(&old_oid, &new_oid)) {
if (gentle) { if (gentle) {
warning("graft for '%s' unnecessary", oid_to_hex(&old_oid)); warning(_("graft for '%s' unnecessary"), oid_to_hex(&old_oid));
return 0; return 0;
} }
return error("new commit is the same as the old one: '%s'", oid_to_hex(&old_oid)); return error(_("new commit is the same as the old one: '%s'"), oid_to_hex(&old_oid));
} }
return replace_object_oid(old_ref, &old_oid, "replacement", &new_oid, force); return replace_object_oid(old_ref, &old_oid, "replacement", &new_oid, force);
@ -553,7 +553,7 @@ int cmd_replace(int argc, const char **argv, const char *prefix)
cmdmode = argc ? MODE_REPLACE : MODE_LIST; cmdmode = argc ? MODE_REPLACE : MODE_LIST;
if (format && cmdmode != MODE_LIST) if (format && cmdmode != MODE_LIST)
usage_msg_opt("--format cannot be used when not listing", usage_msg_opt(_("--format cannot be used when not listing"),
git_replace_usage, options); git_replace_usage, options);
if (force && if (force &&
@ -561,47 +561,47 @@ int cmd_replace(int argc, const char **argv, const char *prefix)
cmdmode != MODE_EDIT && cmdmode != MODE_EDIT &&
cmdmode != MODE_GRAFT && cmdmode != MODE_GRAFT &&
cmdmode != MODE_CONVERT_GRAFT_FILE) cmdmode != MODE_CONVERT_GRAFT_FILE)
usage_msg_opt("-f only makes sense when writing a replacement", usage_msg_opt(_("-f only makes sense when writing a replacement"),
git_replace_usage, options); git_replace_usage, options);
if (raw && cmdmode != MODE_EDIT) if (raw && cmdmode != MODE_EDIT)
usage_msg_opt("--raw only makes sense with --edit", usage_msg_opt(_("--raw only makes sense with --edit"),
git_replace_usage, options); git_replace_usage, options);
switch (cmdmode) { switch (cmdmode) {
case MODE_DELETE: case MODE_DELETE:
if (argc < 1) if (argc < 1)
usage_msg_opt("-d needs at least one argument", usage_msg_opt(_("-d needs at least one argument"),
git_replace_usage, options); git_replace_usage, options);
return for_each_replace_name(argv, delete_replace_ref); return for_each_replace_name(argv, delete_replace_ref);
case MODE_REPLACE: case MODE_REPLACE:
if (argc != 2) if (argc != 2)
usage_msg_opt("bad number of arguments", usage_msg_opt(_("bad number of arguments"),
git_replace_usage, options); git_replace_usage, options);
return replace_object(argv[0], argv[1], force); return replace_object(argv[0], argv[1], force);
case MODE_EDIT: case MODE_EDIT:
if (argc != 1) if (argc != 1)
usage_msg_opt("-e needs exactly one argument", usage_msg_opt(_("-e needs exactly one argument"),
git_replace_usage, options); git_replace_usage, options);
return edit_and_replace(argv[0], force, raw); return edit_and_replace(argv[0], force, raw);
case MODE_GRAFT: case MODE_GRAFT:
if (argc < 1) if (argc < 1)
usage_msg_opt("-g needs at least one argument", usage_msg_opt(_("-g needs at least one argument"),
git_replace_usage, options); git_replace_usage, options);
return create_graft(argc, argv, force, 0); return create_graft(argc, argv, force, 0);
case MODE_CONVERT_GRAFT_FILE: case MODE_CONVERT_GRAFT_FILE:
if (argc != 0) if (argc != 0)
usage_msg_opt("--convert-graft-file takes no argument", usage_msg_opt(_("--convert-graft-file takes no argument"),
git_replace_usage, options); git_replace_usage, options);
return !!convert_graft_file(force); return !!convert_graft_file(force);
case MODE_LIST: case MODE_LIST:
if (argc > 1) if (argc > 1)
usage_msg_opt("only one pattern can be given with -l", usage_msg_opt(_("only one pattern can be given with -l"),
git_replace_usage, options); git_replace_usage, options);
return list_replace_refs(argv[0], format); return list_replace_refs(argv[0], format);

View File

@ -285,7 +285,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
list.entry[list.nr].is_submodule = S_ISGITLINK(ce->ce_mode); list.entry[list.nr].is_submodule = S_ISGITLINK(ce->ce_mode);
if (list.entry[list.nr++].is_submodule && if (list.entry[list.nr++].is_submodule &&
!is_staging_gitmodules_ok(&the_index)) !is_staging_gitmodules_ok(&the_index))
die (_("Please stage your changes to .gitmodules or stash them to proceed")); die(_("please stage your changes to .gitmodules or stash them to proceed"));
} }
if (pathspec.nr) { if (pathspec.nr) {

View File

@ -80,28 +80,28 @@ struct commit_graph *load_commit_graph_one(const char *graph_file)
if (graph_size < GRAPH_MIN_SIZE) { if (graph_size < GRAPH_MIN_SIZE) {
close(fd); close(fd);
die("graph file %s is too small", graph_file); die(_("graph file %s is too small"), graph_file);
} }
graph_map = xmmap(NULL, graph_size, PROT_READ, MAP_PRIVATE, fd, 0); graph_map = xmmap(NULL, graph_size, PROT_READ, MAP_PRIVATE, fd, 0);
data = (const unsigned char *)graph_map; data = (const unsigned char *)graph_map;
graph_signature = get_be32(data); graph_signature = get_be32(data);
if (graph_signature != GRAPH_SIGNATURE) { if (graph_signature != GRAPH_SIGNATURE) {
error("graph signature %X does not match signature %X", error(_("graph signature %X does not match signature %X"),
graph_signature, GRAPH_SIGNATURE); graph_signature, GRAPH_SIGNATURE);
goto cleanup_fail; goto cleanup_fail;
} }
graph_version = *(unsigned char*)(data + 4); graph_version = *(unsigned char*)(data + 4);
if (graph_version != GRAPH_VERSION) { if (graph_version != GRAPH_VERSION) {
error("graph version %X does not match version %X", error(_("graph version %X does not match version %X"),
graph_version, GRAPH_VERSION); graph_version, GRAPH_VERSION);
goto cleanup_fail; goto cleanup_fail;
} }
hash_version = *(unsigned char*)(data + 5); hash_version = *(unsigned char*)(data + 5);
if (hash_version != GRAPH_OID_VERSION) { if (hash_version != GRAPH_OID_VERSION) {
error("hash version %X does not match version %X", error(_("hash version %X does not match version %X"),
hash_version, GRAPH_OID_VERSION); hash_version, GRAPH_OID_VERSION);
goto cleanup_fail; goto cleanup_fail;
} }
@ -125,7 +125,7 @@ struct commit_graph *load_commit_graph_one(const char *graph_file)
chunk_lookup += GRAPH_CHUNKLOOKUP_WIDTH; chunk_lookup += GRAPH_CHUNKLOOKUP_WIDTH;
if (chunk_offset > graph_size - GIT_MAX_RAWSZ) { if (chunk_offset > graph_size - GIT_MAX_RAWSZ) {
error("improper chunk offset %08x%08x", (uint32_t)(chunk_offset >> 32), error(_("improper chunk offset %08x%08x"), (uint32_t)(chunk_offset >> 32),
(uint32_t)chunk_offset); (uint32_t)chunk_offset);
goto cleanup_fail; goto cleanup_fail;
} }
@ -161,7 +161,7 @@ struct commit_graph *load_commit_graph_one(const char *graph_file)
} }
if (chunk_repeated) { if (chunk_repeated) {
error("chunk id %08x appears multiple times", chunk_id); error(_("chunk id %08x appears multiple times"), chunk_id);
goto cleanup_fail; goto cleanup_fail;
} }
@ -258,7 +258,7 @@ static struct commit_list **insert_parent_or_die(struct commit_graph *g,
hashcpy(oid.hash, g->chunk_oid_lookup + g->hash_len * pos); hashcpy(oid.hash, g->chunk_oid_lookup + g->hash_len * pos);
c = lookup_commit(the_repository, &oid); c = lookup_commit(the_repository, &oid);
if (!c) if (!c)
die("could not find commit %s", oid_to_hex(&oid)); die(_("could not find commit %s"), oid_to_hex(&oid));
c->graph_pos = pos; c->graph_pos = pos;
return &commit_list_insert(c, pptr)->next; return &commit_list_insert(c, pptr)->next;
} }
@ -562,7 +562,7 @@ static int add_packed_commits(const struct object_id *oid,
oi.typep = &type; oi.typep = &type;
if (packed_object_info(the_repository, pack, offset, &oi) < 0) if (packed_object_info(the_repository, pack, offset, &oi) < 0)
die("unable to get type of object %s", oid_to_hex(oid)); die(_("unable to get type of object %s"), oid_to_hex(oid));
if (type != OBJ_COMMIT) if (type != OBJ_COMMIT)
return 0; return 0;
@ -727,9 +727,9 @@ void write_commit_graph(const char *obj_dir,
strbuf_addstr(&packname, pack_indexes->items[i].string); strbuf_addstr(&packname, pack_indexes->items[i].string);
p = add_packed_git(packname.buf, packname.len, 1); p = add_packed_git(packname.buf, packname.len, 1);
if (!p) if (!p)
die("error adding pack %s", packname.buf); die(_("error adding pack %s"), packname.buf);
if (open_pack_index(p)) if (open_pack_index(p))
die("error opening index for %s", packname.buf); die(_("error opening index for %s"), packname.buf);
for_each_object_in_pack(p, add_packed_commits, &oids); for_each_object_in_pack(p, add_packed_commits, &oids);
close_pack(p); close_pack(p);
} }

View File

@ -117,12 +117,12 @@ static long config_buf_ftell(struct config_source *conf)
} }
#define MAX_INCLUDE_DEPTH 10 #define MAX_INCLUDE_DEPTH 10
static const char include_depth_advice[] = static const char include_depth_advice[] = N_(
"exceeded maximum include depth (%d) while including\n" "exceeded maximum include depth (%d) while including\n"
" %s\n" " %s\n"
"from\n" "from\n"
" %s\n" " %s\n"
"Do you have circular includes?"; "Do you have circular includes?");
static int handle_path_include(const char *path, struct config_include_data *inc) static int handle_path_include(const char *path, struct config_include_data *inc)
{ {
int ret = 0; int ret = 0;
@ -134,7 +134,7 @@ static int handle_path_include(const char *path, struct config_include_data *inc
expanded = expand_user_path(path, 0); expanded = expand_user_path(path, 0);
if (!expanded) if (!expanded)
return error("could not expand include path '%s'", path); return error(_("could not expand include path '%s'"), path);
path = expanded; path = expanded;
/* /*
@ -145,7 +145,7 @@ static int handle_path_include(const char *path, struct config_include_data *inc
char *slash; char *slash;
if (!cf || !cf->path) if (!cf || !cf->path)
return error("relative config includes must come from files"); return error(_("relative config includes must come from files"));
slash = find_last_dir_sep(cf->path); slash = find_last_dir_sep(cf->path);
if (slash) if (slash)
@ -156,7 +156,7 @@ static int handle_path_include(const char *path, struct config_include_data *inc
if (!access_or_die(path, R_OK, 0)) { if (!access_or_die(path, R_OK, 0)) {
if (++inc->depth > MAX_INCLUDE_DEPTH) if (++inc->depth > MAX_INCLUDE_DEPTH)
die(include_depth_advice, MAX_INCLUDE_DEPTH, path, die(_(include_depth_advice), MAX_INCLUDE_DEPTH, path,
!cf ? "<unknown>" : !cf ? "<unknown>" :
cf->name ? cf->name : cf->name ? cf->name :
"the command line"); "the command line");
@ -343,13 +343,13 @@ static int git_config_parse_key_1(const char *key, char **store_key, int *basele
if (last_dot == NULL || last_dot == key) { if (last_dot == NULL || last_dot == key) {
if (!quiet) if (!quiet)
error("key does not contain a section: %s", key); error(_("key does not contain a section: %s"), key);
return -CONFIG_NO_SECTION_OR_NAME; return -CONFIG_NO_SECTION_OR_NAME;
} }
if (!last_dot[1]) { if (!last_dot[1]) {
if (!quiet) if (!quiet)
error("key does not contain variable name: %s", key); error(_("key does not contain variable name: %s"), key);
return -CONFIG_NO_SECTION_OR_NAME; return -CONFIG_NO_SECTION_OR_NAME;
} }
@ -373,13 +373,13 @@ static int git_config_parse_key_1(const char *key, char **store_key, int *basele
if (!iskeychar(c) || if (!iskeychar(c) ||
(i == baselen + 1 && !isalpha(c))) { (i == baselen + 1 && !isalpha(c))) {
if (!quiet) if (!quiet)
error("invalid key: %s", key); error(_("invalid key: %s"), key);
goto out_free_ret_1; goto out_free_ret_1;
} }
c = tolower(c); c = tolower(c);
} else if (c == '\n') { } else if (c == '\n') {
if (!quiet) if (!quiet)
error("invalid key (newline): %s", key); error(_("invalid key (newline): %s"), key);
goto out_free_ret_1; goto out_free_ret_1;
} }
if (store_key) if (store_key)
@ -415,7 +415,7 @@ int git_config_parse_parameter(const char *text,
pair = strbuf_split_str(text, '=', 2); pair = strbuf_split_str(text, '=', 2);
if (!pair[0]) if (!pair[0])
return error("bogus config parameter: %s", text); return error(_("bogus config parameter: %s"), text);
if (pair[0]->len && pair[0]->buf[pair[0]->len - 1] == '=') { if (pair[0]->len && pair[0]->buf[pair[0]->len - 1] == '=') {
strbuf_setlen(pair[0], pair[0]->len - 1); strbuf_setlen(pair[0], pair[0]->len - 1);
@ -427,7 +427,7 @@ int git_config_parse_parameter(const char *text,
strbuf_trim(pair[0]); strbuf_trim(pair[0]);
if (!pair[0]->len) { if (!pair[0]->len) {
strbuf_list_free(pair); strbuf_list_free(pair);
return error("bogus config parameter: %s", text); return error(_("bogus config parameter: %s"), text);
} }
if (git_config_parse_key(pair[0]->buf, &canonical_name, NULL)) { if (git_config_parse_key(pair[0]->buf, &canonical_name, NULL)) {
@ -462,7 +462,7 @@ int git_config_from_parameters(config_fn_t fn, void *data)
envw = xstrdup(env); envw = xstrdup(env);
if (sq_dequote_to_argv(envw, &argv, &nr, &alloc) < 0) { if (sq_dequote_to_argv(envw, &argv, &nr, &alloc) < 0) {
ret = error("bogus format in " CONFIG_DATA_ENVIRONMENT); ret = error(_("bogus format in %s"), CONFIG_DATA_ENVIRONMENT);
goto out; goto out;
} }
@ -1166,7 +1166,7 @@ static int git_default_core_config(const char *var, const char *value)
else { else {
int abbrev = git_config_int(var, value); int abbrev = git_config_int(var, value);
if (abbrev < minimum_abbrev || abbrev > 40) if (abbrev < minimum_abbrev || abbrev > 40)
return error("abbrev length out of range: %d", abbrev); return error(_("abbrev length out of range: %d"), abbrev);
default_abbrev = abbrev; default_abbrev = abbrev;
} }
return 0; return 0;
@ -1283,7 +1283,7 @@ static int git_default_core_config(const char *var, const char *value)
comment_line_char = value[0]; comment_line_char = value[0];
auto_comment_line_char = 0; auto_comment_line_char = 0;
} else } else
return error("core.commentChar should only be one character"); return error(_("core.commentChar should only be one character"));
return 0; return 0;
} }
@ -1396,7 +1396,7 @@ static int git_default_branch_config(const char *var, const char *value)
else if (!strcmp(value, "always")) else if (!strcmp(value, "always"))
autorebase = AUTOREBASE_ALWAYS; autorebase = AUTOREBASE_ALWAYS;
else else
return error("malformed value for %s", var); return error(_("malformed value for %s"), var);
return 0; return 0;
} }
@ -1422,9 +1422,9 @@ static int git_default_push_config(const char *var, const char *value)
else if (!strcmp(value, "current")) else if (!strcmp(value, "current"))
push_default = PUSH_DEFAULT_CURRENT; push_default = PUSH_DEFAULT_CURRENT;
else { else {
error("malformed value for %s: %s", var, value); error(_("malformed value for %s: %s"), var, value);
return error("Must be one of nothing, matching, simple, " return error(_("must be one of nothing, matching, simple, "
"upstream or current."); "upstream or current"));
} }
return 0; return 0;
} }
@ -1603,10 +1603,10 @@ int git_config_from_blob_oid(config_fn_t fn,
buf = read_object_file(oid, &type, &size); buf = read_object_file(oid, &type, &size);
if (!buf) if (!buf)
return error("unable to load config blob object '%s'", name); return error(_("unable to load config blob object '%s'"), name);
if (type != OBJ_BLOB) { if (type != OBJ_BLOB) {
free(buf); free(buf);
return error("reference '%s' does not point to a blob", name); return error(_("reference '%s' does not point to a blob"), name);
} }
ret = git_config_from_mem(fn, CONFIG_ORIGIN_BLOB, name, buf, size, ret = git_config_from_mem(fn, CONFIG_ORIGIN_BLOB, name, buf, size,
@ -1623,7 +1623,7 @@ static int git_config_from_blob_ref(config_fn_t fn,
struct object_id oid; struct object_id oid;
if (get_oid(name, &oid) < 0) if (get_oid(name, &oid) < 0)
return error("unable to resolve config blob '%s'", name); return error(_("unable to resolve config blob '%s'"), name);
return git_config_from_blob_oid(fn, name, &oid, data); return git_config_from_blob_oid(fn, name, &oid, data);
} }
@ -1653,7 +1653,7 @@ unsigned long git_env_ulong(const char *k, unsigned long val)
{ {
const char *v = getenv(k); const char *v = getenv(k);
if (v && !git_parse_ulong(v, &val)) if (v && !git_parse_ulong(v, &val))
die("failed to parse %s", k); die(_("failed to parse %s"), k);
return val; return val;
} }
@ -2370,7 +2370,7 @@ static int store_aux_event(enum config_event_t type,
if (type == CONFIG_EVENT_SECTION) { if (type == CONFIG_EVENT_SECTION) {
if (cf->var.len < 2 || cf->var.buf[cf->var.len - 1] != '.') if (cf->var.len < 2 || cf->var.buf[cf->var.len - 1] != '.')
return error("invalid section name '%s'", cf->var.buf); return error(_("invalid section name '%s'"), cf->var.buf);
/* Is this the section we were looking for? */ /* Is this the section we were looking for? */
store->is_keys_section = store->is_keys_section =
@ -2426,7 +2426,7 @@ static int store_aux(const char *key, const char *value, void *cb)
static int write_error(const char *filename) static int write_error(const char *filename)
{ {
error("failed to write new configuration file %s", filename); error(_("failed to write new configuration file %s"), filename);
/* Same error code as "failed to rename". */ /* Same error code as "failed to rename". */
return 4; return 4;
@ -2677,7 +2677,7 @@ int git_config_set_multivar_in_file_gently(const char *config_filename,
*/ */
fd = hold_lock_file_for_update(&lock, config_filename, 0); fd = hold_lock_file_for_update(&lock, config_filename, 0);
if (fd < 0) { if (fd < 0) {
error_errno("could not lock config file %s", config_filename); error_errno(_("could not lock config file %s"), config_filename);
ret = CONFIG_NO_LOCK; ret = CONFIG_NO_LOCK;
goto out_free; goto out_free;
} }
@ -2688,7 +2688,7 @@ int git_config_set_multivar_in_file_gently(const char *config_filename,
in_fd = open(config_filename, O_RDONLY); in_fd = open(config_filename, O_RDONLY);
if ( in_fd < 0 ) { if ( in_fd < 0 ) {
if ( ENOENT != errno ) { if ( ENOENT != errno ) {
error_errno("opening %s", config_filename); error_errno(_("opening %s"), config_filename);
ret = CONFIG_INVALID_FILE; /* same as "invalid config file" */ ret = CONFIG_INVALID_FILE; /* same as "invalid config file" */
goto out_free; goto out_free;
} }
@ -2723,7 +2723,7 @@ int git_config_set_multivar_in_file_gently(const char *config_filename,
store.value_regex = (regex_t*)xmalloc(sizeof(regex_t)); store.value_regex = (regex_t*)xmalloc(sizeof(regex_t));
if (regcomp(store.value_regex, value_regex, if (regcomp(store.value_regex, value_regex,
REG_EXTENDED)) { REG_EXTENDED)) {
error("invalid pattern: %s", value_regex); error(_("invalid pattern: %s"), value_regex);
FREE_AND_NULL(store.value_regex); FREE_AND_NULL(store.value_regex);
ret = CONFIG_INVALID_PATTERN; ret = CONFIG_INVALID_PATTERN;
goto out_free; goto out_free;
@ -2748,7 +2748,7 @@ int git_config_set_multivar_in_file_gently(const char *config_filename,
if (git_config_from_file_with_options(store_aux, if (git_config_from_file_with_options(store_aux,
config_filename, config_filename,
&store, &opts)) { &store, &opts)) {
error("invalid config file %s", config_filename); error(_("invalid config file %s"), config_filename);
ret = CONFIG_INVALID_FILE; ret = CONFIG_INVALID_FILE;
goto out_free; goto out_free;
} }
@ -2772,7 +2772,7 @@ int git_config_set_multivar_in_file_gently(const char *config_filename,
if (contents == MAP_FAILED) { if (contents == MAP_FAILED) {
if (errno == ENODEV && S_ISDIR(st.st_mode)) if (errno == ENODEV && S_ISDIR(st.st_mode))
errno = EISDIR; errno = EISDIR;
error_errno("unable to mmap '%s'", config_filename); error_errno(_("unable to mmap '%s'"), config_filename);
ret = CONFIG_INVALID_FILE; ret = CONFIG_INVALID_FILE;
contents = NULL; contents = NULL;
goto out_free; goto out_free;
@ -2781,7 +2781,7 @@ int git_config_set_multivar_in_file_gently(const char *config_filename,
in_fd = -1; in_fd = -1;
if (chmod(get_lock_file_path(&lock), st.st_mode & 07777) < 0) { if (chmod(get_lock_file_path(&lock), st.st_mode & 07777) < 0) {
error_errno("chmod on %s failed", get_lock_file_path(&lock)); error_errno(_("chmod on %s failed"), get_lock_file_path(&lock));
ret = CONFIG_NO_WRITE; ret = CONFIG_NO_WRITE;
goto out_free; goto out_free;
} }
@ -2866,7 +2866,7 @@ int git_config_set_multivar_in_file_gently(const char *config_filename,
} }
if (commit_lock_file(&lock) < 0) { if (commit_lock_file(&lock) < 0) {
error_errno("could not write config file %s", config_filename); error_errno(_("could not write config file %s"), config_filename);
ret = CONFIG_NO_WRITE; ret = CONFIG_NO_WRITE;
goto out_free; goto out_free;
} }
@ -2992,7 +2992,7 @@ static int git_config_copy_or_rename_section_in_file(const char *config_filename
memset(&store, 0, sizeof(store)); memset(&store, 0, sizeof(store));
if (new_name && !section_name_is_ok(new_name)) { if (new_name && !section_name_is_ok(new_name)) {
ret = error("invalid section name: %s", new_name); ret = error(_("invalid section name: %s"), new_name);
goto out_no_rollback; goto out_no_rollback;
} }
@ -3001,7 +3001,7 @@ static int git_config_copy_or_rename_section_in_file(const char *config_filename
out_fd = hold_lock_file_for_update(&lock, config_filename, 0); out_fd = hold_lock_file_for_update(&lock, config_filename, 0);
if (out_fd < 0) { if (out_fd < 0) {
ret = error("could not lock config file %s", config_filename); ret = error(_("could not lock config file %s"), config_filename);
goto out; goto out;
} }
@ -3019,7 +3019,7 @@ static int git_config_copy_or_rename_section_in_file(const char *config_filename
} }
if (chmod(get_lock_file_path(&lock), st.st_mode & 07777) < 0) { if (chmod(get_lock_file_path(&lock), st.st_mode & 07777) < 0) {
ret = error_errno("chmod on %s failed", ret = error_errno(_("chmod on %s failed"),
get_lock_file_path(&lock)); get_lock_file_path(&lock));
goto out; goto out;
} }
@ -3116,7 +3116,7 @@ static int git_config_copy_or_rename_section_in_file(const char *config_filename
config_file = NULL; config_file = NULL;
commit_and_out: commit_and_out:
if (commit_lock_file(&lock) < 0) if (commit_lock_file(&lock) < 0)
ret = error_errno("could not write config file %s", ret = error_errno(_("could not write config file %s"),
config_filename); config_filename);
out: out:
if (config_file) if (config_file)
@ -3159,7 +3159,7 @@ int git_config_copy_section(const char *old_name, const char *new_name)
#undef config_error_nonbool #undef config_error_nonbool
int config_error_nonbool(const char *var) int config_error_nonbool(const char *var)
{ {
return error("missing value for '%s'", var); return error(_("missing value for '%s'"), var);
} }
int parse_config_key(const char *var, int parse_config_key(const char *var,

View File

@ -58,7 +58,7 @@ static NORETURN void die_initial_contact(int unexpected)
* response does not necessarily mean an ACL problem, though. * response does not necessarily mean an ACL problem, though.
*/ */
if (unexpected) if (unexpected)
die(_("The remote end hung up upon initial contact")); die(_("the remote end hung up upon initial contact"));
else else
die(_("Could not read from remote repository.\n\n" die(_("Could not read from remote repository.\n\n"
"Please make sure you have the correct access rights\n" "Please make sure you have the correct access rights\n"
@ -78,7 +78,7 @@ int server_supports_v2(const char *c, int die_on_error)
} }
if (die_on_error) if (die_on_error)
die("server doesn't support '%s'", c); die(_("server doesn't support '%s'"), c);
return 0; return 0;
} }
@ -100,7 +100,7 @@ int server_supports_feature(const char *c, const char *feature,
} }
if (die_on_error) if (die_on_error)
die("server doesn't support feature '%s'", feature); die(_("server doesn't support feature '%s'"), feature);
return 0; return 0;
} }
@ -111,7 +111,7 @@ static void process_capabilities_v2(struct packet_reader *reader)
argv_array_push(&server_capabilities_v2, reader->line); argv_array_push(&server_capabilities_v2, reader->line);
if (reader->status != PACKET_READ_FLUSH) if (reader->status != PACKET_READ_FLUSH)
die("expected flush after capabilities"); die(_("expected flush after capabilities"));
} }
enum protocol_version discover_version(struct packet_reader *reader) enum protocol_version discover_version(struct packet_reader *reader)
@ -230,7 +230,7 @@ static int process_dummy_ref(const char *line)
static void check_no_capabilities(const char *line, int len) static void check_no_capabilities(const char *line, int len)
{ {
if (strlen(line) != len) if (strlen(line) != len)
warning("Ignoring capabilities after first line '%s'", warning(_("ignoring capabilities after first line '%s'"),
line + strlen(line)); line + strlen(line));
} }
@ -249,7 +249,7 @@ static int process_ref(const char *line, int len, struct ref ***list,
if (extra_have && !strcmp(name, ".have")) { if (extra_have && !strcmp(name, ".have")) {
oid_array_append(extra_have, &old_oid); oid_array_append(extra_have, &old_oid);
} else if (!strcmp(name, "capabilities^{}")) { } else if (!strcmp(name, "capabilities^{}")) {
die("protocol error: unexpected capabilities^{}"); die(_("protocol error: unexpected capabilities^{}"));
} else if (check_ref(name, flags)) { } else if (check_ref(name, flags)) {
struct ref *ref = alloc_ref(name); struct ref *ref = alloc_ref(name);
oidcpy(&ref->old_oid, &old_oid); oidcpy(&ref->old_oid, &old_oid);
@ -270,9 +270,9 @@ static int process_shallow(const char *line, int len,
return 0; return 0;
if (get_oid_hex(arg, &old_oid)) if (get_oid_hex(arg, &old_oid))
die("protocol error: expected shallow sha-1, got '%s'", arg); die(_("protocol error: expected shallow sha-1, got '%s'"), arg);
if (!shallow_points) if (!shallow_points)
die("repository on the other end cannot be shallow"); die(_("repository on the other end cannot be shallow"));
oid_array_append(shallow_points, &old_oid); oid_array_append(shallow_points, &old_oid);
check_no_capabilities(line, len); check_no_capabilities(line, len);
return 1; return 1;
@ -307,13 +307,13 @@ struct ref **get_remote_heads(struct packet_reader *reader,
case PACKET_READ_NORMAL: case PACKET_READ_NORMAL:
len = reader->pktlen; len = reader->pktlen;
if (len > 4 && skip_prefix(reader->line, "ERR ", &arg)) if (len > 4 && skip_prefix(reader->line, "ERR ", &arg))
die("remote error: %s", arg); die(_("remote error: %s"), arg);
break; break;
case PACKET_READ_FLUSH: case PACKET_READ_FLUSH:
state = EXPECTING_DONE; state = EXPECTING_DONE;
break; break;
case PACKET_READ_DELIM: case PACKET_READ_DELIM:
die("invalid packet"); die(_("invalid packet"));
} }
switch (state) { switch (state) {
@ -333,7 +333,7 @@ struct ref **get_remote_heads(struct packet_reader *reader,
case EXPECTING_SHALLOW: case EXPECTING_SHALLOW:
if (process_shallow(reader->line, len, shallow_points)) if (process_shallow(reader->line, len, shallow_points))
break; break;
die("protocol error: unexpected '%s'", reader->line); die(_("protocol error: unexpected '%s'"), reader->line);
case EXPECTING_DONE: case EXPECTING_DONE:
break; break;
} }
@ -441,11 +441,11 @@ struct ref **get_remote_refs(int fd_out, struct packet_reader *reader,
/* Process response from server */ /* Process response from server */
while (packet_reader_read(reader) == PACKET_READ_NORMAL) { while (packet_reader_read(reader) == PACKET_READ_NORMAL) {
if (!process_ref_v2(reader->line, &list)) if (!process_ref_v2(reader->line, &list))
die("invalid ls-refs response: %s", reader->line); die(_("invalid ls-refs response: %s"), reader->line);
} }
if (reader->status != PACKET_READ_FLUSH) if (reader->status != PACKET_READ_FLUSH)
die("expected flush after ref listing"); die(_("expected flush after ref listing"));
return list; return list;
} }
@ -544,7 +544,7 @@ static enum protocol get_protocol(const char *name)
return PROTO_SSH; return PROTO_SSH;
if (!strcmp(name, "file")) if (!strcmp(name, "file"))
return PROTO_FILE; return PROTO_FILE;
die("I don't handle protocol '%s'", name); die(_("protocol '%s' is not supported"), name);
} }
static char *host_end(char **hoststart, int removebrackets) static char *host_end(char **hoststart, int removebrackets)
@ -595,8 +595,7 @@ static void enable_keepalive(int sockfd)
int ka = 1; int ka = 1;
if (setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, &ka, sizeof(ka)) < 0) if (setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, &ka, sizeof(ka)) < 0)
fprintf(stderr, "unable to set SO_KEEPALIVE on socket: %s\n", error_errno(_("unable to set SO_KEEPALIVE on socket"));
strerror(errno));
} }
#ifndef NO_IPV6 #ifndef NO_IPV6
@ -636,14 +635,15 @@ static int git_tcp_connect_sock(char *host, int flags)
hints.ai_protocol = IPPROTO_TCP; hints.ai_protocol = IPPROTO_TCP;
if (flags & CONNECT_VERBOSE) if (flags & CONNECT_VERBOSE)
fprintf(stderr, "Looking up %s ... ", host); fprintf(stderr, _("Looking up %s ... "), host);
gai = getaddrinfo(host, port, &hints, &ai); gai = getaddrinfo(host, port, &hints, &ai);
if (gai) if (gai)
die("Unable to look up %s (port %s) (%s)", host, port, gai_strerror(gai)); die(_("unable to look up %s (port %s) (%s)"), host, port, gai_strerror(gai));
if (flags & CONNECT_VERBOSE) if (flags & CONNECT_VERBOSE)
fprintf(stderr, "done.\nConnecting to %s (port %s) ... ", host, port); /* TRANSLATORS: this is the end of "Looking up %s ... " */
fprintf(stderr, _("done.\nConnecting to %s (port %s) ... "), host, port);
for (ai0 = ai; ai; ai = ai->ai_next, cnt++) { for (ai0 = ai; ai; ai = ai->ai_next, cnt++) {
sockfd = socket(ai->ai_family, sockfd = socket(ai->ai_family,
@ -665,12 +665,13 @@ static int git_tcp_connect_sock(char *host, int flags)
freeaddrinfo(ai0); freeaddrinfo(ai0);
if (sockfd < 0) if (sockfd < 0)
die("unable to connect to %s:\n%s", host, error_message.buf); die(_("unable to connect to %s:\n%s"), host, error_message.buf);
enable_keepalive(sockfd); enable_keepalive(sockfd);
if (flags & CONNECT_VERBOSE) if (flags & CONNECT_VERBOSE)
fprintf(stderr, "done.\n"); /* TRANSLATORS: this is the end of "Connecting to %s (port %s) ... " */
fprintf_ln(stderr, _("done."));
strbuf_release(&error_message); strbuf_release(&error_message);
@ -697,22 +698,23 @@ static int git_tcp_connect_sock(char *host, int flags)
get_host_and_port(&host, &port); get_host_and_port(&host, &port);
if (flags & CONNECT_VERBOSE) if (flags & CONNECT_VERBOSE)
fprintf(stderr, "Looking up %s ... ", host); fprintf(stderr, _("Looking up %s ... "), host);
he = gethostbyname(host); he = gethostbyname(host);
if (!he) if (!he)
die("Unable to look up %s (%s)", host, hstrerror(h_errno)); die(_("unable to look up %s (%s)"), host, hstrerror(h_errno));
nport = strtoul(port, &ep, 10); nport = strtoul(port, &ep, 10);
if ( ep == port || *ep ) { if ( ep == port || *ep ) {
/* Not numeric */ /* Not numeric */
struct servent *se = getservbyname(port,"tcp"); struct servent *se = getservbyname(port,"tcp");
if ( !se ) if ( !se )
die("Unknown port %s", port); die(_("unknown port %s"), port);
nport = se->s_port; nport = se->s_port;
} }
if (flags & CONNECT_VERBOSE) if (flags & CONNECT_VERBOSE)
fprintf(stderr, "done.\nConnecting to %s (port %s) ... ", host, port); /* TRANSLATORS: this is the end of "Looking up %s ... " */
fprintf(stderr, _("done.\nConnecting to %s (port %s) ... "), host, port);
for (cnt = 0, ap = he->h_addr_list; *ap; ap++, cnt++) { for (cnt = 0, ap = he->h_addr_list; *ap; ap++, cnt++) {
memset(&sa, 0, sizeof sa); memset(&sa, 0, sizeof sa);
@ -740,12 +742,13 @@ static int git_tcp_connect_sock(char *host, int flags)
} }
if (sockfd < 0) if (sockfd < 0)
die("unable to connect to %s:\n%s", host, error_message.buf); die(_("unable to connect to %s:\n%s"), host, error_message.buf);
enable_keepalive(sockfd); enable_keepalive(sockfd);
if (flags & CONNECT_VERBOSE) if (flags & CONNECT_VERBOSE)
fprintf(stderr, "done.\n"); /* TRANSLATORS: this is the end of "Connecting to %s (port %s) ... " */
fprintf_ln(stderr, _("done."));
return sockfd; return sockfd;
} }
@ -842,9 +845,9 @@ static struct child_process *git_proxy_connect(int fd[2], char *host)
get_host_and_port(&host, &port); get_host_and_port(&host, &port);
if (looks_like_command_line_option(host)) if (looks_like_command_line_option(host))
die("strange hostname '%s' blocked", host); die(_("strange hostname '%s' blocked"), host);
if (looks_like_command_line_option(port)) if (looks_like_command_line_option(port))
die("strange port '%s' blocked", port); die(_("strange port '%s' blocked"), port);
proxy = xmalloc(sizeof(*proxy)); proxy = xmalloc(sizeof(*proxy));
child_process_init(proxy); child_process_init(proxy);
@ -854,7 +857,7 @@ static struct child_process *git_proxy_connect(int fd[2], char *host)
proxy->in = -1; proxy->in = -1;
proxy->out = -1; proxy->out = -1;
if (start_command(proxy)) if (start_command(proxy))
die("cannot start proxy %s", git_proxy_command); die(_("cannot start proxy %s"), git_proxy_command);
fd[0] = proxy->out; /* read from proxy stdout */ fd[0] = proxy->out; /* read from proxy stdout */
fd[1] = proxy->in; /* write to proxy stdin */ fd[1] = proxy->in; /* write to proxy stdin */
return proxy; return proxy;
@ -921,7 +924,7 @@ static enum protocol parse_connect_url(const char *url_orig, char **ret_host,
path = strchr(end, separator); path = strchr(end, separator);
if (!path || !*path) if (!path || !*path)
die("No path specified. See 'man git-pull' for valid url syntax"); die(_("no path specified; see 'git help pull' for valid url syntax"));
/* /*
* null-terminate hostname and point path to ~ for URL's like this: * null-terminate hostname and point path to ~ for URL's like this:
@ -1116,7 +1119,7 @@ static void push_ssh_options(struct argv_array *args, struct argv_array *env,
case VARIANT_AUTO: case VARIANT_AUTO:
BUG("VARIANT_AUTO passed to push_ssh_options"); BUG("VARIANT_AUTO passed to push_ssh_options");
case VARIANT_SIMPLE: case VARIANT_SIMPLE:
die("ssh variant 'simple' does not support -4"); die(_("ssh variant 'simple' does not support -4"));
case VARIANT_SSH: case VARIANT_SSH:
case VARIANT_PLINK: case VARIANT_PLINK:
case VARIANT_PUTTY: case VARIANT_PUTTY:
@ -1128,7 +1131,7 @@ static void push_ssh_options(struct argv_array *args, struct argv_array *env,
case VARIANT_AUTO: case VARIANT_AUTO:
BUG("VARIANT_AUTO passed to push_ssh_options"); BUG("VARIANT_AUTO passed to push_ssh_options");
case VARIANT_SIMPLE: case VARIANT_SIMPLE:
die("ssh variant 'simple' does not support -6"); die(_("ssh variant 'simple' does not support -6"));
case VARIANT_SSH: case VARIANT_SSH:
case VARIANT_PLINK: case VARIANT_PLINK:
case VARIANT_PUTTY: case VARIANT_PUTTY:
@ -1145,7 +1148,7 @@ static void push_ssh_options(struct argv_array *args, struct argv_array *env,
case VARIANT_AUTO: case VARIANT_AUTO:
BUG("VARIANT_AUTO passed to push_ssh_options"); BUG("VARIANT_AUTO passed to push_ssh_options");
case VARIANT_SIMPLE: case VARIANT_SIMPLE:
die("ssh variant 'simple' does not support setting port"); die(_("ssh variant 'simple' does not support setting port"));
case VARIANT_SSH: case VARIANT_SSH:
argv_array_push(args, "-p"); argv_array_push(args, "-p");
break; break;
@ -1168,7 +1171,7 @@ static void fill_ssh_args(struct child_process *conn, const char *ssh_host,
enum ssh_variant variant; enum ssh_variant variant;
if (looks_like_command_line_option(ssh_host)) if (looks_like_command_line_option(ssh_host))
die("strange hostname '%s' blocked", ssh_host); die(_("strange hostname '%s' blocked"), ssh_host);
ssh = get_ssh_command(); ssh = get_ssh_command();
if (ssh) { if (ssh) {
@ -1256,7 +1259,7 @@ struct child_process *git_connect(int fd[2], const char *url,
child_process_init(conn); child_process_init(conn);
if (looks_like_command_line_option(path)) if (looks_like_command_line_option(path))
die("strange pathname '%s' blocked", path); die(_("strange pathname '%s' blocked"), path);
strbuf_addstr(&cmd, prog); strbuf_addstr(&cmd, prog);
strbuf_addch(&cmd, ' '); strbuf_addch(&cmd, ' ');
@ -1301,7 +1304,7 @@ struct child_process *git_connect(int fd[2], const char *url,
argv_array_push(&conn->args, cmd.buf); argv_array_push(&conn->args, cmd.buf);
if (start_command(conn)) if (start_command(conn))
die("unable to fork"); die(_("unable to fork"));
fd[0] = conn->out; /* read from child's stdout */ fd[0] = conn->out; /* read from child's stdout */
fd[1] = conn->in; /* write to child's stdin */ fd[1] = conn->in; /* write to child's stdin */

View File

@ -191,7 +191,7 @@ static enum eol output_eol(enum crlf_action crlf_action)
/* fall through */ /* fall through */
return text_eol_is_crlf() ? EOL_CRLF : EOL_LF; return text_eol_is_crlf() ? EOL_CRLF : EOL_LF;
} }
warning("Illegal crlf_action %d\n", (int)crlf_action); warning(_("illegal crlf_action %d"), (int)crlf_action);
return core_eol; return core_eol;
} }
@ -204,11 +204,11 @@ static void check_global_conv_flags_eol(const char *path, enum crlf_action crlf_
* CRLFs would not be restored by checkout * CRLFs would not be restored by checkout
*/ */
if (conv_flags & CONV_EOL_RNDTRP_DIE) if (conv_flags & CONV_EOL_RNDTRP_DIE)
die(_("CRLF would be replaced by LF in %s."), path); die(_("CRLF would be replaced by LF in %s"), path);
else if (conv_flags & CONV_EOL_RNDTRP_WARN) else if (conv_flags & CONV_EOL_RNDTRP_WARN)
warning(_("CRLF will be replaced by LF in %s.\n" warning(_("CRLF will be replaced by LF in %s.\n"
"The file will have its original line" "The file will have its original line"
" endings in your working directory."), path); " endings in your working directory"), path);
} else if (old_stats->lonelf && !new_stats->lonelf ) { } else if (old_stats->lonelf && !new_stats->lonelf ) {
/* /*
* CRLFs would be added by checkout * CRLFs would be added by checkout
@ -218,7 +218,7 @@ static void check_global_conv_flags_eol(const char *path, enum crlf_action crlf_
else if (conv_flags & CONV_EOL_RNDTRP_WARN) else if (conv_flags & CONV_EOL_RNDTRP_WARN)
warning(_("LF will be replaced by CRLF in %s.\n" warning(_("LF will be replaced by CRLF in %s.\n"
"The file will have its original line" "The file will have its original line"
" endings in your working directory."), path); " endings in your working directory"), path);
} }
} }
@ -493,8 +493,8 @@ static int encode_to_worktree(const char *path, const char *src, size_t src_len,
dst = reencode_string_len(src, src_len, enc, default_encoding, dst = reencode_string_len(src, src_len, enc, default_encoding,
&dst_len); &dst_len);
if (!dst) { if (!dst) {
error("failed to encode '%s' from %s to %s", error(_("failed to encode '%s' from %s to %s"),
path, default_encoding, enc); path, default_encoding, enc);
return 0; return 0;
} }
@ -671,7 +671,8 @@ static int filter_buffer_or_fd(int in, int out, void *data)
if (start_command(&child_process)) { if (start_command(&child_process)) {
strbuf_release(&cmd); strbuf_release(&cmd);
return error("cannot fork to run external filter '%s'", params->cmd); return error(_("cannot fork to run external filter '%s'"),
params->cmd);
} }
sigchain_push(SIGPIPE, SIG_IGN); sigchain_push(SIGPIPE, SIG_IGN);
@ -690,13 +691,14 @@ static int filter_buffer_or_fd(int in, int out, void *data)
if (close(child_process.in)) if (close(child_process.in))
write_err = 1; write_err = 1;
if (write_err) if (write_err)
error("cannot feed the input to external filter '%s'", params->cmd); error(_("cannot feed the input to external filter '%s'"),
params->cmd);
sigchain_pop(SIGPIPE); sigchain_pop(SIGPIPE);
status = finish_command(&child_process); status = finish_command(&child_process);
if (status) if (status)
error("external filter '%s' failed %d", params->cmd, status); error(_("external filter '%s' failed %d"), params->cmd, status);
strbuf_release(&cmd); strbuf_release(&cmd);
return (write_err || status); return (write_err || status);
@ -731,13 +733,13 @@ static int apply_single_file_filter(const char *path, const char *src, size_t le
return 0; /* error was already reported */ return 0; /* error was already reported */
if (strbuf_read(&nbuf, async.out, len) < 0) { if (strbuf_read(&nbuf, async.out, len) < 0) {
err = error("read from external filter '%s' failed", cmd); err = error(_("read from external filter '%s' failed"), cmd);
} }
if (close(async.out)) { if (close(async.out)) {
err = error("read from external filter '%s' failed", cmd); err = error(_("read from external filter '%s' failed"), cmd);
} }
if (finish_async(&async)) { if (finish_async(&async)) {
err = error("external filter '%s' failed", cmd); err = error(_("external filter '%s' failed"), cmd);
} }
if (!err) { if (!err) {
@ -791,7 +793,7 @@ static void handle_filter_error(const struct strbuf *filter_status,
* Something went wrong with the protocol filter. * Something went wrong with the protocol filter.
* Force shutdown and restart if another blob requires filtering. * Force shutdown and restart if another blob requires filtering.
*/ */
error("external filter '%s' failed", entry->subprocess.cmd); error(_("external filter '%s' failed"), entry->subprocess.cmd);
subprocess_stop(&subprocess_map, &entry->subprocess); subprocess_stop(&subprocess_map, &entry->subprocess);
free(entry); free(entry);
} }
@ -839,7 +841,7 @@ static int apply_multi_file_filter(const char *path, const char *src, size_t len
else if (wanted_capability & CAP_SMUDGE) else if (wanted_capability & CAP_SMUDGE)
filter_type = "smudge"; filter_type = "smudge";
else else
die("unexpected filter type"); die(_("unexpected filter type"));
sigchain_push(SIGPIPE, SIG_IGN); sigchain_push(SIGPIPE, SIG_IGN);
@ -850,7 +852,7 @@ static int apply_multi_file_filter(const char *path, const char *src, size_t len
err = strlen(path) > LARGE_PACKET_DATA_MAX - strlen("pathname=\n"); err = strlen(path) > LARGE_PACKET_DATA_MAX - strlen("pathname=\n");
if (err) { if (err) {
error("path name too long for external filter"); error(_("path name too long for external filter"));
goto done; goto done;
} }
@ -924,8 +926,8 @@ int async_query_available_blobs(const char *cmd, struct string_list *available_p
assert(subprocess_map_initialized); assert(subprocess_map_initialized);
entry = (struct cmd2process *)subprocess_find_entry(&subprocess_map, cmd); entry = (struct cmd2process *)subprocess_find_entry(&subprocess_map, cmd);
if (!entry) { if (!entry) {
error("external filter '%s' is not available anymore although " error(_("external filter '%s' is not available anymore although "
"not all paths have been filtered", cmd); "not all paths have been filtered"), cmd);
return 0; return 0;
} }
process = &entry->subprocess.process; process = &entry->subprocess.process;
@ -1396,7 +1398,7 @@ int convert_to_git(const struct index_state *istate,
ret |= apply_filter(path, src, len, -1, dst, ca.drv, CAP_CLEAN, NULL); ret |= apply_filter(path, src, len, -1, dst, ca.drv, CAP_CLEAN, NULL);
if (!ret && ca.drv && ca.drv->required) if (!ret && ca.drv && ca.drv->required)
die("%s: clean filter '%s' failed", path, ca.drv->name); die(_("%s: clean filter '%s' failed"), path, ca.drv->name);
if (ret && dst) { if (ret && dst) {
src = dst->buf; src = dst->buf;
@ -1430,7 +1432,7 @@ void convert_to_git_filter_fd(const struct index_state *istate,
assert(ca.drv->clean || ca.drv->process); assert(ca.drv->clean || ca.drv->process);
if (!apply_filter(path, NULL, 0, fd, dst, ca.drv, CAP_CLEAN, NULL)) if (!apply_filter(path, NULL, 0, fd, dst, ca.drv, CAP_CLEAN, NULL))
die("%s: clean filter '%s' failed", path, ca.drv->name); die(_("%s: clean filter '%s' failed"), path, ca.drv->name);
encode_to_git(path, dst->buf, dst->len, dst, ca.working_tree_encoding, conv_flags); encode_to_git(path, dst->buf, dst->len, dst, ca.working_tree_encoding, conv_flags);
crlf_to_git(istate, path, dst->buf, dst->len, dst, ca.crlf_action, conv_flags); crlf_to_git(istate, path, dst->buf, dst->len, dst, ca.crlf_action, conv_flags);
@ -1473,7 +1475,7 @@ static int convert_to_working_tree_internal(const char *path, const char *src,
ret_filter = apply_filter( ret_filter = apply_filter(
path, src, len, -1, dst, ca.drv, CAP_SMUDGE, dco); path, src, len, -1, dst, ca.drv, CAP_SMUDGE, dco);
if (!ret_filter && ca.drv && ca.drv->required) if (!ret_filter && ca.drv && ca.drv->required)
die("%s: smudge filter %s failed", path, ca.drv->name); die(_("%s: smudge filter %s failed"), path, ca.drv->name);
return ret | ret_filter; return ret | ret_filter;
} }

4
diff.c
View File

@ -2071,8 +2071,8 @@ static void init_diff_words_data(struct emit_callback *ecbdata,
if (regcomp(ecbdata->diff_words->word_regex, if (regcomp(ecbdata->diff_words->word_regex,
o->word_regex, o->word_regex,
REG_EXTENDED | REG_NEWLINE)) REG_EXTENDED | REG_NEWLINE))
die ("Invalid regular expression: %s", die("invalid regular expression: %s",
o->word_regex); o->word_regex);
} }
for (i = 0; i < ARRAY_SIZE(diff_words_styles); i++) { for (i = 0; i < ARRAY_SIZE(diff_words_styles); i++) {
if (o->word_diff == diff_words_styles[i].type) { if (o->word_diff == diff_words_styles[i].type) {

8
dir.c
View File

@ -561,7 +561,7 @@ int report_path_error(const char *ps_matched,
if (found_dup) if (found_dup)
continue; continue;
error("pathspec '%s' did not match any file(s) known to git.", error(_("pathspec '%s' did not match any file(s) known to git"),
pathspec->items[num].original); pathspec->items[num].original);
errors++; errors++;
} }
@ -950,7 +950,7 @@ static void add_excludes_from_file_1(struct dir_struct *dir, const char *fname,
dir->unmanaged_exclude_files++; dir->unmanaged_exclude_files++;
el = add_exclude_list(dir, EXC_FILE, fname); el = add_exclude_list(dir, EXC_FILE, fname);
if (add_excludes(fname, "", 0, el, NULL, oid_stat) < 0) if (add_excludes(fname, "", 0, el, NULL, oid_stat) < 0)
die("cannot use %s as an exclude file", fname); die(_("cannot use %s as an exclude file"), fname);
} }
void add_excludes_from_file(struct dir_struct *dir, const char *fname) void add_excludes_from_file(struct dir_struct *dir, const char *fname)
@ -2231,7 +2231,7 @@ static struct untracked_cache_dir *validate_untracked_cache(struct dir_struct *d
return NULL; return NULL;
if (!ident_in_untracked(dir->untracked)) { if (!ident_in_untracked(dir->untracked)) {
warning(_("Untracked cache is disabled on this system or location.")); warning(_("untracked cache is disabled on this system or location"));
return NULL; return NULL;
} }
@ -3029,7 +3029,7 @@ static void connect_wt_gitdir_in_nested(const char *sub_worktree,
return; return;
if (repo_read_index(&subrepo) < 0) if (repo_read_index(&subrepo) < 0)
die("index file corrupt in repo %s", subrepo.gitdir); die(_("index file corrupt in repo %s"), subrepo.gitdir);
for (i = 0; i < subrepo.index->cache_nr; i++) { for (i = 0; i < subrepo.index->cache_nr; i++) {
const struct cache_entry *ce = subrepo.index->cache[i]; const struct cache_entry *ce = subrepo.index->cache[i];

View File

@ -146,7 +146,7 @@ static char *expand_namespace(const char *raw_namespace)
strbuf_addf(&buf, "refs/namespaces/%s", (*c)->buf); strbuf_addf(&buf, "refs/namespaces/%s", (*c)->buf);
strbuf_list_free(components); strbuf_list_free(components);
if (check_refname_format(buf.buf, 0)) if (check_refname_format(buf.buf, 0))
die("bad git namespace path \"%s\"", raw_namespace); die(_("bad git namespace path \"%s\""), raw_namespace);
strbuf_addch(&buf, '/'); strbuf_addch(&buf, '/');
return strbuf_detach(&buf, NULL); return strbuf_detach(&buf, NULL);
} }
@ -328,7 +328,7 @@ char *get_graft_file(struct repository *r)
static void set_git_dir_1(const char *path) static void set_git_dir_1(const char *path)
{ {
if (setenv(GIT_DIR_ENVIRONMENT, path, 1)) if (setenv(GIT_DIR_ENVIRONMENT, path, 1))
die("could not set GIT_DIR to '%s'", path); die(_("could not set GIT_DIR to '%s'"), path);
setup_git_env(path); setup_git_env(path);
} }

View File

@ -358,7 +358,7 @@ int execl_git_cmd(const char *cmd, ...)
} }
va_end(param); va_end(param);
if (MAX_ARGS <= argc) if (MAX_ARGS <= argc)
return error("too many args to run %s", cmd); return error(_("too many args to run %s"), cmd);
argv[argc] = NULL; argv[argc] = NULL;
return execv_git_cmd(argv); return execv_git_cmd(argv);

View File

@ -51,7 +51,7 @@ int type_from_string_gently(const char *str, ssize_t len, int gentle)
if (gentle) if (gentle)
return -1; return -1;
die("invalid object type \"%s\"", str); die(_("invalid object type \"%s\""), str);
} }
/* /*
@ -170,7 +170,7 @@ void *object_as_type(struct repository *r, struct object *obj, enum object_type
} }
else { else {
if (!quiet) if (!quiet)
error("object %s is a %s, not a %s", error(_("object %s is a %s, not a %s"),
oid_to_hex(&obj->oid), oid_to_hex(&obj->oid),
type_name(obj->type), type_name(type)); type_name(obj->type), type_name(type));
return NULL; return NULL;
@ -230,7 +230,7 @@ struct object *parse_object_buffer(struct repository *r, const struct object_id
obj = &tag->object; obj = &tag->object;
} }
} else { } else {
warning("object %s has unknown type id %d", oid_to_hex(oid), type); warning(_("object %s has unknown type id %d"), oid_to_hex(oid), type);
obj = NULL; obj = NULL;
} }
return obj; return obj;
@ -263,7 +263,7 @@ struct object *parse_object(struct repository *r, const struct object_id *oid)
(!obj && has_object_file(oid) && (!obj && has_object_file(oid) &&
oid_object_info(r, oid, NULL) == OBJ_BLOB)) { oid_object_info(r, oid, NULL) == OBJ_BLOB)) {
if (check_object_signature(repl, NULL, 0, NULL) < 0) { if (check_object_signature(repl, NULL, 0, NULL) < 0) {
error("sha1 mismatch %s", oid_to_hex(oid)); error(_("sha1 mismatch %s"), oid_to_hex(oid));
return NULL; return NULL;
} }
parse_blob_buffer(lookup_blob(r, oid), NULL, 0); parse_blob_buffer(lookup_blob(r, oid), NULL, 0);
@ -274,7 +274,7 @@ struct object *parse_object(struct repository *r, const struct object_id *oid)
if (buffer) { if (buffer) {
if (check_object_signature(repl, buffer, size, type_name(type)) < 0) { if (check_object_signature(repl, buffer, size, type_name(type)) < 0) {
free(buffer); free(buffer);
error("sha1 mismatch %s", oid_to_hex(repl)); error(_("sha1 mismatch %s"), oid_to_hex(repl));
return NULL; return NULL;
} }

View File

@ -101,7 +101,7 @@ int packet_flush_gently(int fd)
{ {
packet_trace("0000", 4, 1); packet_trace("0000", 4, 1);
if (write_in_full(fd, "0000", 4) < 0) if (write_in_full(fd, "0000", 4) < 0)
return error("flush packet write failed"); return error(_("flush packet write failed"));
return 0; return 0;
} }
@ -139,7 +139,7 @@ static void format_packet(struct strbuf *out, const char *fmt, va_list args)
n = out->len - orig_len; n = out->len - orig_len;
if (n > LARGE_PACKET_MAX) if (n > LARGE_PACKET_MAX)
die("protocol error: impossibly long line"); die(_("protocol error: impossibly long line"));
set_packet_header(&out->buf[orig_len], n); set_packet_header(&out->buf[orig_len], n);
packet_trace(out->buf + orig_len + 4, n - 4, 1); packet_trace(out->buf + orig_len + 4, n - 4, 1);
@ -155,9 +155,9 @@ static int packet_write_fmt_1(int fd, int gently,
if (write_in_full(fd, buf.buf, buf.len) < 0) { if (write_in_full(fd, buf.buf, buf.len) < 0) {
if (!gently) { if (!gently) {
check_pipe(errno); check_pipe(errno);
die_errno("packet write with format failed"); die_errno(_("packet write with format failed"));
} }
return error("packet write with format failed"); return error(_("packet write with format failed"));
} }
return 0; return 0;
@ -189,21 +189,21 @@ static int packet_write_gently(const int fd_out, const char *buf, size_t size)
size_t packet_size; size_t packet_size;
if (size > sizeof(packet_write_buffer) - 4) if (size > sizeof(packet_write_buffer) - 4)
return error("packet write failed - data exceeds max packet size"); return error(_("packet write failed - data exceeds max packet size"));
packet_trace(buf, size, 1); packet_trace(buf, size, 1);
packet_size = size + 4; packet_size = size + 4;
set_packet_header(packet_write_buffer, packet_size); set_packet_header(packet_write_buffer, packet_size);
memcpy(packet_write_buffer + 4, buf, size); memcpy(packet_write_buffer + 4, buf, size);
if (write_in_full(fd_out, packet_write_buffer, packet_size) < 0) if (write_in_full(fd_out, packet_write_buffer, packet_size) < 0)
return error("packet write failed"); return error(_("packet write failed"));
return 0; return 0;
} }
void packet_write(int fd_out, const char *buf, size_t size) void packet_write(int fd_out, const char *buf, size_t size)
{ {
if (packet_write_gently(fd_out, buf, size)) if (packet_write_gently(fd_out, buf, size))
die_errno("packet write failed"); die_errno(_("packet write failed"));
} }
void packet_buf_write(struct strbuf *buf, const char *fmt, ...) void packet_buf_write(struct strbuf *buf, const char *fmt, ...)
@ -225,7 +225,7 @@ void packet_buf_write_len(struct strbuf *buf, const char *data, size_t len)
n = buf->len - orig_len; n = buf->len - orig_len;
if (n > LARGE_PACKET_MAX) if (n > LARGE_PACKET_MAX)
die("protocol error: impossibly long line"); die(_("protocol error: impossibly long line"));
set_packet_header(&buf->buf[orig_len], n); set_packet_header(&buf->buf[orig_len], n);
packet_trace(data, len, 1); packet_trace(data, len, 1);
@ -288,7 +288,7 @@ static int get_packet_data(int fd, char **src_buf, size_t *src_size,
} else { } else {
ret = read_in_full(fd, dst, size); ret = read_in_full(fd, dst, size);
if (ret < 0) if (ret < 0)
die_errno("read error"); die_errno(_("read error"));
} }
/* And complain if we didn't get enough bytes to satisfy the read. */ /* And complain if we didn't get enough bytes to satisfy the read. */
@ -296,7 +296,7 @@ static int get_packet_data(int fd, char **src_buf, size_t *src_size,
if (options & PACKET_READ_GENTLE_ON_EOF) if (options & PACKET_READ_GENTLE_ON_EOF)
return -1; return -1;
die("The remote end hung up unexpectedly"); die(_("the remote end hung up unexpectedly"));
} }
return ret; return ret;
@ -324,7 +324,7 @@ enum packet_read_status packet_read_with_status(int fd, char **src_buffer,
len = packet_length(linelen); len = packet_length(linelen);
if (len < 0) { if (len < 0) {
die("protocol error: bad line length character: %.4s", linelen); die(_("protocol error: bad line length character: %.4s"), linelen);
} else if (!len) { } else if (!len) {
packet_trace("0000", 4, 0); packet_trace("0000", 4, 0);
*pktlen = 0; *pktlen = 0;
@ -334,12 +334,12 @@ enum packet_read_status packet_read_with_status(int fd, char **src_buffer,
*pktlen = 0; *pktlen = 0;
return PACKET_READ_DELIM; return PACKET_READ_DELIM;
} else if (len < 4) { } else if (len < 4) {
die("protocol error: bad line length %d", len); die(_("protocol error: bad line length %d"), len);
} }
len -= 4; len -= 4;
if ((unsigned)len >= size) if ((unsigned)len >= size)
die("protocol error: bad line length %d", len); die(_("protocol error: bad line length %d"), len);
if (get_packet_data(fd, src_buffer, src_len, buffer, len, options) < 0) { if (get_packet_data(fd, src_buffer, src_len, buffer, len, options) < 0) {
*pktlen = -1; *pktlen = -1;

View File

@ -128,7 +128,7 @@ int add_reflog_for_walk(struct reflog_walk_info *info,
enum selector_type selector = SELECTOR_NONE; enum selector_type selector = SELECTOR_NONE;
if (commit->object.flags & UNINTERESTING) if (commit->object.flags & UNINTERESTING)
die ("Cannot walk reflogs for %s", name); die("cannot walk reflogs for %s", name);
branch = xstrdup(name); branch = xstrdup(name);
if (at && at[1] == '{') { if (at && at[1] == '{') {
@ -153,7 +153,7 @@ int add_reflog_for_walk(struct reflog_walk_info *info,
free(branch); free(branch);
branch = resolve_refdup("HEAD", 0, NULL, NULL); branch = resolve_refdup("HEAD", 0, NULL, NULL);
if (!branch) if (!branch)
die ("No current branch"); die("no current branch");
} }
reflogs = read_complete_reflog(branch); reflogs = read_complete_reflog(branch);

40
refs.c
View File

@ -189,7 +189,7 @@ int ref_resolves_to_object(const char *refname,
if (flags & REF_ISBROKEN) if (flags & REF_ISBROKEN)
return 0; return 0;
if (!has_sha1_file(oid->hash)) { if (!has_sha1_file(oid->hash)) {
error("%s does not point to a valid object!", refname); error(_("%s does not point to a valid object!"), refname);
return 0; return 0;
} }
return 1; return 1;
@ -568,9 +568,9 @@ int expand_ref(const char *str, int len, struct object_id *oid, char **ref)
if (!warn_ambiguous_refs) if (!warn_ambiguous_refs)
break; break;
} else if ((flag & REF_ISSYMREF) && strcmp(fullref.buf, "HEAD")) { } else if ((flag & REF_ISSYMREF) && strcmp(fullref.buf, "HEAD")) {
warning("ignoring dangling symref %s.", fullref.buf); warning(_("ignoring dangling symref %s"), fullref.buf);
} else if ((flag & REF_ISBROKEN) && strchr(fullref.buf, '/')) { } else if ((flag & REF_ISBROKEN) && strchr(fullref.buf, '/')) {
warning("ignoring broken ref %s.", fullref.buf); warning(_("ignoring broken ref %s"), fullref.buf);
} }
} }
strbuf_release(&fullref); strbuf_release(&fullref);
@ -674,7 +674,7 @@ static int write_pseudoref(const char *pseudoref, const struct object_id *oid,
fd = hold_lock_file_for_update_timeout(&lock, filename, 0, fd = hold_lock_file_for_update_timeout(&lock, filename, 0,
get_files_ref_lock_timeout_ms()); get_files_ref_lock_timeout_ms());
if (fd < 0) { if (fd < 0) {
strbuf_addf(err, "could not open '%s' for writing: %s", strbuf_addf(err, _("could not open '%s' for writing: %s"),
filename, strerror(errno)); filename, strerror(errno));
goto done; goto done;
} }
@ -684,18 +684,18 @@ static int write_pseudoref(const char *pseudoref, const struct object_id *oid,
if (read_ref(pseudoref, &actual_old_oid)) { if (read_ref(pseudoref, &actual_old_oid)) {
if (!is_null_oid(old_oid)) { if (!is_null_oid(old_oid)) {
strbuf_addf(err, "could not read ref '%s'", strbuf_addf(err, _("could not read ref '%s'"),
pseudoref); pseudoref);
rollback_lock_file(&lock); rollback_lock_file(&lock);
goto done; goto done;
} }
} else if (is_null_oid(old_oid)) { } else if (is_null_oid(old_oid)) {
strbuf_addf(err, "ref '%s' already exists", strbuf_addf(err, _("ref '%s' already exists"),
pseudoref); pseudoref);
rollback_lock_file(&lock); rollback_lock_file(&lock);
goto done; goto done;
} else if (oidcmp(&actual_old_oid, old_oid)) { } else if (oidcmp(&actual_old_oid, old_oid)) {
strbuf_addf(err, "unexpected object ID when writing '%s'", strbuf_addf(err, _("unexpected object ID when writing '%s'"),
pseudoref); pseudoref);
rollback_lock_file(&lock); rollback_lock_file(&lock);
goto done; goto done;
@ -703,7 +703,7 @@ static int write_pseudoref(const char *pseudoref, const struct object_id *oid,
} }
if (write_in_full(fd, buf.buf, buf.len) < 0) { if (write_in_full(fd, buf.buf, buf.len) < 0) {
strbuf_addf(err, "could not write to '%s'", filename); strbuf_addf(err, _("could not write to '%s'"), filename);
rollback_lock_file(&lock); rollback_lock_file(&lock);
goto done; goto done;
} }
@ -735,9 +735,9 @@ static int delete_pseudoref(const char *pseudoref, const struct object_id *old_o
return -1; return -1;
} }
if (read_ref(pseudoref, &actual_old_oid)) if (read_ref(pseudoref, &actual_old_oid))
die("could not read ref '%s'", pseudoref); die(_("could not read ref '%s'"), pseudoref);
if (oidcmp(&actual_old_oid, old_oid)) { if (oidcmp(&actual_old_oid, old_oid)) {
error("unexpected object ID when deleting '%s'", error(_("unexpected object ID when deleting '%s'"),
pseudoref); pseudoref);
rollback_lock_file(&lock); rollback_lock_file(&lock);
return -1; return -1;
@ -868,13 +868,13 @@ static int read_ref_at_ent(struct object_id *ooid, struct object_id *noid,
if (!is_null_oid(&cb->ooid)) { if (!is_null_oid(&cb->ooid)) {
oidcpy(cb->oid, noid); oidcpy(cb->oid, noid);
if (oidcmp(&cb->ooid, noid)) if (oidcmp(&cb->ooid, noid))
warning("Log for ref %s has gap after %s.", warning(_("log for ref %s has gap after %s"),
cb->refname, show_date(cb->date, cb->tz, DATE_MODE(RFC2822))); cb->refname, show_date(cb->date, cb->tz, DATE_MODE(RFC2822)));
} }
else if (cb->date == cb->at_time) else if (cb->date == cb->at_time)
oidcpy(cb->oid, noid); oidcpy(cb->oid, noid);
else if (oidcmp(noid, cb->oid)) else if (oidcmp(noid, cb->oid))
warning("Log for ref %s unexpectedly ended on %s.", warning(_("log for ref %s unexpectedly ended on %s"),
cb->refname, show_date(cb->date, cb->tz, cb->refname, show_date(cb->date, cb->tz,
DATE_MODE(RFC2822))); DATE_MODE(RFC2822)));
oidcpy(&cb->ooid, ooid); oidcpy(&cb->ooid, ooid);
@ -932,7 +932,7 @@ int read_ref_at(const char *refname, unsigned int flags, timestamp_t at_time, in
if (flags & GET_OID_QUIETLY) if (flags & GET_OID_QUIETLY)
exit(128); exit(128);
else else
die("Log for %s is empty.", refname); die(_("log for %s is empty"), refname);
} }
if (cb.found_it) if (cb.found_it)
return 0; return 0;
@ -1024,7 +1024,7 @@ int ref_transaction_update(struct ref_transaction *transaction,
if ((new_oid && !is_null_oid(new_oid)) ? if ((new_oid && !is_null_oid(new_oid)) ?
check_refname_format(refname, REFNAME_ALLOW_ONELEVEL) : check_refname_format(refname, REFNAME_ALLOW_ONELEVEL) :
!refname_is_safe(refname)) { !refname_is_safe(refname)) {
strbuf_addf(err, "refusing to update ref with bad name '%s'", strbuf_addf(err, _("refusing to update ref with bad name '%s'"),
refname); refname);
return -1; return -1;
} }
@ -1100,7 +1100,7 @@ int refs_update_ref(struct ref_store *refs, const char *msg,
} }
} }
if (ret) { if (ret) {
const char *str = "update_ref failed for ref '%s': %s"; const char *str = _("update_ref failed for ref '%s': %s");
switch (onerr) { switch (onerr) {
case UPDATE_REFS_MSG_ON_ERR: case UPDATE_REFS_MSG_ON_ERR:
@ -1842,7 +1842,7 @@ int ref_update_reject_duplicates(struct string_list *refnames,
if (!cmp) { if (!cmp) {
strbuf_addf(err, strbuf_addf(err,
"multiple updates for ref '%s' not allowed.", _("multiple updates for ref '%s' not allowed"),
refnames->items[i].string); refnames->items[i].string);
return 1; return 1;
} else if (cmp > 0) { } else if (cmp > 0) {
@ -1970,13 +1970,13 @@ int refs_verify_refname_available(struct ref_store *refs,
continue; continue;
if (!refs_read_raw_ref(refs, dirname.buf, &oid, &referent, &type)) { if (!refs_read_raw_ref(refs, dirname.buf, &oid, &referent, &type)) {
strbuf_addf(err, "'%s' exists; cannot create '%s'", strbuf_addf(err, _("'%s' exists; cannot create '%s'"),
dirname.buf, refname); dirname.buf, refname);
goto cleanup; goto cleanup;
} }
if (extras && string_list_has_string(extras, dirname.buf)) { if (extras && string_list_has_string(extras, dirname.buf)) {
strbuf_addf(err, "cannot process '%s' and '%s' at the same time", strbuf_addf(err, _("cannot process '%s' and '%s' at the same time"),
refname, dirname.buf); refname, dirname.buf);
goto cleanup; goto cleanup;
} }
@ -2000,7 +2000,7 @@ int refs_verify_refname_available(struct ref_store *refs,
string_list_has_string(skip, iter->refname)) string_list_has_string(skip, iter->refname))
continue; continue;
strbuf_addf(err, "'%s' exists; cannot create '%s'", strbuf_addf(err, _("'%s' exists; cannot create '%s'"),
iter->refname, refname); iter->refname, refname);
ref_iterator_abort(iter); ref_iterator_abort(iter);
goto cleanup; goto cleanup;
@ -2011,7 +2011,7 @@ int refs_verify_refname_available(struct ref_store *refs,
extra_refname = find_descendant_ref(dirname.buf, extras, skip); extra_refname = find_descendant_ref(dirname.buf, extras, skip);
if (extra_refname) if (extra_refname)
strbuf_addf(err, "cannot process '%s' and '%s' at the same time", strbuf_addf(err, _("cannot process '%s' and '%s' at the same time"),
refname, extra_refname); refname, extra_refname);
else else
ret = 0; ret = 0;

View File

@ -134,7 +134,7 @@ void refspec_item_init_or_die(struct refspec_item *item, const char *refspec,
int fetch) int fetch)
{ {
if (!refspec_item_init(item, refspec, fetch)) if (!refspec_item_init(item, refspec, fetch))
die("Invalid refspec '%s'", refspec); die(_("invalid refspec '%s'"), refspec);
} }
void refspec_item_clear(struct refspec_item *item) void refspec_item_clear(struct refspec_item *item)

View File

@ -17,7 +17,7 @@ static int register_replace_ref(const char *refname,
if (get_oid_hex(hash, &repl_obj->original.oid)) { if (get_oid_hex(hash, &repl_obj->original.oid)) {
free(repl_obj); free(repl_obj);
warning("bad replace ref name: %s", refname); warning(_("bad replace ref name: %s"), refname);
return 0; return 0;
} }
@ -26,7 +26,7 @@ static int register_replace_ref(const char *refname,
/* Register new object */ /* Register new object */
if (oidmap_put(the_repository->objects->replace_map, repl_obj)) if (oidmap_put(the_repository->objects->replace_map, repl_obj))
die("duplicate replace ref: %s", refname); die(_("duplicate replace ref: %s"), refname);
return 0; return 0;
} }
@ -69,5 +69,5 @@ const struct object_id *do_lookup_replace_object(struct repository *r,
return cur; return cur;
cur = &repl_obj->replacement; cur = &repl_obj->replacement;
} }
die("replace depth too high for object %s", oid_to_hex(oid)); die(_("replace depth too high for object %s"), oid_to_hex(oid));
} }

View File

@ -307,7 +307,7 @@ static const char *action_name(const struct replay_opts *opts)
case REPLAY_INTERACTIVE_REBASE: case REPLAY_INTERACTIVE_REBASE:
return N_("rebase -i"); return N_("rebase -i");
} }
die(_("Unknown action: %d"), opts->action); die(_("unknown action: %d"), opts->action);
} }
struct commit_message { struct commit_message {
@ -717,7 +717,7 @@ static const char *read_author_ident(struct strbuf *buf)
/* dequote values and construct ident line in-place */ /* dequote values and construct ident line in-place */
for (in = out = buf->buf; i < 3 && in - buf->buf < buf->len; i++) { for (in = out = buf->buf; i < 3 && in - buf->buf < buf->len; i++) {
if (!skip_prefix(in, keys[i], (const char **)&in)) { if (!skip_prefix(in, keys[i], (const char **)&in)) {
warning("could not parse '%s' (looking for '%s'", warning(_("could not parse '%s' (looking for '%s'"),
rebase_path_author_script(), keys[i]); rebase_path_author_script(), keys[i]);
return NULL; return NULL;
} }
@ -739,7 +739,7 @@ static const char *read_author_ident(struct strbuf *buf)
} }
if (i < 3) { if (i < 3) {
warning("could not parse '%s' (looking for '%s')", warning(_("could not parse '%s' (looking for '%s')"),
rebase_path_author_script(), keys[i]); rebase_path_author_script(), keys[i]);
return NULL; return NULL;
} }
@ -1445,7 +1445,7 @@ static const char *command_to_string(const enum todo_command command)
{ {
if (command < TODO_COMMENT) if (command < TODO_COMMENT)
return todo_command_info[command].str; return todo_command_info[command].str;
die("Unknown command: %d", command); die(_("unknown command: %d"), command);
} }
static char command_to_char(const enum todo_command command) static char command_to_char(const enum todo_command command)
@ -2608,15 +2608,17 @@ static int error_with_patch(struct commit *commit,
if (intend_to_amend()) if (intend_to_amend())
return -1; return -1;
fprintf(stderr, "You can amend the commit now, with\n" fprintf(stderr,
"\n" _("You can amend the commit now, with\n"
" git commit --amend %s\n" "\n"
"\n" " git commit --amend %s\n"
"Once you are satisfied with your changes, run\n" "\n"
"\n" "Once you are satisfied with your changes, run\n"
" git rebase --continue\n", gpg_sign_opt_quoted(opts)); "\n"
" git rebase --continue\n"),
gpg_sign_opt_quoted(opts));
} else if (exit_code) } else if (exit_code)
fprintf(stderr, "Could not apply %s... %.*s\n", fprintf_ln(stderr, _("Could not apply %s... %.*s"),
short_commit_name(commit), subject_len, subject); short_commit_name(commit), subject_len, subject);
return exit_code; return exit_code;
@ -2730,7 +2732,7 @@ static int do_label(const char *name, int len)
struct object_id head_oid; struct object_id head_oid;
if (len == 1 && *name == '#') if (len == 1 && *name == '#')
return error("Illegal label name: '%.*s'", len, name); return error(_("illegal label name: '%.*s'"), len, name);
strbuf_addf(&ref_name, "refs/rewritten/%.*s", len, name); strbuf_addf(&ref_name, "refs/rewritten/%.*s", len, name);
strbuf_addf(&msg, "rebase -i (label) '%.*s'", len, name); strbuf_addf(&msg, "rebase -i (label) '%.*s'", len, name);

View File

@ -71,17 +71,17 @@ static void git_hash_sha1_final(unsigned char *hash, git_hash_ctx *ctx)
static void git_hash_unknown_init(git_hash_ctx *ctx) static void git_hash_unknown_init(git_hash_ctx *ctx)
{ {
die("trying to init unknown hash"); BUG("trying to init unknown hash");
} }
static void git_hash_unknown_update(git_hash_ctx *ctx, const void *data, size_t len) static void git_hash_unknown_update(git_hash_ctx *ctx, const void *data, size_t len)
{ {
die("trying to update unknown hash"); BUG("trying to update unknown hash");
} }
static void git_hash_unknown_final(unsigned char *hash, git_hash_ctx *ctx) static void git_hash_unknown_final(unsigned char *hash, git_hash_ctx *ctx)
{ {
die("trying to finalize unknown hash"); BUG("trying to finalize unknown hash");
} }
const struct git_hash_algo hash_algos[GIT_HASH_NALGOS] = { const struct git_hash_algo hash_algos[GIT_HASH_NALGOS] = {
@ -378,8 +378,8 @@ static int alt_odb_usable(struct raw_object_store *o,
/* Detect cases where alternate disappeared */ /* Detect cases where alternate disappeared */
if (!is_directory(path->buf)) { if (!is_directory(path->buf)) {
error("object directory %s does not exist; " error(_("object directory %s does not exist; "
"check .git/objects/info/alternates.", "check .git/objects/info/alternates"),
path->buf); path->buf);
return 0; return 0;
} }
@ -429,7 +429,7 @@ static int link_alt_odb_entry(struct repository *r, const char *entry,
strbuf_addstr(&pathbuf, entry); strbuf_addstr(&pathbuf, entry);
if (strbuf_normalize_path(&pathbuf) < 0 && relative_base) { if (strbuf_normalize_path(&pathbuf) < 0 && relative_base) {
error("unable to normalize alternate object path: %s", error(_("unable to normalize alternate object path: %s"),
pathbuf.buf); pathbuf.buf);
strbuf_release(&pathbuf); strbuf_release(&pathbuf);
return -1; return -1;
@ -500,14 +500,14 @@ static void link_alt_odb_entries(struct repository *r, const char *alt,
return; return;
if (depth > 5) { if (depth > 5) {
error("%s: ignoring alternate object stores, nesting too deep.", error(_("%s: ignoring alternate object stores, nesting too deep"),
relative_base); relative_base);
return; return;
} }
strbuf_add_absolute_path(&objdirbuf, r->objects->objectdir); strbuf_add_absolute_path(&objdirbuf, r->objects->objectdir);
if (strbuf_normalize_path(&objdirbuf) < 0) if (strbuf_normalize_path(&objdirbuf) < 0)
die("unable to normalize object directory: %s", die(_("unable to normalize object directory: %s"),
objdirbuf.buf); objdirbuf.buf);
while (*alt) { while (*alt) {
@ -562,7 +562,7 @@ void add_to_alternates_file(const char *reference)
hold_lock_file_for_update(&lock, alts, LOCK_DIE_ON_ERROR); hold_lock_file_for_update(&lock, alts, LOCK_DIE_ON_ERROR);
out = fdopen_lock_file(&lock, "w"); out = fdopen_lock_file(&lock, "w");
if (!out) if (!out)
die_errno("unable to fdopen alternates lockfile"); die_errno(_("unable to fdopen alternates lockfile"));
in = fopen(alts, "r"); in = fopen(alts, "r");
if (in) { if (in) {
@ -580,14 +580,14 @@ void add_to_alternates_file(const char *reference)
fclose(in); fclose(in);
} }
else if (errno != ENOENT) else if (errno != ENOENT)
die_errno("unable to read alternates file"); die_errno(_("unable to read alternates file"));
if (found) { if (found) {
rollback_lock_file(&lock); rollback_lock_file(&lock);
} else { } else {
fprintf_or_die(out, "%s\n", reference); fprintf_or_die(out, "%s\n", reference);
if (commit_lock_file(&lock)) if (commit_lock_file(&lock))
die_errno("unable to move new alternates file into place"); die_errno(_("unable to move new alternates file into place"));
if (the_repository->objects->alt_odb_tail) if (the_repository->objects->alt_odb_tail)
link_alt_odb_entries(the_repository, reference, link_alt_odb_entries(the_repository, reference,
'\n', NULL, 0); '\n', NULL, 0);
@ -778,7 +778,7 @@ static void mmap_limit_check(size_t length)
limit = SIZE_MAX; limit = SIZE_MAX;
} }
if (length > limit) if (length > limit)
die("attempting to mmap %"PRIuMAX" over limit %"PRIuMAX, die(_("attempting to mmap %"PRIuMAX" over limit %"PRIuMAX),
(uintmax_t)length, (uintmax_t)limit); (uintmax_t)length, (uintmax_t)limit);
} }
@ -803,7 +803,7 @@ void *xmmap(void *start, size_t length,
{ {
void *ret = xmmap_gently(start, length, prot, flags, fd, offset); void *ret = xmmap_gently(start, length, prot, flags, fd, offset);
if (ret == MAP_FAILED) if (ret == MAP_FAILED)
die_errno("mmap failed"); die_errno(_("mmap failed"));
return ret; return ret;
} }
@ -970,7 +970,7 @@ static void *map_sha1_file_1(struct repository *r, const char *path,
*size = xsize_t(st.st_size); *size = xsize_t(st.st_size);
if (!*size) { if (!*size) {
/* mmap() is forbidden on empty files */ /* mmap() is forbidden on empty files */
error("object file %s is empty", path); error(_("object file %s is empty"), path);
return NULL; return NULL;
} }
map = xmmap(NULL, *size, PROT_READ, MAP_PRIVATE, fd, 0); map = xmmap(NULL, *size, PROT_READ, MAP_PRIVATE, fd, 0);
@ -1090,9 +1090,9 @@ static void *unpack_sha1_rest(git_zstream *stream, void *buffer, unsigned long s
} }
if (status < 0) if (status < 0)
error("corrupt loose object '%s'", sha1_to_hex(sha1)); error(_("corrupt loose object '%s'"), sha1_to_hex(sha1));
else if (stream->avail_in) else if (stream->avail_in)
error("garbage at end of loose object '%s'", error(_("garbage at end of loose object '%s'"),
sha1_to_hex(sha1)); sha1_to_hex(sha1));
free(buf); free(buf);
return NULL; return NULL;
@ -1134,7 +1134,7 @@ static int parse_sha1_header_extended(const char *hdr, struct object_info *oi,
if ((flags & OBJECT_INFO_ALLOW_UNKNOWN_TYPE) && (type < 0)) if ((flags & OBJECT_INFO_ALLOW_UNKNOWN_TYPE) && (type < 0))
type = 0; type = 0;
else if (type < 0) else if (type < 0)
die("invalid object type"); die(_("invalid object type"));
if (oi->typep) if (oi->typep)
*oi->typep = type; *oi->typep = type;
@ -1216,19 +1216,19 @@ static int sha1_loose_object_info(struct repository *r,
*oi->disk_sizep = mapsize; *oi->disk_sizep = mapsize;
if ((flags & OBJECT_INFO_ALLOW_UNKNOWN_TYPE)) { if ((flags & OBJECT_INFO_ALLOW_UNKNOWN_TYPE)) {
if (unpack_sha1_header_to_strbuf(&stream, map, mapsize, hdr, sizeof(hdr), &hdrbuf) < 0) if (unpack_sha1_header_to_strbuf(&stream, map, mapsize, hdr, sizeof(hdr), &hdrbuf) < 0)
status = error("unable to unpack %s header with --allow-unknown-type", status = error(_("unable to unpack %s header with --allow-unknown-type"),
sha1_to_hex(sha1)); sha1_to_hex(sha1));
} else if (unpack_sha1_header(&stream, map, mapsize, hdr, sizeof(hdr)) < 0) } else if (unpack_sha1_header(&stream, map, mapsize, hdr, sizeof(hdr)) < 0)
status = error("unable to unpack %s header", status = error(_("unable to unpack %s header"),
sha1_to_hex(sha1)); sha1_to_hex(sha1));
if (status < 0) if (status < 0)
; /* Do nothing */ ; /* Do nothing */
else if (hdrbuf.len) { else if (hdrbuf.len) {
if ((status = parse_sha1_header_extended(hdrbuf.buf, oi, flags)) < 0) if ((status = parse_sha1_header_extended(hdrbuf.buf, oi, flags)) < 0)
status = error("unable to parse %s header with --allow-unknown-type", status = error(_("unable to parse %s header with --allow-unknown-type"),
sha1_to_hex(sha1)); sha1_to_hex(sha1));
} else if ((status = parse_sha1_header_extended(hdr, oi, flags)) < 0) } else if ((status = parse_sha1_header_extended(hdr, oi, flags)) < 0)
status = error("unable to parse %s header", sha1_to_hex(sha1)); status = error(_("unable to parse %s header"), sha1_to_hex(sha1));
if (status >= 0 && oi->contentp) { if (status >= 0 && oi->contentp) {
*oi->contentp = unpack_sha1_rest(&stream, hdr, *oi->contentp = unpack_sha1_rest(&stream, hdr,
@ -1419,19 +1419,19 @@ void *read_object_file_extended(const struct object_id *oid,
return data; return data;
if (errno && errno != ENOENT) if (errno && errno != ENOENT)
die_errno("failed to read object %s", oid_to_hex(oid)); die_errno(_("failed to read object %s"), oid_to_hex(oid));
/* die if we replaced an object with one that does not exist */ /* die if we replaced an object with one that does not exist */
if (repl != oid) if (repl != oid)
die("replacement %s not found for %s", die(_("replacement %s not found for %s"),
oid_to_hex(repl), oid_to_hex(oid)); oid_to_hex(repl), oid_to_hex(oid));
if (!stat_sha1_file(the_repository, repl->hash, &st, &path)) if (!stat_sha1_file(the_repository, repl->hash, &st, &path))
die("loose object %s (stored in %s) is corrupt", die(_("loose object %s (stored in %s) is corrupt"),
oid_to_hex(repl), path); oid_to_hex(repl), path);
if ((p = has_packed_and_bad(repl->hash)) != NULL) if ((p = has_packed_and_bad(repl->hash)) != NULL)
die("packed object %s (stored in %s) is corrupt", die(_("packed object %s (stored in %s) is corrupt"),
oid_to_hex(repl), p->pack_name); oid_to_hex(repl), p->pack_name);
return NULL; return NULL;
@ -1533,21 +1533,21 @@ int finalize_object_file(const char *tmpfile, const char *filename)
unlink_or_warn(tmpfile); unlink_or_warn(tmpfile);
if (ret) { if (ret) {
if (ret != EEXIST) { if (ret != EEXIST) {
return error_errno("unable to write sha1 filename %s", filename); return error_errno(_("unable to write sha1 filename %s"), filename);
} }
/* FIXME!!! Collision check here ? */ /* FIXME!!! Collision check here ? */
} }
out: out:
if (adjust_shared_perm(filename)) if (adjust_shared_perm(filename))
return error("unable to set permission to '%s'", filename); return error(_("unable to set permission to '%s'"), filename);
return 0; return 0;
} }
static int write_buffer(int fd, const void *buf, size_t len) static int write_buffer(int fd, const void *buf, size_t len)
{ {
if (write_in_full(fd, buf, len) < 0) if (write_in_full(fd, buf, len) < 0)
return error_errno("file write error"); return error_errno(_("file write error"));
return 0; return 0;
} }
@ -1566,7 +1566,7 @@ static void close_sha1_file(int fd)
if (fsync_object_files) if (fsync_object_files)
fsync_or_die(fd, "sha1 file"); fsync_or_die(fd, "sha1 file");
if (close(fd) != 0) if (close(fd) != 0)
die_errno("error when closing sha1 file"); die_errno(_("error when closing sha1 file"));
} }
/* Size of directory component, including the ending '/' */ /* Size of directory component, including the ending '/' */
@ -1632,9 +1632,9 @@ static int write_loose_object(const struct object_id *oid, char *hdr,
fd = create_tmpfile(&tmp_file, filename.buf); fd = create_tmpfile(&tmp_file, filename.buf);
if (fd < 0) { if (fd < 0) {
if (errno == EACCES) if (errno == EACCES)
return error("insufficient permission for adding an object to repository database %s", get_object_directory()); return error(_("insufficient permission for adding an object to repository database %s"), get_object_directory());
else else
return error_errno("unable to create temporary file"); return error_errno(_("unable to create temporary file"));
} }
/* Set it up */ /* Set it up */
@ -1658,21 +1658,21 @@ static int write_loose_object(const struct object_id *oid, char *hdr,
ret = git_deflate(&stream, Z_FINISH); ret = git_deflate(&stream, Z_FINISH);
the_hash_algo->update_fn(&c, in0, stream.next_in - in0); the_hash_algo->update_fn(&c, in0, stream.next_in - in0);
if (write_buffer(fd, compressed, stream.next_out - compressed) < 0) if (write_buffer(fd, compressed, stream.next_out - compressed) < 0)
die("unable to write sha1 file"); die(_("unable to write sha1 file"));
stream.next_out = compressed; stream.next_out = compressed;
stream.avail_out = sizeof(compressed); stream.avail_out = sizeof(compressed);
} while (ret == Z_OK); } while (ret == Z_OK);
if (ret != Z_STREAM_END) if (ret != Z_STREAM_END)
die("unable to deflate new object %s (%d)", oid_to_hex(oid), die(_("unable to deflate new object %s (%d)"), oid_to_hex(oid),
ret); ret);
ret = git_deflate_end_gently(&stream); ret = git_deflate_end_gently(&stream);
if (ret != Z_OK) if (ret != Z_OK)
die("deflateEnd on object %s failed (%d)", oid_to_hex(oid), die(_("deflateEnd on object %s failed (%d)"), oid_to_hex(oid),
ret); ret);
the_hash_algo->final_fn(parano_oid.hash, &c); the_hash_algo->final_fn(parano_oid.hash, &c);
if (oidcmp(oid, &parano_oid) != 0) if (oidcmp(oid, &parano_oid) != 0)
die("confused by unstable object source data for %s", die(_("confused by unstable object source data for %s"),
oid_to_hex(oid)); oid_to_hex(oid));
close_sha1_file(fd); close_sha1_file(fd);
@ -1682,7 +1682,7 @@ static int write_loose_object(const struct object_id *oid, char *hdr,
utb.actime = mtime; utb.actime = mtime;
utb.modtime = mtime; utb.modtime = mtime;
if (utime(tmp_file.buf, &utb) < 0) if (utime(tmp_file.buf, &utb) < 0)
warning_errno("failed utime() on %s", tmp_file.buf); warning_errno(_("failed utime() on %s"), tmp_file.buf);
} }
return finalize_object_file(tmp_file.buf, filename.buf); return finalize_object_file(tmp_file.buf, filename.buf);
@ -1757,7 +1757,7 @@ int force_object_loose(const struct object_id *oid, time_t mtime)
return 0; return 0;
buf = read_object(oid->hash, &type, &len); buf = read_object(oid->hash, &type, &len);
if (!buf) if (!buf)
return error("cannot read sha1_file for %s", oid_to_hex(oid)); return error(_("cannot read sha1_file for %s"), oid_to_hex(oid));
hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(type), len) + 1; hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(type), len) + 1;
ret = write_loose_object(oid, hdr, hdrlen, buf, len, mtime); ret = write_loose_object(oid, hdr, hdrlen, buf, len, mtime);
free(buf); free(buf);
@ -1802,7 +1802,7 @@ static void check_commit(const void *buf, size_t size)
struct commit c; struct commit c;
memset(&c, 0, sizeof(c)); memset(&c, 0, sizeof(c));
if (parse_commit_buffer(the_repository, &c, buf, size, 0)) if (parse_commit_buffer(the_repository, &c, buf, size, 0))
die("corrupt commit"); die(_("corrupt commit"));
} }
static void check_tag(const void *buf, size_t size) static void check_tag(const void *buf, size_t size)
@ -1810,7 +1810,7 @@ static void check_tag(const void *buf, size_t size)
struct tag t; struct tag t;
memset(&t, 0, sizeof(t)); memset(&t, 0, sizeof(t));
if (parse_tag_buffer(the_repository, &t, buf, size)) if (parse_tag_buffer(the_repository, &t, buf, size))
die("corrupt tag"); die(_("corrupt tag"));
} }
static int index_mem(struct object_id *oid, void *buf, size_t size, static int index_mem(struct object_id *oid, void *buf, size_t size,
@ -1903,10 +1903,10 @@ static int index_core(struct object_id *oid, int fd, size_t size,
char *buf = xmalloc(size); char *buf = xmalloc(size);
ssize_t read_result = read_in_full(fd, buf, size); ssize_t read_result = read_in_full(fd, buf, size);
if (read_result < 0) if (read_result < 0)
ret = error_errno("read error while indexing %s", ret = error_errno(_("read error while indexing %s"),
path ? path : "<unknown>"); path ? path : "<unknown>");
else if (read_result != size) else if (read_result != size)
ret = error("short read while indexing %s", ret = error(_("short read while indexing %s"),
path ? path : "<unknown>"); path ? path : "<unknown>");
else else
ret = index_mem(oid, buf, size, type, path, flags); ret = index_mem(oid, buf, size, type, path, flags);
@ -1977,7 +1977,7 @@ int index_path(struct object_id *oid, const char *path, struct stat *st, unsigne
if (fd < 0) if (fd < 0)
return error_errno("open(\"%s\")", path); return error_errno("open(\"%s\")", path);
if (index_fd(oid, fd, st, OBJ_BLOB, path, flags) < 0) if (index_fd(oid, fd, st, OBJ_BLOB, path, flags) < 0)
return error("%s: failed to insert into database", return error(_("%s: failed to insert into database"),
path); path);
break; break;
case S_IFLNK: case S_IFLNK:
@ -1986,13 +1986,13 @@ int index_path(struct object_id *oid, const char *path, struct stat *st, unsigne
if (!(flags & HASH_WRITE_OBJECT)) if (!(flags & HASH_WRITE_OBJECT))
hash_object_file(sb.buf, sb.len, blob_type, oid); hash_object_file(sb.buf, sb.len, blob_type, oid);
else if (write_object_file(sb.buf, sb.len, blob_type, oid)) else if (write_object_file(sb.buf, sb.len, blob_type, oid))
rc = error("%s: failed to insert into database", path); rc = error(_("%s: failed to insert into database"), path);
strbuf_release(&sb); strbuf_release(&sb);
break; break;
case S_IFDIR: case S_IFDIR:
return resolve_gitlink_ref(path, "HEAD", oid); return resolve_gitlink_ref(path, "HEAD", oid);
default: default:
return error("%s: unsupported file type", path); return error(_("%s: unsupported file type"), path);
} }
return rc; return rc;
} }
@ -2016,9 +2016,9 @@ void assert_oid_type(const struct object_id *oid, enum object_type expect)
{ {
enum object_type type = oid_object_info(the_repository, oid, NULL); enum object_type type = oid_object_info(the_repository, oid, NULL);
if (type < 0) if (type < 0)
die("%s is not a valid object", oid_to_hex(oid)); die(_("%s is not a valid object"), oid_to_hex(oid));
if (type != expect) if (type != expect)
die("%s is not a valid '%s' object", oid_to_hex(oid), die(_("%s is not a valid '%s' object"), oid_to_hex(oid),
type_name(expect)); type_name(expect));
} }
@ -2045,7 +2045,7 @@ int for_each_file_in_obj_subdir(unsigned int subdir_nr,
dir = opendir(path->buf); dir = opendir(path->buf);
if (!dir) { if (!dir) {
if (errno != ENOENT) if (errno != ENOENT)
r = error_errno("unable to open %s", path->buf); r = error_errno(_("unable to open %s"), path->buf);
strbuf_setlen(path, origlen); strbuf_setlen(path, origlen);
return r; return r;
} }
@ -2202,18 +2202,18 @@ static int check_stream_sha1(git_zstream *stream,
git_inflate_end(stream); git_inflate_end(stream);
if (status != Z_STREAM_END) { if (status != Z_STREAM_END) {
error("corrupt loose object '%s'", sha1_to_hex(expected_sha1)); error(_("corrupt loose object '%s'"), sha1_to_hex(expected_sha1));
return -1; return -1;
} }
if (stream->avail_in) { if (stream->avail_in) {
error("garbage at end of loose object '%s'", error(_("garbage at end of loose object '%s'"),
sha1_to_hex(expected_sha1)); sha1_to_hex(expected_sha1));
return -1; return -1;
} }
the_hash_algo->final_fn(real_sha1, &c); the_hash_algo->final_fn(real_sha1, &c);
if (hashcmp(expected_sha1, real_sha1)) { if (hashcmp(expected_sha1, real_sha1)) {
error("sha1 mismatch for %s (expected %s)", path, error(_("sha1 mismatch for %s (expected %s)"), path,
sha1_to_hex(expected_sha1)); sha1_to_hex(expected_sha1));
return -1; return -1;
} }
@ -2237,18 +2237,18 @@ int read_loose_object(const char *path,
map = map_sha1_file_1(the_repository, path, NULL, &mapsize); map = map_sha1_file_1(the_repository, path, NULL, &mapsize);
if (!map) { if (!map) {
error_errno("unable to mmap %s", path); error_errno(_("unable to mmap %s"), path);
goto out; goto out;
} }
if (unpack_sha1_header(&stream, map, mapsize, hdr, sizeof(hdr)) < 0) { if (unpack_sha1_header(&stream, map, mapsize, hdr, sizeof(hdr)) < 0) {
error("unable to unpack header of %s", path); error(_("unable to unpack header of %s"), path);
goto out; goto out;
} }
*type = parse_sha1_header(hdr, size); *type = parse_sha1_header(hdr, size);
if (*type < 0) { if (*type < 0) {
error("unable to parse header of %s", path); error(_("unable to parse header of %s"), path);
git_inflate_end(&stream); git_inflate_end(&stream);
goto out; goto out;
} }
@ -2259,13 +2259,13 @@ int read_loose_object(const char *path,
} else { } else {
*contents = unpack_sha1_rest(&stream, hdr, *size, expected_oid->hash); *contents = unpack_sha1_rest(&stream, hdr, *size, expected_oid->hash);
if (!*contents) { if (!*contents) {
error("unable to unpack contents of %s", path); error(_("unable to unpack contents of %s"), path);
git_inflate_end(&stream); git_inflate_end(&stream);
goto out; goto out;
} }
if (check_object_signature(expected_oid, *contents, if (check_object_signature(expected_oid, *contents,
*size, type_name(*type))) { *size, type_name(*type))) {
error("sha1 mismatch for %s (expected %s)", path, error(_("sha1 mismatch for %s (expected %s)"), path,
oid_to_hex(expected_oid)); oid_to_hex(expected_oid));
free(*contents); free(*contents);
goto out; goto out;

View File

@ -583,7 +583,7 @@ test_expect_success PERL 'process filter should restart after unexpected write f
git checkout --quiet --no-progress . 2>git-stderr.log && git checkout --quiet --no-progress . 2>git-stderr.log &&
grep "smudge write error at" git-stderr.log && grep "smudge write error at" git-stderr.log &&
grep "error: external filter" git-stderr.log && test_i18ngrep "error: external filter" git-stderr.log &&
cat >expected.log <<-EOF && cat >expected.log <<-EOF &&
START START

View File

@ -310,7 +310,7 @@ test_expect_success 'include cycles are detected' '
cycle cycle
EOF EOF
test_must_fail git config --get-all test.value 2>stderr && test_must_fail git config --get-all test.value 2>stderr &&
grep "exceeded maximum include depth" stderr test_i18ngrep "exceeded maximum include depth" stderr
' '
test_done test_done

View File

@ -233,7 +233,7 @@ test_expect_success 'check line errors for malformed values' '
test_expect_success 'error on modifying repo config without repo' ' test_expect_success 'error on modifying repo config without repo' '
nongit test_must_fail git config a.b c 2>err && nongit test_must_fail git config a.b c 2>err &&
grep "not in a git directory" err test_i18ngrep "not in a git directory" err
' '
cmdline_config="'foo.bar=from-cmdline'" cmdline_config="'foo.bar=from-cmdline'"

View File

@ -390,7 +390,7 @@ test_expect_success 'Query "master@{2005-05-26 23:33:01}" (middle of history wit
test_when_finished "rm -f o e" && test_when_finished "rm -f o e" &&
git rev-parse --verify "master@{2005-05-26 23:33:01}" >o 2>e && git rev-parse --verify "master@{2005-05-26 23:33:01}" >o 2>e &&
test $B = $(cat o) && test $B = $(cat o) &&
test "warning: Log for ref $m has gap after $gd." = "$(cat e)" test_i18ngrep -F "warning: log for ref $m has gap after $gd" e
' '
test_expect_success 'Query "master@{2005-05-26 23:38:00}" (middle of history)' ' test_expect_success 'Query "master@{2005-05-26 23:38:00}" (middle of history)' '
test_when_finished "rm -f o e" && test_when_finished "rm -f o e" &&
@ -408,7 +408,7 @@ test_expect_success 'Query "master@{2005-05-28}" (past end of history)' '
test_when_finished "rm -f o e" && test_when_finished "rm -f o e" &&
git rev-parse --verify "master@{2005-05-28}" >o 2>e && git rev-parse --verify "master@{2005-05-28}" >o 2>e &&
test $D = $(cat o) && test $D = $(cat o) &&
test "warning: Log for ref $m unexpectedly ended on $ld." = "$(cat e)" test_i18ngrep -F "warning: log for ref $m unexpectedly ended on $ld" e
' '
rm -f .git/$m .git/logs/$m expect rm -f .git/$m .git/logs/$m expect
@ -462,7 +462,7 @@ test_expect_success 'git cat-file blob master@{2005-05-26 23:42}:F (expect OTHER
test_expect_success 'given old value for missing pseudoref, do not create' ' test_expect_success 'given old value for missing pseudoref, do not create' '
test_must_fail git update-ref PSEUDOREF $A $B 2>err && test_must_fail git update-ref PSEUDOREF $A $B 2>err &&
test_path_is_missing .git/PSEUDOREF && test_path_is_missing .git/PSEUDOREF &&
grep "could not read ref" err test_i18ngrep "could not read ref" err
' '
test_expect_success 'create pseudoref' ' test_expect_success 'create pseudoref' '
@ -483,7 +483,7 @@ test_expect_success 'overwrite pseudoref with correct old value' '
test_expect_success 'do not overwrite pseudoref with wrong old value' ' test_expect_success 'do not overwrite pseudoref with wrong old value' '
test_must_fail git update-ref PSEUDOREF $D $E 2>err && test_must_fail git update-ref PSEUDOREF $D $E 2>err &&
test $C = $(cat .git/PSEUDOREF) && test $C = $(cat .git/PSEUDOREF) &&
grep "unexpected object ID" err test_i18ngrep "unexpected object ID" err
' '
test_expect_success 'delete pseudoref' ' test_expect_success 'delete pseudoref' '
@ -495,7 +495,7 @@ test_expect_success 'do not delete pseudoref with wrong old value' '
git update-ref PSEUDOREF $A && git update-ref PSEUDOREF $A &&
test_must_fail git update-ref -d PSEUDOREF $B 2>err && test_must_fail git update-ref -d PSEUDOREF $B 2>err &&
test $A = $(cat .git/PSEUDOREF) && test $A = $(cat .git/PSEUDOREF) &&
grep "unexpected object ID" err test_i18ngrep "unexpected object ID" err
' '
test_expect_success 'delete pseudoref with correct old value' ' test_expect_success 'delete pseudoref with correct old value' '
@ -512,7 +512,7 @@ test_expect_success 'do not overwrite pseudoref with old OID zero' '
test_when_finished git update-ref -d PSEUDOREF && test_when_finished git update-ref -d PSEUDOREF &&
test_must_fail git update-ref PSEUDOREF $B $Z 2>err && test_must_fail git update-ref PSEUDOREF $B $Z 2>err &&
test $A = $(cat .git/PSEUDOREF) && test $A = $(cat .git/PSEUDOREF) &&
grep "already exists" err test_i18ngrep "already exists" err
' '
# Test --stdin # Test --stdin
@ -650,7 +650,7 @@ test_expect_success 'stdin fails with duplicate refs' '
create $a $m create $a $m
EOF EOF
test_must_fail git update-ref --stdin <stdin 2>err && test_must_fail git update-ref --stdin <stdin 2>err &&
grep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed." err test_i18ngrep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed" err
' '
test_expect_success 'stdin create ref works' ' test_expect_success 'stdin create ref works' '
@ -1052,7 +1052,7 @@ test_expect_success 'stdin -z fails option with unknown name' '
test_expect_success 'stdin -z fails with duplicate refs' ' test_expect_success 'stdin -z fails with duplicate refs' '
printf $F "create $a" "$m" "create $b" "$m" "create $a" "$m" >stdin && printf $F "create $a" "$m" "create $b" "$m" "create $a" "$m" >stdin &&
test_must_fail git update-ref -z --stdin <stdin 2>err && test_must_fail git update-ref -z --stdin <stdin 2>err &&
grep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed." err test_i18ngrep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed" err
' '
test_expect_success 'stdin -z create ref works' ' test_expect_success 'stdin -z create ref works' '
@ -1283,7 +1283,7 @@ test_expect_success 'fails with duplicate HEAD update' '
update HEAD $B update HEAD $B
EOF EOF
test_must_fail git update-ref --stdin <stdin 2>err && test_must_fail git update-ref --stdin <stdin 2>err &&
grep "fatal: multiple updates for '\''HEAD'\'' (including one via its referent .refs/heads/target1.) are not allowed" err && test_i18ngrep "fatal: multiple updates for '\''HEAD'\'' (including one via its referent .refs/heads/target1.) are not allowed" err &&
echo "refs/heads/target1" >expect && echo "refs/heads/target1" >expect &&
git symbolic-ref HEAD >actual && git symbolic-ref HEAD >actual &&
test_cmp expect actual && test_cmp expect actual &&
@ -1300,7 +1300,7 @@ test_expect_success 'fails with duplicate ref update via symref' '
update refs/heads/symref2 $B update refs/heads/symref2 $B
EOF EOF
test_must_fail git update-ref --stdin <stdin 2>err && test_must_fail git update-ref --stdin <stdin 2>err &&
grep "fatal: multiple updates for '\''refs/heads/target2'\'' (including one via symref .refs/heads/symref2.) are not allowed" err && test_i18ngrep "fatal: multiple updates for '\''refs/heads/target2'\'' (including one via symref .refs/heads/symref2.) are not allowed" err &&
echo "refs/heads/target2" >expect && echo "refs/heads/target2" >expect &&
git symbolic-ref refs/heads/symref2 >actual && git symbolic-ref refs/heads/symref2 >actual &&
test_cmp expect actual && test_cmp expect actual &&

View File

@ -27,7 +27,7 @@ test_update_rejected () {
fi && fi &&
printf "create $prefix/%s $C\n" $create >input && printf "create $prefix/%s $C\n" $create >input &&
test_must_fail git update-ref --stdin <input 2>output.err && test_must_fail git update-ref --stdin <input 2>output.err &&
grep -F "$error" output.err && test_i18ngrep -F "$error" output.err &&
git for-each-ref $prefix >actual && git for-each-ref $prefix >actual &&
test_cmp unchanged actual test_cmp unchanged actual
} }
@ -103,7 +103,7 @@ df_test() {
printf "%s\n" "delete $delname" "create $addname $D" printf "%s\n" "delete $delname" "create $addname $D"
fi >commands && fi >commands &&
test_must_fail git update-ref --stdin <commands 2>output.err && test_must_fail git update-ref --stdin <commands 2>output.err &&
test_cmp expected-err output.err && test_i18ncmp expected-err output.err &&
printf "%s\n" "$C $delref" >expected-refs && printf "%s\n" "$C $delref" >expected-refs &&
git for-each-ref --format="%(objectname) %(refname)" $prefix/r >actual-refs && git for-each-ref --format="%(objectname) %(refname)" $prefix/r >actual-refs &&
test_cmp expected-refs actual-refs test_cmp expected-refs actual-refs

View File

@ -372,7 +372,7 @@ test_expect_success 'rev-list --verify-objects with bad sha1' '
test_might_fail git rev-list --verify-objects refs/heads/bogus >/dev/null 2>out && test_might_fail git rev-list --verify-objects refs/heads/bogus >/dev/null 2>out &&
cat out && cat out &&
grep -q "error: sha1 mismatch 63ffffffffffffffffffffffffffffffffffffff" out test_i18ngrep -q "error: sha1 mismatch 63ffffffffffffffffffffffffffffffffffffff" out
' '
test_expect_success 'force fsck to ignore double author' ' test_expect_success 'force fsck to ignore double author' '

View File

@ -44,13 +44,13 @@ test_expect_success 'ls-files -c' '
cd top/sub && cd top/sub &&
for f in ../y* for f in ../y*
do do
echo "error: pathspec $sq$f$sq did not match any file(s) known to git." echo "error: pathspec $sq$f$sq did not match any file(s) known to git"
done >expect.err && done >expect.err &&
echo "Did you forget to ${sq}git add${sq}?" >>expect.err && echo "Did you forget to ${sq}git add${sq}?" >>expect.err &&
ls ../x* >expect.out && ls ../x* >expect.out &&
test_must_fail git ls-files -c --error-unmatch ../[xy]* >actual.out 2>actual.err && test_must_fail git ls-files -c --error-unmatch ../[xy]* >actual.out 2>actual.err &&
test_cmp expect.out actual.out && test_cmp expect.out actual.out &&
test_cmp expect.err actual.err test_i18ncmp expect.err actual.err
) )
' '
@ -59,13 +59,13 @@ test_expect_success 'ls-files -o' '
cd top/sub && cd top/sub &&
for f in ../x* for f in ../x*
do do
echo "error: pathspec $sq$f$sq did not match any file(s) known to git." echo "error: pathspec $sq$f$sq did not match any file(s) known to git"
done >expect.err && done >expect.err &&
echo "Did you forget to ${sq}git add${sq}?" >>expect.err && echo "Did you forget to ${sq}git add${sq}?" >>expect.err &&
ls ../y* >expect.out && ls ../y* >expect.out &&
test_must_fail git ls-files -o --error-unmatch ../[xy]* >actual.out 2>actual.err && test_must_fail git ls-files -o --error-unmatch ../[xy]* >actual.out 2>actual.err &&
test_cmp expect.out actual.out && test_cmp expect.out actual.out &&
test_cmp expect.err actual.err test_i18ncmp expect.err actual.err
) )
' '

View File

@ -186,7 +186,7 @@ test_expect_success 'notice d/f conflict with existing directory' '
test_expect_success 'existing directory reports concrete ref' ' test_expect_success 'existing directory reports concrete ref' '
test_must_fail git branch foo 2>stderr && test_must_fail git branch foo 2>stderr &&
grep refs/heads/foo/bar/baz stderr test_i18ngrep refs/heads/foo/bar/baz stderr
' '
test_expect_success 'notice d/f conflict with existing ref' ' test_expect_success 'notice d/f conflict with existing ref' '

View File

@ -541,9 +541,9 @@ EOF
test "$(git rev-parse refs/notes/y)" = "$(git rev-parse NOTES_MERGE_PARTIAL^1)" && test "$(git rev-parse refs/notes/y)" = "$(git rev-parse NOTES_MERGE_PARTIAL^1)" &&
test "$(git rev-parse refs/notes/m)" != "$(git rev-parse NOTES_MERGE_PARTIAL^1)" && test "$(git rev-parse refs/notes/m)" != "$(git rev-parse NOTES_MERGE_PARTIAL^1)" &&
# Mention refs/notes/m, and its current and expected value in output # Mention refs/notes/m, and its current and expected value in output
grep -q "refs/notes/m" output && test_i18ngrep -q "refs/notes/m" output &&
grep -q "$(git rev-parse refs/notes/m)" output && test_i18ngrep -q "$(git rev-parse refs/notes/m)" output &&
grep -q "$(git rev-parse NOTES_MERGE_PARTIAL^1)" output && test_i18ngrep -q "$(git rev-parse NOTES_MERGE_PARTIAL^1)" output &&
# Verify that other notes refs has not changed (w, x, y and z) # Verify that other notes refs has not changed (w, x, y and z)
verify_notes w && verify_notes w &&
verify_notes x && verify_notes x &&

View File

@ -403,7 +403,7 @@ test_expect_success 'fetch creating new shallow root' '
git fetch --depth=1 --progress 2>actual && git fetch --depth=1 --progress 2>actual &&
# This should fetch only the empty commit, no tree or # This should fetch only the empty commit, no tree or
# blob objects # blob objects
grep "remote: Total 1" actual test_i18ngrep "remote: Total 1" actual
) )
' '

View File

@ -872,7 +872,7 @@ test_expect_success 'remote prune to cause a dangling symref' '
cd eight && cd eight &&
test_must_fail git branch nomore origin test_must_fail git branch nomore origin
) 2>err && ) 2>err &&
grep "dangling symref" err test_i18ngrep "dangling symref" err
' '
test_expect_success 'show empty remote' ' test_expect_success 'show empty remote' '

View File

@ -7,9 +7,9 @@ test_description='test fetching over git protocol'
start_git_daemon start_git_daemon
check_verbose_connect () { check_verbose_connect () {
grep -F "Looking up 127.0.0.1 ..." stderr && test_i18ngrep -F "Looking up 127.0.0.1 ..." stderr &&
grep -F "Connecting to 127.0.0.1 (port " stderr && test_i18ngrep -F "Connecting to 127.0.0.1 (port " stderr &&
grep -F "done." stderr test_i18ngrep -F "done." stderr
} }
test_expect_success 'setup repository' ' test_expect_success 'setup repository' '

View File

@ -126,7 +126,7 @@ test_expect_success 'forced push' '
test_expect_success 'cloning without refspec' ' test_expect_success 'cloning without refspec' '
GIT_REMOTE_TESTGIT_REFSPEC="" \ GIT_REMOTE_TESTGIT_REFSPEC="" \
git clone "testgit::${PWD}/server" local2 2>error && git clone "testgit::${PWD}/server" local2 2>error &&
grep "This remote helper should implement refspec capability" error && test_i18ngrep "this remote helper should implement refspec capability" error &&
compare_refs local2 HEAD server HEAD compare_refs local2 HEAD server HEAD
' '
@ -134,7 +134,7 @@ test_expect_success 'pulling without refspecs' '
(cd local2 && (cd local2 &&
git reset --hard && git reset --hard &&
GIT_REMOTE_TESTGIT_REFSPEC="" git pull 2>../error) && GIT_REMOTE_TESTGIT_REFSPEC="" git pull 2>../error) &&
grep "This remote helper should implement refspec capability" error && test_i18ngrep "this remote helper should implement refspec capability" error &&
compare_refs local2 HEAD server HEAD compare_refs local2 HEAD server HEAD
' '
@ -146,7 +146,7 @@ test_expect_success 'pushing without refspecs' '
GIT_REMOTE_TESTGIT_REFSPEC="" && GIT_REMOTE_TESTGIT_REFSPEC="" &&
export GIT_REMOTE_TESTGIT_REFSPEC && export GIT_REMOTE_TESTGIT_REFSPEC &&
test_must_fail git push 2>../error) && test_must_fail git push 2>../error) &&
grep "remote-helper doesn.t support push; refspec needed" error test_i18ngrep "remote-helper doesn.t support push; refspec needed" error
' '
test_expect_success 'pulling without marks' ' test_expect_success 'pulling without marks' '
@ -246,7 +246,7 @@ test_expect_success 'proper failure checks for fetching' '
(cd local && (cd local &&
test_must_fail env GIT_REMOTE_TESTGIT_FAILURE=1 git fetch 2>error && test_must_fail env GIT_REMOTE_TESTGIT_FAILURE=1 git fetch 2>error &&
cat error && cat error &&
grep -q "Error while running fast-import" error test_i18ngrep -q "error while running fast-import" error
) )
' '

View File

@ -666,7 +666,7 @@ test_expect_success 'test ident field is working' '
mkdir ../other_worktree && mkdir ../other_worktree &&
cp -R done dthree dtwo four three ../other_worktree && cp -R done dthree dtwo four three ../other_worktree &&
GIT_WORK_TREE=../other_worktree git status 2>../err && GIT_WORK_TREE=../other_worktree git status 2>../err &&
echo "warning: Untracked cache is disabled on this system or location." >../expect && echo "warning: untracked cache is disabled on this system or location" >../expect &&
test_i18ncmp ../expect ../err test_i18ncmp ../expect ../err
' '

View File

@ -378,7 +378,7 @@ test_expect_success 'init should register submodule url in .git/config' '
test_failure_with_unknown_submodule () { test_failure_with_unknown_submodule () {
test_must_fail git submodule $1 no-such-submodule 2>output.err && test_must_fail git submodule $1 no-such-submodule 2>output.err &&
grep "^error: .*no-such-submodule" output.err test_i18ngrep "^error: .*no-such-submodule" output.err
} }
test_expect_success 'init should fail with unknown submodule' ' test_expect_success 'init should fail with unknown submodule' '

View File

@ -48,7 +48,7 @@ static void sendline(struct helper_data *helper, struct strbuf *buffer)
if (debug) if (debug)
fprintf(stderr, "Debug: Remote helper: -> %s", buffer->buf); fprintf(stderr, "Debug: Remote helper: -> %s", buffer->buf);
if (write_in_full(helper->helper->in, buffer->buf, buffer->len) < 0) if (write_in_full(helper->helper->in, buffer->buf, buffer->len) < 0)
die_errno("Full write to remote helper failed"); die_errno(_("full write to remote helper failed"));
} }
static int recvline_fh(FILE *helper, struct strbuf *buffer) static int recvline_fh(FILE *helper, struct strbuf *buffer)
@ -77,7 +77,7 @@ static void write_constant(int fd, const char *str)
if (debug) if (debug)
fprintf(stderr, "Debug: Remote helper: -> %s", str); fprintf(stderr, "Debug: Remote helper: -> %s", str);
if (write_in_full(fd, str, strlen(str)) < 0) if (write_in_full(fd, str, strlen(str)) < 0)
die_errno("Full write to remote helper failed"); die_errno(_("full write to remote helper failed"));
} }
static const char *remove_ext_force(const char *url) static const char *remove_ext_force(const char *url)
@ -129,7 +129,7 @@ static struct child_process *get_helper(struct transport *transport)
code = start_command(helper); code = start_command(helper);
if (code < 0 && errno == ENOENT) if (code < 0 && errno == ENOENT)
die("Unable to find remote helper for '%s'", data->name); die(_("unable to find remote helper for '%s'"), data->name);
else if (code != 0) else if (code != 0)
exit(code); exit(code);
@ -145,7 +145,7 @@ static struct child_process *get_helper(struct transport *transport)
*/ */
duped = dup(helper->out); duped = dup(helper->out);
if (duped < 0) if (duped < 0)
die_errno("Can't dup helper output fd"); die_errno(_("can't dup helper output fd"));
data->out = xfdopen(duped, "r"); data->out = xfdopen(duped, "r");
write_constant(helper->in, "capabilities\n"); write_constant(helper->in, "capabilities\n");
@ -196,13 +196,13 @@ static struct child_process *get_helper(struct transport *transport)
} else if (starts_with(capname, "no-private-update")) { } else if (starts_with(capname, "no-private-update")) {
data->no_private_update = 1; data->no_private_update = 1;
} else if (mandatory) { } else if (mandatory) {
die("Unknown mandatory capability %s. This remote " die(_("unknown mandatory capability %s; this remote "
"helper probably needs newer version of Git.", "helper probably needs newer version of Git"),
capname); capname);
} }
} }
if (!data->rs.nr && (data->import || data->bidi_import || data->export)) { if (!data->rs.nr && (data->import || data->bidi_import || data->export)) {
warning("This remote helper should implement refspec capability."); warning(_("this remote helper should implement refspec capability"));
} }
strbuf_release(&buf); strbuf_release(&buf);
if (debug) if (debug)
@ -269,7 +269,7 @@ static int strbuf_set_helper_option(struct helper_data *data,
else if (!strcmp(buf->buf, "unsupported")) else if (!strcmp(buf->buf, "unsupported"))
ret = 1; ret = 1;
else { else {
warning("%s unexpectedly said: '%s'", data->name, buf->buf); warning(_("%s unexpectedly said: '%s'"), data->name, buf->buf);
ret = 1; ret = 1;
} }
return ret; return ret;
@ -398,7 +398,7 @@ static int fetch_with_fetch(struct transport *transport,
if (starts_with(buf.buf, "lock ")) { if (starts_with(buf.buf, "lock ")) {
const char *name = buf.buf + 5; const char *name = buf.buf + 5;
if (transport->pack_lockfile) if (transport->pack_lockfile)
warning("%s also locked %s", data->name, name); warning(_("%s also locked %s"), data->name, name);
else else
transport->pack_lockfile = xstrdup(name); transport->pack_lockfile = xstrdup(name);
} }
@ -409,7 +409,7 @@ static int fetch_with_fetch(struct transport *transport,
else if (!buf.len) else if (!buf.len)
break; break;
else else
warning("%s unexpectedly said: '%s'", data->name, buf.buf); warning(_("%s unexpectedly said: '%s'"), data->name, buf.buf);
} }
strbuf_release(&buf); strbuf_release(&buf);
return 0; return 0;
@ -476,7 +476,7 @@ static int fetch_with_import(struct transport *transport,
get_helper(transport); get_helper(transport);
if (get_importer(transport, &fastimport)) if (get_importer(transport, &fastimport))
die("Couldn't run fast-import"); die(_("couldn't run fast-import"));
for (i = 0; i < nr_heads; i++) { for (i = 0; i < nr_heads; i++) {
posn = to_fetch[i]; posn = to_fetch[i];
@ -499,7 +499,7 @@ static int fetch_with_import(struct transport *transport,
*/ */
if (finish_command(&fastimport)) if (finish_command(&fastimport))
die("Error while running fast-import"); die(_("error while running fast-import"));
/* /*
* The fast-import stream of a remote helper that advertises * The fast-import stream of a remote helper that advertises
@ -528,7 +528,7 @@ static int fetch_with_import(struct transport *transport,
private = xstrdup(name); private = xstrdup(name);
if (private) { if (private) {
if (read_ref(private, &posn->old_oid) < 0) if (read_ref(private, &posn->old_oid) < 0)
die("Could not read ref %s", private); die(_("could not read ref %s"), private);
free(private); free(private);
} }
} }
@ -554,7 +554,7 @@ static int run_connect(struct transport *transport, struct strbuf *cmdbuf)
*/ */
duped = dup(helper->out); duped = dup(helper->out);
if (duped < 0) if (duped < 0)
die_errno("Can't dup helper output fd"); die_errno(_("can't dup helper output fd"));
input = xfdopen(duped, "r"); input = xfdopen(duped, "r");
setvbuf(input, NULL, _IONBF, 0); setvbuf(input, NULL, _IONBF, 0);
@ -573,8 +573,8 @@ static int run_connect(struct transport *transport, struct strbuf *cmdbuf)
fprintf(stderr, "Debug: Falling back to dumb " fprintf(stderr, "Debug: Falling back to dumb "
"transport.\n"); "transport.\n");
} else { } else {
die("Unknown response to connect: %s", die(_(_("unknown response to connect: %s")),
cmdbuf->buf); cmdbuf->buf);
} }
fclose(input); fclose(input);
@ -595,9 +595,9 @@ static int process_connect_service(struct transport *transport,
if (strcmp(name, exec)) { if (strcmp(name, exec)) {
int r = set_helper_option(transport, "servpath", exec); int r = set_helper_option(transport, "servpath", exec);
if (r > 0) if (r > 0)
warning("Setting remote service path not supported by protocol."); warning(_("setting remote service path not supported by protocol"));
else if (r < 0) else if (r < 0)
warning("Invalid remote service path."); warning(_("invalid remote service path"));
} }
if (data->connect) { if (data->connect) {
@ -640,10 +640,10 @@ static int connect_helper(struct transport *transport, const char *name,
/* Get_helper so connect is inited. */ /* Get_helper so connect is inited. */
get_helper(transport); get_helper(transport);
if (!data->connect) if (!data->connect)
die("Operation not supported by protocol."); die(_("operation not supported by protocol"));
if (!process_connect_service(transport, name, exec)) if (!process_connect_service(transport, name, exec))
die("Can't connect to subservice %s.", name); die(_("can't connect to subservice %s"), name);
fd[0] = data->helper->out; fd[0] = data->helper->out;
fd[1] = data->helper->in; fd[1] = data->helper->in;
@ -712,7 +712,7 @@ static int push_update_ref_status(struct strbuf *buf,
status = REF_STATUS_REMOTE_REJECT; status = REF_STATUS_REMOTE_REJECT;
refname = buf->buf + 6; refname = buf->buf + 6;
} else } else
die("expected ok/error, helper said '%s'", buf->buf); die(_("expected ok/error, helper said '%s'"), buf->buf);
msg = strchr(refname, ' '); msg = strchr(refname, ' ');
if (msg) { if (msg) {
@ -765,7 +765,7 @@ static int push_update_ref_status(struct strbuf *buf,
if (!*ref) if (!*ref)
*ref = find_ref_by_name(remote_refs, refname); *ref = find_ref_by_name(remote_refs, refname);
if (!*ref) { if (!*ref) {
warning("helper reported unexpected status of %s", refname); warning(_("helper reported unexpected status of %s"), refname);
return 1; return 1;
} }
@ -826,20 +826,20 @@ static void set_common_push_options(struct transport *transport,
{ {
if (flags & TRANSPORT_PUSH_DRY_RUN) { if (flags & TRANSPORT_PUSH_DRY_RUN) {
if (set_helper_option(transport, "dry-run", "true") != 0) if (set_helper_option(transport, "dry-run", "true") != 0)
die("helper %s does not support dry-run", name); die(_("helper %s does not support dry-run"), name);
} else if (flags & TRANSPORT_PUSH_CERT_ALWAYS) { } else if (flags & TRANSPORT_PUSH_CERT_ALWAYS) {
if (set_helper_option(transport, TRANS_OPT_PUSH_CERT, "true") != 0) if (set_helper_option(transport, TRANS_OPT_PUSH_CERT, "true") != 0)
die("helper %s does not support --signed", name); die(_("helper %s does not support --signed"), name);
} else if (flags & TRANSPORT_PUSH_CERT_IF_ASKED) { } else if (flags & TRANSPORT_PUSH_CERT_IF_ASKED) {
if (set_helper_option(transport, TRANS_OPT_PUSH_CERT, "if-asked") != 0) if (set_helper_option(transport, TRANS_OPT_PUSH_CERT, "if-asked") != 0)
die("helper %s does not support --signed=if-asked", name); die(_("helper %s does not support --signed=if-asked"), name);
} }
if (flags & TRANSPORT_PUSH_OPTIONS) { if (flags & TRANSPORT_PUSH_OPTIONS) {
struct string_list_item *item; struct string_list_item *item;
for_each_string_list_item(item, transport->push_options) for_each_string_list_item(item, transport->push_options)
if (set_helper_option(transport, "push-option", item->string) != 0) if (set_helper_option(transport, "push-option", item->string) != 0)
die("helper %s does not support 'push-option'", name); die(_("helper %s does not support 'push-option'"), name);
} }
} }
@ -931,12 +931,12 @@ static int push_refs_with_export(struct transport *transport,
struct strbuf buf = STRBUF_INIT; struct strbuf buf = STRBUF_INIT;
if (!data->rs.nr) if (!data->rs.nr)
die("remote-helper doesn't support push; refspec needed"); die(_("remote-helper doesn't support push; refspec needed"));
set_common_push_options(transport, data->name, flags); set_common_push_options(transport, data->name, flags);
if (flags & TRANSPORT_PUSH_FORCE) { if (flags & TRANSPORT_PUSH_FORCE) {
if (set_helper_option(transport, "force", "true") != 0) if (set_helper_option(transport, "force", "true") != 0)
warning("helper %s does not support 'force'", data->name); warning(_("helper %s does not support 'force'"), data->name);
} }
helper = get_helper(transport); helper = get_helper(transport);
@ -983,12 +983,12 @@ static int push_refs_with_export(struct transport *transport,
} }
if (get_exporter(transport, &exporter, &revlist_args)) if (get_exporter(transport, &exporter, &revlist_args))
die("Couldn't run fast-export"); die(_("couldn't run fast-export"));
string_list_clear(&revlist_args, 1); string_list_clear(&revlist_args, 1);
if (finish_command(&exporter)) if (finish_command(&exporter))
die("Error while running fast-export"); die(_("error while running fast-export"));
if (push_update_refs_status(data, remote_refs, flags)) if (push_update_refs_status(data, remote_refs, flags))
return 1; return 1;
@ -1012,8 +1012,9 @@ static int push_refs(struct transport *transport,
} }
if (!remote_refs) { if (!remote_refs) {
fprintf(stderr, "No refs in common and none specified; doing nothing.\n" fprintf(stderr,
"Perhaps you should specify a branch such as 'master'.\n"); _("No refs in common and none specified; doing nothing.\n"
"Perhaps you should specify a branch such as 'master'.\n"));
return 0; return 0;
} }
@ -1075,7 +1076,7 @@ static struct ref *get_refs_list(struct transport *transport, int for_push,
eov = strchr(buf.buf, ' '); eov = strchr(buf.buf, ' ');
if (!eov) if (!eov)
die("Malformed response in ref list: %s", buf.buf); die(_("malformed response in ref list: %s"), buf.buf);
eon = strchr(eov + 1, ' '); eon = strchr(eov + 1, ' ');
*eov = '\0'; *eov = '\0';
if (eon) if (eon)
@ -1089,7 +1090,7 @@ static struct ref *get_refs_list(struct transport *transport, int for_push,
if (has_attribute(eon + 1, "unchanged")) { if (has_attribute(eon + 1, "unchanged")) {
(*tail)->status |= REF_STATUS_UPTODATE; (*tail)->status |= REF_STATUS_UPTODATE;
if (read_ref((*tail)->name, &(*tail)->old_oid) < 0) if (read_ref((*tail)->name, &(*tail)->old_oid) < 0)
die(_("Could not read ref %s"), die(_("could not read ref %s"),
(*tail)->name); (*tail)->name);
} }
} }
@ -1228,7 +1229,7 @@ static int udt_do_read(struct unidirectional_transfer *t)
bytes = read(t->src, t->buf + t->bufuse, BUFFERSIZE - t->bufuse); bytes = read(t->src, t->buf + t->bufuse, BUFFERSIZE - t->bufuse);
if (bytes < 0 && errno != EWOULDBLOCK && errno != EAGAIN && if (bytes < 0 && errno != EWOULDBLOCK && errno != EAGAIN &&
errno != EINTR) { errno != EINTR) {
error_errno("read(%s) failed", t->src_name); error_errno(_("read(%s) failed"), t->src_name);
return -1; return -1;
} else if (bytes == 0) { } else if (bytes == 0) {
transfer_debug("%s EOF (with %i bytes in buffer)", transfer_debug("%s EOF (with %i bytes in buffer)",
@ -1255,7 +1256,7 @@ static int udt_do_write(struct unidirectional_transfer *t)
transfer_debug("%s is writable", t->dest_name); transfer_debug("%s is writable", t->dest_name);
bytes = xwrite(t->dest, t->buf, t->bufuse); bytes = xwrite(t->dest, t->buf, t->bufuse);
if (bytes < 0 && errno != EWOULDBLOCK) { if (bytes < 0 && errno != EWOULDBLOCK) {
error_errno("write(%s) failed", t->dest_name); error_errno(_("write(%s) failed"), t->dest_name);
return -1; return -1;
} else if (bytes > 0) { } else if (bytes > 0) {
t->bufuse -= bytes; t->bufuse -= bytes;
@ -1304,11 +1305,11 @@ static int tloop_join(pthread_t thread, const char *name)
void *tret; void *tret;
err = pthread_join(thread, &tret); err = pthread_join(thread, &tret);
if (!tret) { if (!tret) {
error("%s thread failed", name); error(_("%s thread failed"), name);
return 1; return 1;
} }
if (err) { if (err) {
error("%s thread failed to join: %s", name, strerror(err)); error(_("%s thread failed to join: %s"), name, strerror(err));
return 1; return 1;
} }
return 0; return 0;
@ -1327,11 +1328,11 @@ static int tloop_spawnwait_tasks(struct bidirectional_transfer_state *s)
err = pthread_create(&gtp_thread, NULL, udt_copy_task_routine, err = pthread_create(&gtp_thread, NULL, udt_copy_task_routine,
&s->gtp); &s->gtp);
if (err) if (err)
die("Can't start thread for copying data: %s", strerror(err)); die(_("can't start thread for copying data: %s"), strerror(err));
err = pthread_create(&ptg_thread, NULL, udt_copy_task_routine, err = pthread_create(&ptg_thread, NULL, udt_copy_task_routine,
&s->ptg); &s->ptg);
if (err) if (err)
die("Can't start thread for copying data: %s", strerror(err)); die(_("can't start thread for copying data: %s"), strerror(err));
ret |= tloop_join(gtp_thread, "Git to program copy"); ret |= tloop_join(gtp_thread, "Git to program copy");
ret |= tloop_join(ptg_thread, "Program to git copy"); ret |= tloop_join(ptg_thread, "Program to git copy");
@ -1368,11 +1369,11 @@ static int tloop_join(pid_t pid, const char *name)
{ {
int tret; int tret;
if (waitpid(pid, &tret, 0) < 0) { if (waitpid(pid, &tret, 0) < 0) {
error_errno("%s process failed to wait", name); error_errno(_("%s process failed to wait"), name);
return 1; return 1;
} }
if (!WIFEXITED(tret) || WEXITSTATUS(tret)) { if (!WIFEXITED(tret) || WEXITSTATUS(tret)) {
error("%s process failed", name); error(_("%s process failed"), name);
return 1; return 1;
} }
return 0; return 0;
@ -1390,7 +1391,7 @@ static int tloop_spawnwait_tasks(struct bidirectional_transfer_state *s)
/* Fork thread #1: git to program. */ /* Fork thread #1: git to program. */
pid1 = fork(); pid1 = fork();
if (pid1 < 0) if (pid1 < 0)
die_errno("Can't start thread for copying data"); die_errno(_("can't start thread for copying data"));
else if (pid1 == 0) { else if (pid1 == 0) {
udt_kill_transfer(&s->ptg); udt_kill_transfer(&s->ptg);
exit(udt_copy_task_routine(&s->gtp) ? 0 : 1); exit(udt_copy_task_routine(&s->gtp) ? 0 : 1);
@ -1399,7 +1400,7 @@ static int tloop_spawnwait_tasks(struct bidirectional_transfer_state *s)
/* Fork thread #2: program to git. */ /* Fork thread #2: program to git. */
pid2 = fork(); pid2 = fork();
if (pid2 < 0) if (pid2 < 0)
die_errno("Can't start thread for copying data"); die_errno(_("can't start thread for copying data"));
else if (pid2 == 0) { else if (pid2 == 0) {
udt_kill_transfer(&s->gtp); udt_kill_transfer(&s->gtp);
exit(udt_copy_task_routine(&s->ptg) ? 0 : 1); exit(udt_copy_task_routine(&s->ptg) ? 0 : 1);

View File

@ -139,7 +139,7 @@ static struct ref *get_refs_from_bundle(struct transport *transport,
close(data->fd); close(data->fd);
data->fd = read_bundle_header(transport->url, &data->header); data->fd = read_bundle_header(transport->url, &data->header);
if (data->fd < 0) if (data->fd < 0)
die ("Could not read bundle '%s'.", transport->url); die(_("could not read bundle '%s'"), transport->url);
for (i = 0; i < data->header.references.nr; i++) { for (i = 0; i < data->header.references.nr; i++) {
struct ref_list_entry *e = data->header.references.list + i; struct ref_list_entry *e = data->header.references.list + i;
struct ref *ref = alloc_ref(e->name); struct ref *ref = alloc_ref(e->name);
@ -662,7 +662,7 @@ static int git_transport_push(struct transport *transport, struct ref *remote_re
switch (data->version) { switch (data->version) {
case protocol_v2: case protocol_v2:
die("support for protocol v2 not implemented yet"); die(_("support for protocol v2 not implemented yet"));
break; break;
case protocol_v1: case protocol_v1:
case protocol_v0: case protocol_v0:
@ -788,7 +788,7 @@ static enum protocol_allow_config parse_protocol_config(const char *key,
else if (!strcasecmp(value, "user")) else if (!strcasecmp(value, "user"))
return PROTOCOL_ALLOW_USER_ONLY; return PROTOCOL_ALLOW_USER_ONLY;
die("unknown value for config '%s': %s", key, value); die(_("unknown value for config '%s': %s"), key, value);
} }
static enum protocol_allow_config get_protocol_config(const char *type) static enum protocol_allow_config get_protocol_config(const char *type)
@ -854,7 +854,7 @@ int is_transport_allowed(const char *type, int from_user)
void transport_check_allowed(const char *type) void transport_check_allowed(const char *type)
{ {
if (!is_transport_allowed(type, -1)) if (!is_transport_allowed(type, -1))
die("transport '%s' not allowed", type); die(_("transport '%s' not allowed"), type);
} }
static struct transport_vtable bundle_vtable = { static struct transport_vtable bundle_vtable = {
@ -883,7 +883,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
ret->progress = isatty(2); ret->progress = isatty(2);
if (!remote) if (!remote)
die("No remote provided to transport_get()"); BUG("No remote provided to transport_get()");
ret->got_remote_refs = 0; ret->got_remote_refs = 0;
ret->remote = remote; ret->remote = remote;
@ -906,7 +906,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
if (helper) { if (helper) {
transport_helper_init(ret, helper); transport_helper_init(ret, helper);
} else if (starts_with(url, "rsync:")) { } else if (starts_with(url, "rsync:")) {
die("git-over-rsync is no longer supported"); die(_("git-over-rsync is no longer supported"));
} else if (url_is_local_not_ssh(url) && is_file(url) && is_bundle(url, 1)) { } else if (url_is_local_not_ssh(url) && is_file(url) && is_bundle(url, 1)) {
struct bundle_transport_data *data = xcalloc(1, sizeof(*data)); struct bundle_transport_data *data = xcalloc(1, sizeof(*data));
transport_check_allowed("file"); transport_check_allowed("file");
@ -1151,7 +1151,7 @@ int transport_push(struct transport *transport,
transport->push_options, transport->push_options,
pretend)) { pretend)) {
oid_array_clear(&commits); oid_array_clear(&commits);
die("Failed to push all needed submodules!"); die(_("failed to push all needed submodules"));
} }
oid_array_clear(&commits); oid_array_clear(&commits);
} }
@ -1289,7 +1289,7 @@ int transport_connect(struct transport *transport, const char *name,
if (transport->vtable->connect) if (transport->vtable->connect)
return transport->vtable->connect(transport, name, exec, fd); return transport->vtable->connect(transport, name, exec, fd);
else else
die("Operation not supported by protocol"); die(_("operation not supported by protocol"));
} }
int transport_disconnect(struct transport *transport) int transport_disconnect(struct transport *transport)
@ -1371,7 +1371,7 @@ static void read_alternate_refs(const char *path,
if (get_oid_hex(line.buf, &oid) || if (get_oid_hex(line.buf, &oid) ||
line.buf[GIT_SHA1_HEXSZ] != ' ') { line.buf[GIT_SHA1_HEXSZ] != ' ') {
warning("invalid line while parsing alternate refs: %s", warning(_("invalid line while parsing alternate refs: %s"),
line.buf); line.buf);
break; break;
} }