Skip to content

Commit 227e2cc

Browse files
shreyp135gitster
authored andcommitted
show-index: use gettext wrapping in user facing error messages
Multiple 'die()' calls in show-index.c use literal strings directly. Wrap all user-facing 'die()' messages with '_()' so they can be translated via gettext, this ensures better support for users. Signed-off-by: Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent ea39808 commit 227e2cc

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

builtin/show-index.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,31 +55,31 @@ int cmd_show_index(int argc,
5555
hashsz = the_hash_algo->rawsz;
5656

5757
if (fread(top_index, 2 * 4, 1, stdin) != 1)
58-
die("unable to read header");
58+
die(_("unable to read header"));
5959
if (top_index[0] == htonl(PACK_IDX_SIGNATURE)) {
6060
version = ntohl(top_index[1]);
6161
if (version < 2 || version > 2)
62-
die("unknown index version");
62+
die(_("unknown index version"));
6363
if (fread(top_index, 256 * 4, 1, stdin) != 1)
64-
die("unable to read index");
64+
die(_("unable to read index"));
6565
} else {
6666
version = 1;
6767
if (fread(&top_index[2], 254 * 4, 1, stdin) != 1)
68-
die("unable to read index");
68+
die(_("unable to read index"));
6969
}
7070
nr = 0;
7171
for (i = 0; i < 256; i++) {
7272
unsigned n = ntohl(top_index[i]);
7373
if (n < nr)
74-
die("corrupt index file");
74+
die(_("corrupt index file"));
7575
nr = n;
7676
}
7777
if (version == 1) {
7878
for (i = 0; i < nr; i++) {
7979
unsigned int offset, entry[(GIT_MAX_RAWSZ + 4) / sizeof(unsigned int)];
8080

8181
if (fread(entry, 4 + hashsz, 1, stdin) != 1)
82-
die("unable to read entry %u/%u", i, nr);
82+
die(_("unable to read entry %u/%u"), i, nr);
8383
offset = ntohl(entry[0]);
8484
printf("%u %s\n", offset, hash_to_hex((void *)(entry+1)));
8585
}
@@ -93,15 +93,15 @@ int cmd_show_index(int argc,
9393
ALLOC_ARRAY(entries, nr);
9494
for (i = 0; i < nr; i++) {
9595
if (fread(entries[i].oid.hash, hashsz, 1, stdin) != 1)
96-
die("unable to read sha1 %u/%u", i, nr);
96+
die(_("unable to read sha1 %u/%u"), i, nr);
9797
entries[i].oid.algo = hash_algo_by_ptr(the_hash_algo);
9898
}
9999
for (i = 0; i < nr; i++)
100100
if (fread(&entries[i].crc, 4, 1, stdin) != 1)
101-
die("unable to read crc %u/%u", i, nr);
101+
die(_("unable to read crc %u/%u"), i, nr);
102102
for (i = 0; i < nr; i++)
103103
if (fread(&entries[i].off, 4, 1, stdin) != 1)
104-
die("unable to read 32b offset %u/%u", i, nr);
104+
die(_("unable to read 32b offset %u/%u"), i, nr);
105105
for (i = 0; i < nr; i++) {
106106
uint64_t offset;
107107
uint32_t off = ntohl(entries[i].off);
@@ -110,9 +110,9 @@ int cmd_show_index(int argc,
110110
} else {
111111
uint32_t off64[2];
112112
if ((off & 0x7fffffff) != off64_nr)
113-
die("inconsistent 64b offset index");
113+
die(_("inconsistent 64b offset index"));
114114
if (fread(off64, 8, 1, stdin) != 1)
115-
die("unable to read 64b offset %u", off64_nr);
115+
die(_("unable to read 64b offset %u"), off64_nr);
116116
offset = (((uint64_t)ntohl(off64[0])) << 32) |
117117
ntohl(off64[1]);
118118
off64_nr++;

0 commit comments

Comments
 (0)