Skip to content

Commit 9975975

Browse files
dyronegitster
authored andcommitted
pack-bitmap.c: mark more strings for translations
In pack-bitmap.c, some printed texts are translated, some are not. Let's support the translations of the bitmap related output. Signed-off-by: Teng Long <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent baf20c3 commit 9975975

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

pack-bitmap.c

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ static struct ewah_bitmap *read_bitmap_1(struct bitmap_index *index)
139139
index->map_size - index->map_pos);
140140

141141
if (bitmap_size < 0) {
142-
error("failed to load bitmap index (corrupted?)");
142+
error(_("failed to load bitmap index (corrupted?)"));
143143
ewah_pool_free(b);
144144
return NULL;
145145
}
@@ -161,14 +161,14 @@ static int load_bitmap_header(struct bitmap_index *index)
161161
size_t header_size = sizeof(*header) - GIT_MAX_RAWSZ + the_hash_algo->rawsz;
162162

163163
if (index->map_size < header_size + the_hash_algo->rawsz)
164-
return error("corrupted bitmap index (too small)");
164+
return error(_("corrupted bitmap index (too small)"));
165165

166166
if (memcmp(header->magic, BITMAP_IDX_SIGNATURE, sizeof(BITMAP_IDX_SIGNATURE)) != 0)
167-
return error("corrupted bitmap index file (wrong header)");
167+
return error(_("corrupted bitmap index file (wrong header)"));
168168

169169
index->version = ntohs(header->version);
170170
if (index->version != 1)
171-
return error("unsupported version '%d' for bitmap index file", index->version);
171+
return error(_("unsupported version '%d' for bitmap index file"), index->version);
172172

173173
/* Parse known bitmap format options */
174174
{
@@ -182,7 +182,7 @@ static int load_bitmap_header(struct bitmap_index *index)
182182

183183
if (flags & BITMAP_OPT_HASH_CACHE) {
184184
if (cache_size > index_end - index->map - header_size)
185-
return error("corrupted bitmap index file (too short to fit hash cache)");
185+
return error(_("corrupted bitmap index file (too short to fit hash cache)"));
186186
index->hashes = (void *)(index_end - cache_size);
187187
index_end -= cache_size;
188188
}
@@ -216,7 +216,7 @@ static struct stored_bitmap *store_bitmap(struct bitmap_index *index,
216216
* because the SHA1 already existed on the map. this is bad, there
217217
* shouldn't be duplicated commits in the index */
218218
if (ret == 0) {
219-
error("duplicate entry in bitmap index: '%s'", oid_to_hex(oid));
219+
error(_("duplicate entry in bitmap index: '%s'"), oid_to_hex(oid));
220220
return NULL;
221221
}
222222

@@ -260,28 +260,28 @@ static int load_bitmap_entries_v1(struct bitmap_index *index)
260260
struct object_id oid;
261261

262262
if (index->map_size - index->map_pos < 6)
263-
return error("corrupt ewah bitmap: truncated header for entry %d", i);
263+
return error(_("corrupt ewah bitmap: truncated header for entry %d"), i);
264264

265265
commit_idx_pos = read_be32(index->map, &index->map_pos);
266266
xor_offset = read_u8(index->map, &index->map_pos);
267267
flags = read_u8(index->map, &index->map_pos);
268268

269269
if (nth_bitmap_object_oid(index, &oid, commit_idx_pos) < 0)
270-
return error("corrupt ewah bitmap: commit index %u out of range",
270+
return error(_("corrupt ewah bitmap: commit index %u out of range"),
271271
(unsigned)commit_idx_pos);
272272

273273
bitmap = read_bitmap_1(index);
274274
if (!bitmap)
275275
return -1;
276276

277277
if (xor_offset > MAX_XOR_OFFSET || xor_offset > i)
278-
return error("corrupted bitmap pack index");
278+
return error(_("corrupted bitmap pack index"));
279279

280280
if (xor_offset > 0) {
281281
xor_bitmap = recent_bitmaps[(i - xor_offset) % MAX_XOR_OFFSET];
282282

283283
if (xor_bitmap == NULL)
284-
return error("invalid XOR offset in bitmap pack index");
284+
return error(_("invalid XOR offset in bitmap pack index"));
285285
}
286286

287287
recent_bitmaps[i % MAX_XOR_OFFSET] = store_bitmap(
@@ -331,7 +331,7 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git,
331331
struct strbuf buf = STRBUF_INIT;
332332
get_midx_filename(&buf, midx->object_dir);
333333
/* ignore extra bitmap file; we can only handle one */
334-
warning("ignoring extra bitmap file: '%s'", buf.buf);
334+
warning(_("ignoring extra bitmap file: '%s'"), buf.buf);
335335
close(fd);
336336
strbuf_release(&buf);
337337
return -1;
@@ -388,7 +388,7 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git
388388

389389
if (bitmap_git->pack || bitmap_git->midx) {
390390
/* ignore extra bitmap file; we can only handle one */
391-
warning("ignoring extra bitmap file: '%s'", packfile->pack_name);
391+
warning(_("ignoring extra bitmap file: '%s'"), packfile->pack_name);
392392
close(fd);
393393
return -1;
394394
}
@@ -818,7 +818,7 @@ static struct bitmap *find_objects(struct bitmap_index *bitmap_git,
818818
revs->include_check_data = &incdata;
819819

820820
if (prepare_revision_walk(revs))
821-
die("revision walk setup failed");
821+
die(_("revision walk setup failed"));
822822

823823
show_data.bitmap_git = bitmap_git;
824824
show_data.base = base;
@@ -1627,15 +1627,15 @@ static void test_bitmap_type(struct bitmap_test_data *tdata,
16271627
}
16281628

16291629
if (bitmap_type == OBJ_NONE)
1630-
die("object '%s' not found in type bitmaps",
1630+
die(_("object '%s' not found in type bitmaps"),
16311631
oid_to_hex(&obj->oid));
16321632

16331633
if (bitmaps_nr > 1)
1634-
die("object '%s' does not have a unique type",
1634+
die(_("object '%s' does not have a unique type"),
16351635
oid_to_hex(&obj->oid));
16361636

16371637
if (bitmap_type != obj->type)
1638-
die("object '%s': real type '%s', expected: '%s'",
1638+
die(_("object '%s': real type '%s', expected: '%s'"),
16391639
oid_to_hex(&obj->oid),
16401640
type_name(obj->type),
16411641
type_name(bitmap_type));
@@ -1649,7 +1649,7 @@ static void test_show_object(struct object *object, const char *name,
16491649

16501650
bitmap_pos = bitmap_position(tdata->bitmap_git, &object->oid);
16511651
if (bitmap_pos < 0)
1652-
die("object not in bitmap: '%s'", oid_to_hex(&object->oid));
1652+
die(_("object not in bitmap: '%s'"), oid_to_hex(&object->oid));
16531653
test_bitmap_type(tdata, object, bitmap_pos);
16541654

16551655
bitmap_set(tdata->base, bitmap_pos);
@@ -1664,7 +1664,7 @@ static void test_show_commit(struct commit *commit, void *data)
16641664
bitmap_pos = bitmap_position(tdata->bitmap_git,
16651665
&commit->object.oid);
16661666
if (bitmap_pos < 0)
1667-
die("object not in bitmap: '%s'", oid_to_hex(&commit->object.oid));
1667+
die(_("object not in bitmap: '%s'"), oid_to_hex(&commit->object.oid));
16681668
test_bitmap_type(tdata, &commit->object, bitmap_pos);
16691669

16701670
bitmap_set(tdata->base, bitmap_pos);
@@ -1681,10 +1681,10 @@ void test_bitmap_walk(struct rev_info *revs)
16811681
struct ewah_bitmap *bm;
16821682

16831683
if (!(bitmap_git = prepare_bitmap_git(revs->repo)))
1684-
die("failed to load bitmap indexes");
1684+
die(_("failed to load bitmap indexes"));
16851685

16861686
if (revs->pending.nr != 1)
1687-
die("you must specify exactly one commit to test");
1687+
die(_("you must specify exactly one commit to test"));
16881688

16891689
fprintf_ln(stderr, "Bitmap v%d test (%d entries loaded)",
16901690
bitmap_git->version, bitmap_git->entry_count);
@@ -1700,7 +1700,7 @@ void test_bitmap_walk(struct rev_info *revs)
17001700
}
17011701

17021702
if (result == NULL)
1703-
die("commit '%s' doesn't have an indexed bitmap", oid_to_hex(&root->oid));
1703+
die(_("commit '%s' doesn't have an indexed bitmap"), oid_to_hex(&root->oid));
17041704

17051705
revs->tag_objects = 1;
17061706
revs->tree_objects = 1;
@@ -1709,7 +1709,7 @@ void test_bitmap_walk(struct rev_info *revs)
17091709
result_popcnt = bitmap_popcount(result);
17101710

17111711
if (prepare_revision_walk(revs))
1712-
die("revision walk setup failed");
1712+
die(_("revision walk setup failed"));
17131713

17141714
tdata.bitmap_git = bitmap_git;
17151715
tdata.base = bitmap_new();
@@ -1727,7 +1727,7 @@ void test_bitmap_walk(struct rev_info *revs)
17271727
if (bitmap_equals(result, tdata.base))
17281728
fprintf_ln(stderr, "OK!");
17291729
else
1730-
die("mismatch in bitmap results");
1730+
die(_("mismatch in bitmap results"));
17311731

17321732
bitmap_free(result);
17331733
bitmap_free(tdata.base);
@@ -1745,7 +1745,7 @@ int test_bitmap_commits(struct repository *r)
17451745
MAYBE_UNUSED void *value;
17461746

17471747
if (!bitmap_git)
1748-
die("failed to load bitmap indexes");
1748+
die(_("failed to load bitmap indexes"));
17491749

17501750
kh_foreach(bitmap_git->bitmaps, oid, value, {
17511751
printf_ln("%s", oid_to_hex(&oid));

0 commit comments

Comments
 (0)