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 <dyroneteng@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Teng Long committed Jul 19, 2022 at 00:46 UTC 9975975d7f1930883b8596248afa30b5143e8035
1 file changed +24 -24
pack-bitmap.c
+24 -24
@@ -139,7 +139,7 @@ static struct ewah_bitmap *read_bitmap_1(struct bitmap_index *index)
139 index->map_size - index->map_pos);
140
141 if (bitmap_size < 0) {
142 - error("failed to load bitmap index (corrupted?)");
142 + error(_("failed to load bitmap index (corrupted?)"));
143 ewah_pool_free(b);
144 return NULL;
145 }
@@ -161,14 +161,14 @@ static int load_bitmap_header(struct bitmap_index *index)
161 size_t header_size = sizeof(*header) - GIT_MAX_RAWSZ + the_hash_algo->rawsz;
162
163 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)"));
165
166 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)"));
168
169 index->version = ntohs(header->version);
170 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);
172
173 /* Parse known bitmap format options */
174 {
@@ -182,7 +182,7 @@ static int load_bitmap_header(struct bitmap_index *index)
182
183 if (flags & BITMAP_OPT_HASH_CACHE) {
184 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)"));
186 index->hashes = (void *)(index_end - cache_size);
187 index_end -= cache_size;
188 }
@@ -216,7 +216,7 @@ static struct stored_bitmap *store_bitmap(struct bitmap_index *index,
216 * because the SHA1 already existed on the map. this is bad, there
217 * shouldn't be duplicated commits in the index */
218 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));
220 return NULL;
221 }
222
@@ -260,14 +260,14 @@ static int load_bitmap_entries_v1(struct bitmap_index *index)
260 struct object_id oid;
261
262 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);
264
265 commit_idx_pos = read_be32(index->map, &index->map_pos);
266 xor_offset = read_u8(index->map, &index->map_pos);
267 flags = read_u8(index->map, &index->map_pos);
268
269 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"),
271 (unsigned)commit_idx_pos);
272
273 bitmap = read_bitmap_1(index);
@@ -275,13 +275,13 @@ static int load_bitmap_entries_v1(struct bitmap_index *index)
275 return -1;
276
277 if (xor_offset > MAX_XOR_OFFSET || xor_offset > i)
278 - return error("corrupted bitmap pack index");
278 + return error(_("corrupted bitmap pack index"));
279
280 if (xor_offset > 0) {
281 xor_bitmap = recent_bitmaps[(i - xor_offset) % MAX_XOR_OFFSET];
282
283 if (xor_bitmap == NULL)
284 - return error("invalid XOR offset in bitmap pack index");
284 + return error(_("invalid XOR offset in bitmap pack index"));
285 }
286
287 recent_bitmaps[i % MAX_XOR_OFFSET] = store_bitmap(
@@ -331,7 +331,7 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git,
331 struct strbuf buf = STRBUF_INIT;
332 get_midx_filename(&buf, midx->object_dir);
333 /* 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);
335 close(fd);
336 strbuf_release(&buf);
337 return -1;
@@ -388,7 +388,7 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git
388
389 if (bitmap_git->pack || bitmap_git->midx) {
390 /* 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);
392 close(fd);
393 return -1;
394 }
@@ -818,7 +818,7 @@ static struct bitmap *find_objects(struct bitmap_index *bitmap_git,
818 revs->include_check_data = &incdata;
819
820 if (prepare_revision_walk(revs))
821 - die("revision walk setup failed");
821 + die(_("revision walk setup failed"));
822
823 show_data.bitmap_git = bitmap_git;
824 show_data.base = base;
@@ -1627,15 +1627,15 @@ static void test_bitmap_type(struct bitmap_test_data *tdata,
1627 }
1628
1629 if (bitmap_type == OBJ_NONE)
1630 - die("object '%s' not found in type bitmaps",
1630 + die(_("object '%s' not found in type bitmaps"),
1631 oid_to_hex(&obj->oid));
1632
1633 if (bitmaps_nr > 1)
1634 - die("object '%s' does not have a unique type",
1634 + die(_("object '%s' does not have a unique type"),
1635 oid_to_hex(&obj->oid));
1636
1637 if (bitmap_type != obj->type)
1638 - die("object '%s': real type '%s', expected: '%s'",
1638 + die(_("object '%s': real type '%s', expected: '%s'"),
1639 oid_to_hex(&obj->oid),
1640 type_name(obj->type),
1641 type_name(bitmap_type));
@@ -1649,7 +1649,7 @@ static void test_show_object(struct object *object, const char *name,
1649
1650 bitmap_pos = bitmap_position(tdata->bitmap_git, &object->oid);
1651 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));
1653 test_bitmap_type(tdata, object, bitmap_pos);
1654
1655 bitmap_set(tdata->base, bitmap_pos);
@@ -1664,7 +1664,7 @@ static void test_show_commit(struct commit *commit, void *data)
1664 bitmap_pos = bitmap_position(tdata->bitmap_git,
1665 &commit->object.oid);
1666 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));
1668 test_bitmap_type(tdata, &commit->object, bitmap_pos);
1669
1670 bitmap_set(tdata->base, bitmap_pos);
@@ -1681,10 +1681,10 @@ void test_bitmap_walk(struct rev_info *revs)
1681 struct ewah_bitmap *bm;
1682
1683 if (!(bitmap_git = prepare_bitmap_git(revs->repo)))
1684 - die("failed to load bitmap indexes");
1684 + die(_("failed to load bitmap indexes"));
1685
1686 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"));
1688
1689 fprintf_ln(stderr, "Bitmap v%d test (%d entries loaded)",
1690 bitmap_git->version, bitmap_git->entry_count);
@@ -1700,7 +1700,7 @@ void test_bitmap_walk(struct rev_info *revs)
1700 }
1701
1702 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));
1704
1705 revs->tag_objects = 1;
1706 revs->tree_objects = 1;
@@ -1709,7 +1709,7 @@ void test_bitmap_walk(struct rev_info *revs)
1709 result_popcnt = bitmap_popcount(result);
1710
1711 if (prepare_revision_walk(revs))
1712 - die("revision walk setup failed");
1712 + die(_("revision walk setup failed"));
1713
1714 tdata.bitmap_git = bitmap_git;
1715 tdata.base = bitmap_new();
@@ -1727,7 +1727,7 @@ void test_bitmap_walk(struct rev_info *revs)
1727 if (bitmap_equals(result, tdata.base))
1728 fprintf_ln(stderr, "OK!");
1729 else
1730 - die("mismatch in bitmap results");
1730 + die(_("mismatch in bitmap results"));
1731
1732 bitmap_free(result);
1733 bitmap_free(tdata.base);
@@ -1745,7 +1745,7 @@ int test_bitmap_commits(struct repository *r)
1745 MAYBE_UNUSED void *value;
1746
1747 if (!bitmap_git)
1748 - die("failed to load bitmap indexes");
1748 + die(_("failed to load bitmap indexes"));
1749
1750 kh_foreach(bitmap_git->bitmaps, oid, value, {
1751 printf_ln("%s", oid_to_hex(&oid));