i18n: apply: mark error messages for translation
Mark error messages for translation passed to error() and die() functions. Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Vasco Almeida committed
Oct 14, 2016 at 11:43 UTC
d1d42bf5980b2d31f43f4a54c3d98d19f879b919
1 file changed
+24
-24
apply.c
+24
-24
@@ -122,9 +122,9 @@ int check_apply_state(struct apply_state *state, int force_apply)
122
int is_not_gitdir = !startup_info->have_repository;
123
124
if (state->apply_with_reject && state->threeway)
125
- return error("--reject and --3way cannot be used together.");
125
+ return error(_("--reject and --3way cannot be used together."));
126
if (state->cached && state->threeway)
127
- return error("--cached and --3way cannot be used together.");
127
+ return error(_("--cached and --3way cannot be used together."));
128
if (state->threeway) {
129
if (is_not_gitdir)
130
return error(_("--3way outside a repository"));
@@ -3095,8 +3095,8 @@ static int apply_binary_fragment(struct apply_state *state,
3095
/* Binary patch is irreversible without the optional second hunk */
3096
if (state->apply_in_reverse) {
3097
if (!fragment->next)
3098
- return error("cannot reverse-apply a binary patch "
3099
- "without the reverse hunk to '%s'",
3098
+ return error(_("cannot reverse-apply a binary patch "
3099
+ "without the reverse hunk to '%s'"),
3100
patch->new_name
3101
? patch->new_name : patch->old_name);
3102
fragment = fragment->next;
@@ -3141,8 +3141,8 @@ static int apply_binary(struct apply_state *state,
3141
strlen(patch->new_sha1_prefix) != 40 ||
3142
get_oid_hex(patch->old_sha1_prefix, &oid) ||
3143
get_oid_hex(patch->new_sha1_prefix, &oid))
3144
- return error("cannot apply binary patch to '%s' "
3145
- "without full index line", name);
3144
+ return error(_("cannot apply binary patch to '%s' "
3145
+ "without full index line"), name);
3146
3147
if (patch->old_name) {
3148
/*
@@ -3151,16 +3151,16 @@ static int apply_binary(struct apply_state *state,
3151
*/
3152
hash_sha1_file(img->buf, img->len, blob_type, oid.hash);
3153
if (strcmp(oid_to_hex(&oid), patch->old_sha1_prefix))
3154
- return error("the patch applies to '%s' (%s), "
3155
- "which does not match the "
3156
- "current contents.",
3154
+ return error(_("the patch applies to '%s' (%s), "
3155
+ "which does not match the "
3156
+ "current contents."),
3157
name, oid_to_hex(&oid));
3158
}
3159
else {
3160
/* Otherwise, the old one must be empty. */
3161
if (img->len)
3162
- return error("the patch applies to an empty "
3163
- "'%s' but it is not empty", name);
3162
+ return error(_("the patch applies to an empty "
3163
+ "'%s' but it is not empty"), name);
3164
}
3165
3166
get_oid_hex(patch->new_sha1_prefix, &oid);
@@ -3177,8 +3177,8 @@ static int apply_binary(struct apply_state *state,
3177
3178
result = read_sha1_file(oid.hash, &type, &size);
3179
if (!result)
3180
- return error("the necessary postimage %s for "
3181
- "'%s' cannot be read",
3180
+ return error(_("the necessary postimage %s for "
3181
+ "'%s' cannot be read"),
3182
patch->new_sha1_prefix, name);
3183
clear_image(img);
3184
img->buf = result;
@@ -3551,7 +3551,7 @@ static int try_threeway(struct apply_state *state,
3551
write_sha1_file("", 0, blob_type, pre_oid.hash);
3552
else if (get_sha1(patch->old_sha1_prefix, pre_oid.hash) ||
3553
read_blob_object(&buf, &pre_oid, patch->old_mode))
3554
- return error("repository lacks the necessary blob to fall back on 3-way merge.");
3554
+ return error(_("repository lacks the necessary blob to fall back on 3-way merge."));
3555
3556
if (state->apply_verbosity > verbosity_silent)
3557
fprintf(stderr, _("Falling back to three-way merge...\n"));
@@ -3570,11 +3570,11 @@ static int try_threeway(struct apply_state *state,
3570
/* our_oid is ours */
3571
if (patch->is_new) {
3572
if (load_current(state, &tmp_image, patch))
3573
- return error("cannot read the current contents of '%s'",
3573
+ return error(_("cannot read the current contents of '%s'"),
3574
patch->new_name);
3575
} else {
3576
if (load_preimage(state, &tmp_image, patch, st, ce))
3577
- return error("cannot read the current contents of '%s'",
3577
+ return error(_("cannot read the current contents of '%s'"),
3578
patch->old_name);
3579
}
3580
write_sha1_file(tmp_image.buf, tmp_image.len, blob_type, our_oid.hash);
@@ -4072,18 +4072,18 @@ static int build_fake_ancestor(struct apply_state *state, struct patch *list)
4072
if (!preimage_oid_in_gitlink_patch(patch, &oid))
4073
; /* ok, the textual part looks sane */
4074
else
4075
- return error("sha1 information is lacking or "
4076
- "useless for submodule %s", name);
4075
+ return error(_("sha1 information is lacking or "
4076
+ "useless for submodule %s"), name);
4077
} else if (!get_sha1_blob(patch->old_sha1_prefix, oid.hash)) {
4078
; /* ok */
4079
} else if (!patch->lines_added && !patch->lines_deleted) {
4080
/* mode-only change: update the current */
4081
if (get_current_oid(state, patch->old_name, &oid))
4082
- return error("mode change for %s, which is not "
4083
- "in current HEAD", name);
4082
+ return error(_("mode change for %s, which is not "
4083
+ "in current HEAD"), name);
4084
} else
4085
- return error("sha1 information is lacking or useless "
4086
- "(%s).", name);
4085
+ return error(_("sha1 information is lacking or useless "
4086
+ "(%s)."), name);
4087
4088
ce = make_cache_entry(patch->old_mode, oid.hash, name, 0, 0);
4089
if (!ce)
@@ -4091,7 +4091,7 @@ static int build_fake_ancestor(struct apply_state *state, struct patch *list)
4091
name);
4092
if (add_index_entry(&result, ce, ADD_CACHE_OK_TO_ADD)) {
4093
free(ce);
4094
- return error("Could not add %s to temporary index",
4094
+ return error(_("could not add %s to temporary index"),
4095
name);
4096
}
4097
}
@@ -4101,7 +4101,7 @@ static int build_fake_ancestor(struct apply_state *state, struct patch *list)
4101
discard_index(&result);
4102
4103
if (res)
4104
- return error("Could not write temporary index to %s",
4104
+ return error(_("could not write temporary index to %s"),
4105
state->fake_ancestor);
4106
4107
return 0;