@@ -140,7 +140,7 @@ static void *get_delta(struct object_entry *entry)
140140
141141 buf = read_object_file (& entry -> idx .oid , & type , & size );
142142 if (!buf )
143- die ("unable to read %s" , oid_to_hex (& entry -> idx .oid ));
143+ die (_ ( "unable to read %s" ) , oid_to_hex (& entry -> idx .oid ));
144144 base_buf = read_object_file (& DELTA (entry )-> idx .oid , & type ,
145145 & base_size );
146146 if (!base_buf )
@@ -411,7 +411,7 @@ static off_t write_reuse_object(struct hashfile *f, struct object_entry *entry,
411411 datalen = revidx [1 ].offset - offset ;
412412 if (!pack_to_stdout && p -> index_version > 1 &&
413413 check_pack_crc (p , & w_curs , offset , datalen , revidx -> nr )) {
414- error ("bad packed object CRC for %s" ,
414+ error (_ ( "bad packed object CRC for %s" ) ,
415415 oid_to_hex (& entry -> idx .oid ));
416416 unuse_pack (& w_curs );
417417 return write_no_reuse_object (f , entry , limit , usable_delta );
@@ -422,7 +422,7 @@ static off_t write_reuse_object(struct hashfile *f, struct object_entry *entry,
422422
423423 if (!pack_to_stdout && p -> index_version == 1 &&
424424 check_pack_inflate (p , & w_curs , offset , datalen , entry_size )) {
425- error ("corrupt packed object for %s" ,
425+ error (_ ( "corrupt packed object for %s" ) ,
426426 oid_to_hex (& entry -> idx .oid ));
427427 unuse_pack (& w_curs );
428428 return write_no_reuse_object (f , entry , limit , usable_delta );
@@ -553,7 +553,7 @@ static enum write_one_status write_one(struct hashfile *f,
553553 */
554554 recursing = (e -> idx .offset == 1 );
555555 if (recursing ) {
556- warning ("recursive delta detected for object %s" ,
556+ warning (_ ( "recursive delta detected for object %s" ) ,
557557 oid_to_hex (& e -> idx .oid ));
558558 return WRITE_ONE_RECURSIVE ;
559559 } else if (e -> idx .offset || e -> preferred_base ) {
@@ -587,7 +587,7 @@ static enum write_one_status write_one(struct hashfile *f,
587587
588588 /* make sure off_t is sufficiently large not to wrap */
589589 if (signed_add_overflows (* offset , size ))
590- die ("pack too large for current definition of off_t" );
590+ die (_ ( "pack too large for current definition of off_t" ) );
591591 * offset += size ;
592592 return WRITE_ONE_WRITTEN ;
593593}
@@ -753,7 +753,8 @@ static struct object_entry **compute_write_order(void)
753753 }
754754
755755 if (wo_end != to_pack .nr_objects )
756- die ("ordered %u objects, expected %" PRIu32 , wo_end , to_pack .nr_objects );
756+ die (_ ("ordered %u objects, expected %" PRIu32 ),
757+ wo_end , to_pack .nr_objects );
757758
758759 return wo ;
759760}
@@ -765,15 +766,15 @@ static off_t write_reused_pack(struct hashfile *f)
765766 int fd ;
766767
767768 if (!is_pack_valid (reuse_packfile ))
768- die ("packfile is invalid: %s" , reuse_packfile -> pack_name );
769+ die (_ ( "packfile is invalid: %s" ) , reuse_packfile -> pack_name );
769770
770771 fd = git_open (reuse_packfile -> pack_name );
771772 if (fd < 0 )
772- die_errno ("unable to open packfile for reuse: %s" ,
773+ die_errno (_ ( "unable to open packfile for reuse: %s" ) ,
773774 reuse_packfile -> pack_name );
774775
775776 if (lseek (fd , sizeof (struct pack_header ), SEEK_SET ) == -1 )
776- die_errno ("unable to seek in reused packfile" );
777+ die_errno (_ ( "unable to seek in reused packfile" ) );
777778
778779 if (reuse_packfile_offset < 0 )
779780 reuse_packfile_offset = reuse_packfile -> pack_size - the_hash_algo -> rawsz ;
@@ -784,7 +785,7 @@ static off_t write_reused_pack(struct hashfile *f)
784785 int read_pack = xread (fd , buffer , sizeof (buffer ));
785786
786787 if (read_pack <= 0 )
787- die_errno ("unable to read from reused packfile" );
788+ die_errno (_ ( "unable to read from reused packfile" ) );
788789
789790 if (read_pack > to_write )
790791 read_pack = to_write ;
@@ -887,15 +888,15 @@ static void write_pack_file(void)
887888 * to preserve this property.
888889 */
889890 if (stat (pack_tmp_name , & st ) < 0 ) {
890- warning_errno ("failed to stat %s" , pack_tmp_name );
891+ warning_errno (_ ( "failed to stat %s" ) , pack_tmp_name );
891892 } else if (!last_mtime ) {
892893 last_mtime = st .st_mtime ;
893894 } else {
894895 struct utimbuf utb ;
895896 utb .actime = st .st_atime ;
896897 utb .modtime = -- last_mtime ;
897898 if (utime (pack_tmp_name , & utb ) < 0 )
898- warning_errno ("failed utime() on %s" , pack_tmp_name );
899+ warning_errno (_ ( "failed utime() on %s" ) , pack_tmp_name );
899900 }
900901
901902 strbuf_addf (& tmpname , "%s-" , base_name );
@@ -940,8 +941,8 @@ static void write_pack_file(void)
940941 free (write_order );
941942 stop_progress (& progress_state );
942943 if (written != nr_result )
943- die ("wrote %" PRIu32 " objects while expecting %" PRIu32 ,
944- written , nr_result );
944+ die (_ ( "wrote %" PRIu32 " objects while expecting %" PRIu32 ) ,
945+ written , nr_result );
945946}
946947
947948static int no_try_delta (const char * path )
@@ -1485,7 +1486,7 @@ static void check_object(struct object_entry *entry)
14851486 while (c & 128 ) {
14861487 ofs += 1 ;
14871488 if (!ofs || MSB (ofs , 7 )) {
1488- error ("delta base offset overflow in pack for %s" ,
1489+ error (_ ( "delta base offset overflow in pack for %s" ) ,
14891490 oid_to_hex (& entry -> idx .oid ));
14901491 goto give_up ;
14911492 }
@@ -1494,7 +1495,7 @@ static void check_object(struct object_entry *entry)
14941495 }
14951496 ofs = entry -> in_pack_offset - ofs ;
14961497 if (ofs <= 0 || ofs >= entry -> in_pack_offset ) {
1497- error ("delta base offset out of bound for %s" ,
1498+ error (_ ( "delta base offset out of bound for %s" ) ,
14981499 oid_to_hex (& entry -> idx .oid ));
14991500 goto give_up ;
15001501 }
@@ -1979,10 +1980,10 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
19791980 trg -> data = read_object_file (& trg_entry -> idx .oid , & type , & sz );
19801981 read_unlock ();
19811982 if (!trg -> data )
1982- die ("object %s cannot be read" ,
1983+ die (_ ( "object %s cannot be read" ) ,
19831984 oid_to_hex (& trg_entry -> idx .oid ));
19841985 if (sz != trg_size )
1985- die ("object %s inconsistent object length (%lu vs %lu)" ,
1986+ die (_ ( "object %s inconsistent object length (%lu vs %lu)" ) ,
19861987 oid_to_hex (& trg_entry -> idx .oid ), sz ,
19871988 trg_size );
19881989 * mem_usage += sz ;
@@ -1995,7 +1996,7 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
19951996 if (src_entry -> preferred_base ) {
19961997 static int warned = 0 ;
19971998 if (!warned ++ )
1998- warning ("object %s cannot be read" ,
1999+ warning (_ ( "object %s cannot be read" ) ,
19992000 oid_to_hex (& src_entry -> idx .oid ));
20002001 /*
20012002 * Those objects are not included in the
@@ -2005,11 +2006,11 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
20052006 */
20062007 return 0 ;
20072008 }
2008- die ("object %s cannot be read" ,
2009+ die (_ ( "object %s cannot be read" ) ,
20092010 oid_to_hex (& src_entry -> idx .oid ));
20102011 }
20112012 if (sz != src_size )
2012- die ("object %s inconsistent object length (%lu vs %lu)" ,
2013+ die (_ ( "object %s inconsistent object length (%lu vs %lu)" ) ,
20132014 oid_to_hex (& src_entry -> idx .oid ), sz ,
20142015 src_size );
20152016 * mem_usage += sz ;
@@ -2019,7 +2020,7 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
20192020 if (!src -> index ) {
20202021 static int warned = 0 ;
20212022 if (!warned ++ )
2022- warning ("suboptimal pack - out of memory" );
2023+ warning (_ ( "suboptimal pack - out of memory" ) );
20232024 return 0 ;
20242025 }
20252026 * mem_usage += sizeof_delta_index (src -> index );
@@ -2346,7 +2347,7 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
23462347 return ;
23472348 }
23482349 if (progress > pack_to_stdout )
2349- fprintf_ln (stderr , "Delta compression using up to %d threads" ,
2350+ fprintf_ln (stderr , _ ( "Delta compression using up to %d threads" ) ,
23502351 delta_search_threads );
23512352 p = xcalloc (delta_search_threads , sizeof (* p ));
23522353
@@ -2387,7 +2388,7 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
23872388 ret = pthread_create (& p [i ].thread , NULL ,
23882389 threaded_find_deltas , & p [i ]);
23892390 if (ret )
2390- die ("unable to create thread: %s" , strerror (ret ));
2391+ die (_ ( "unable to create thread: %s" ) , strerror (ret ));
23912392 active_threads ++ ;
23922393 }
23932394
@@ -2482,7 +2483,7 @@ static void add_tag_chain(const struct object_id *oid)
24822483 tag = lookup_tag (oid );
24832484 while (1 ) {
24842485 if (!tag || parse_tag (tag ) || !tag -> tagged )
2485- die ("unable to pack objects reachable from tag %s" ,
2486+ die (_ ( "unable to pack objects reachable from tag %s" ) ,
24862487 oid_to_hex (oid ));
24872488
24882489 add_object_entry (& tag -> object .oid , OBJ_TAG , NULL , 0 );
@@ -2548,7 +2549,7 @@ static void prepare_pack(int window, int depth)
25482549 if (!entry -> preferred_base ) {
25492550 nr_deltas ++ ;
25502551 if (oe_type (entry ) < 0 )
2551- die ("unable to get type of object %s" ,
2552+ die (_ ( "unable to get type of object %s" ) ,
25522553 oid_to_hex (& entry -> idx .oid ));
25532554 } else {
25542555 if (oe_type (entry ) < 0 ) {
@@ -2572,7 +2573,7 @@ static void prepare_pack(int window, int depth)
25722573 ll_find_deltas (delta_list , n , window + 1 , depth , & nr_done );
25732574 stop_progress (& progress_state );
25742575 if (nr_done != nr_deltas )
2575- die ("inconsistency with delta count" );
2576+ die (_ ( "inconsistency with delta count" ) );
25762577 }
25772578 free (delta_list );
25782579}
@@ -2612,11 +2613,11 @@ static int git_pack_config(const char *k, const char *v, void *cb)
26122613 if (!strcmp (k , "pack.threads" )) {
26132614 delta_search_threads = git_config_int (k , v );
26142615 if (delta_search_threads < 0 )
2615- die ("invalid number of threads specified (%d)" ,
2616+ die (_ ( "invalid number of threads specified (%d)" ) ,
26162617 delta_search_threads );
26172618#ifdef NO_PTHREADS
26182619 if (delta_search_threads != 1 ) {
2619- warning ("no threads support, ignoring %s" , k );
2620+ warning (_ ( "no threads support, ignoring %s" ) , k );
26202621 delta_search_threads = 0 ;
26212622 }
26222623#endif
@@ -2625,7 +2626,7 @@ static int git_pack_config(const char *k, const char *v, void *cb)
26252626 if (!strcmp (k , "pack.indexversion" )) {
26262627 pack_idx_opts .version = git_config_int (k , v );
26272628 if (pack_idx_opts .version > 2 )
2628- die ("bad pack.indexversion=%" PRIu32 ,
2629+ die (_ ( "bad pack.indexversion=%" PRIu32 ) ,
26292630 pack_idx_opts .version );
26302631 return 0 ;
26312632 }
@@ -2651,13 +2652,13 @@ static void read_object_list_from_stdin(void)
26512652 }
26522653 if (line [0 ] == '-' ) {
26532654 if (get_oid_hex (line + 1 , & oid ))
2654- die ("expected edge object ID, got garbage:\n %s" ,
2655+ die (_ ( "expected edge object ID, got garbage:\n %s" ) ,
26552656 line );
26562657 add_preferred_base (& oid );
26572658 continue ;
26582659 }
26592660 if (parse_oid_hex (line , & oid , & p ))
2660- die ("expected object ID, got garbage:\n %s" , line );
2661+ die (_ ( "expected object ID, got garbage:\n %s" ) , line );
26612662
26622663 add_preferred_base_object (p + 1 );
26632664 add_object_entry (& oid , OBJ_NONE , p + 1 , 0 );
@@ -2796,7 +2797,7 @@ static void add_objects_in_unpacked_packs(struct rev_info *revs)
27962797 if (!p -> pack_local || p -> pack_keep || p -> pack_keep_in_core )
27972798 continue ;
27982799 if (open_pack_index (p ))
2799- die ("cannot open pack index" );
2800+ die (_ ( "cannot open pack index" ) );
28002801
28012802 ALLOC_GROW (in_pack .array ,
28022803 in_pack .nr + p -> num_objects ,
@@ -2827,7 +2828,7 @@ static int add_loose_object(const struct object_id *oid, const char *path,
28272828 enum object_type type = oid_object_info (the_repository , oid , NULL );
28282829
28292830 if (type < 0 ) {
2830- warning ("loose object at %s could not be examined" , path );
2831+ warning (_ ( "loose object at %s could not be examined" ) , path );
28312832 return 0 ;
28322833 }
28332834
@@ -2904,15 +2905,15 @@ static void loosen_unused_packed_objects(struct rev_info *revs)
29042905 continue ;
29052906
29062907 if (open_pack_index (p ))
2907- die ("cannot open pack index" );
2908+ die (_ ( "cannot open pack index" ) );
29082909
29092910 for (i = 0 ; i < p -> num_objects ; i ++ ) {
29102911 nth_packed_object_oid (& oid , p , i );
29112912 if (!packlist_find (& to_pack , oid .hash , NULL ) &&
29122913 !has_sha1_pack_kept_or_nonlocal (& oid ) &&
29132914 !loosened_object_can_be_discarded (& oid , p -> mtime ))
29142915 if (force_object_loose (& oid , p -> mtime ))
2915- die ("unable to force loose object" );
2916+ die (_ ( "unable to force loose object" ) );
29162917 }
29172918 }
29182919}
@@ -2996,17 +2997,17 @@ static void get_object_list(int ac, const char **av)
29962997 use_bitmap_index = 0 ;
29972998 continue ;
29982999 }
2999- die ("not a rev '%s'" , line );
3000+ die (_ ( "not a rev '%s'" ) , line );
30003001 }
30013002 if (handle_revision_arg (line , & revs , flags , REVARG_CANNOT_BE_FILENAME ))
3002- die ("bad revision '%s'" , line );
3003+ die (_ ( "bad revision '%s'" ) , line );
30033004 }
30043005
30053006 if (use_bitmap_index && !get_object_list_from_bitmap (& revs ))
30063007 return ;
30073008
30083009 if (prepare_revision_walk (& revs ))
3009- die ("revision walk setup failed" );
3010+ die (_ ( "revision walk setup failed" ) );
30103011 mark_edges_uninteresting (& revs , show_edge );
30113012
30123013 if (!fn_show_object )
@@ -3019,9 +3020,9 @@ static void get_object_list(int ac, const char **av)
30193020 revs .ignore_missing_links = 1 ;
30203021 if (add_unseen_recent_objects_to_traversal (& revs ,
30213022 unpack_unreachable_expiration ))
3022- die ("unable to add recent objects" );
3023+ die (_ ( "unable to add recent objects" ) );
30233024 if (prepare_revision_walk (& revs ))
3024- die ("revision walk setup failed" );
3025+ die (_ ( "revision walk setup failed" ) );
30253026 traverse_commit_list (& revs , record_recent_commit ,
30263027 record_recent_object , NULL );
30273028 }
@@ -3256,35 +3257,35 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
32563257 if (pack_compression_level == -1 )
32573258 pack_compression_level = Z_DEFAULT_COMPRESSION ;
32583259 else if (pack_compression_level < 0 || pack_compression_level > Z_BEST_COMPRESSION )
3259- die ("bad pack compression level %d" , pack_compression_level );
3260+ die (_ ( "bad pack compression level %d" ) , pack_compression_level );
32603261
32613262 if (!delta_search_threads ) /* --threads=0 means autodetect */
32623263 delta_search_threads = online_cpus ();
32633264
32643265#ifdef NO_PTHREADS
32653266 if (delta_search_threads != 1 )
3266- warning ("no threads support, ignoring --threads" );
3267+ warning (_ ( "no threads support, ignoring --threads" ) );
32673268#endif
32683269 if (!pack_to_stdout && !pack_size_limit )
32693270 pack_size_limit = pack_size_limit_cfg ;
32703271 if (pack_to_stdout && pack_size_limit )
3271- die ("--max-pack-size cannot be used to build a pack for transfer" );
3272+ die (_ ( "--max-pack-size cannot be used to build a pack for transfer" ) );
32723273 if (pack_size_limit && pack_size_limit < 1024 * 1024 ) {
3273- warning ("minimum pack size limit is 1 MiB" );
3274+ warning (_ ( "minimum pack size limit is 1 MiB" ) );
32743275 pack_size_limit = 1024 * 1024 ;
32753276 }
32763277
32773278 if (!pack_to_stdout && thin )
3278- die ("--thin cannot be used to build an indexable pack." );
3279+ die (_ ( "--thin cannot be used to build an indexable pack" ) );
32793280
32803281 if (keep_unreachable && unpack_unreachable )
3281- die ("--keep-unreachable and --unpack-unreachable are incompatible" );
3282+ die (_ ( "--keep-unreachable and --unpack-unreachable are incompatible" ) );
32823283 if (!rev_list_all || !rev_list_reflog || !rev_list_index )
32833284 unpack_unreachable_expiration = 0 ;
32843285
32853286 if (filter_options .choice ) {
32863287 if (!pack_to_stdout )
3287- die ("cannot use --filter without --stdout" );
3288+ die (_ ( "cannot use --filter without --stdout" ) );
32883289 use_bitmap_index = 0 ;
32893290 }
32903291
@@ -3358,8 +3359,9 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
33583359 prepare_pack (window , depth );
33593360 write_pack_file ();
33603361 if (progress )
3361- fprintf_ln (stderr , "Total %" PRIu32 " (delta %" PRIu32 "),"
3362- " reused %" PRIu32 " (delta %" PRIu32 ")" ,
3362+ fprintf_ln (stderr ,
3363+ _ ("Total %" PRIu32 " (delta %" PRIu32 "),"
3364+ " reused %" PRIu32 " (delta %" PRIu32 ")" ),
33633365 written , written_delta , reused , reused_delta );
33643366 return 0 ;
33653367}
0 commit comments