@@ -140,7 +140,7 @@ static void *get_delta(struct object_entry *entry)
140
140
141
141
buf = read_object_file (& entry -> idx .oid , & type , & size );
142
142
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 ));
144
144
base_buf = read_object_file (& DELTA (entry )-> idx .oid , & type ,
145
145
& base_size );
146
146
if (!base_buf )
@@ -411,7 +411,7 @@ static off_t write_reuse_object(struct hashfile *f, struct object_entry *entry,
411
411
datalen = revidx [1 ].offset - offset ;
412
412
if (!pack_to_stdout && p -> index_version > 1 &&
413
413
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" ) ,
415
415
oid_to_hex (& entry -> idx .oid ));
416
416
unuse_pack (& w_curs );
417
417
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,
422
422
423
423
if (!pack_to_stdout && p -> index_version == 1 &&
424
424
check_pack_inflate (p , & w_curs , offset , datalen , entry_size )) {
425
- error ("corrupt packed object for %s" ,
425
+ error (_ ( "corrupt packed object for %s" ) ,
426
426
oid_to_hex (& entry -> idx .oid ));
427
427
unuse_pack (& w_curs );
428
428
return write_no_reuse_object (f , entry , limit , usable_delta );
@@ -553,7 +553,7 @@ static enum write_one_status write_one(struct hashfile *f,
553
553
*/
554
554
recursing = (e -> idx .offset == 1 );
555
555
if (recursing ) {
556
- warning ("recursive delta detected for object %s" ,
556
+ warning (_ ( "recursive delta detected for object %s" ) ,
557
557
oid_to_hex (& e -> idx .oid ));
558
558
return WRITE_ONE_RECURSIVE ;
559
559
} else if (e -> idx .offset || e -> preferred_base ) {
@@ -587,7 +587,7 @@ static enum write_one_status write_one(struct hashfile *f,
587
587
588
588
/* make sure off_t is sufficiently large not to wrap */
589
589
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" ) );
591
591
* offset += size ;
592
592
return WRITE_ONE_WRITTEN ;
593
593
}
@@ -753,7 +753,8 @@ static struct object_entry **compute_write_order(void)
753
753
}
754
754
755
755
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 );
757
758
758
759
return wo ;
759
760
}
@@ -765,15 +766,15 @@ static off_t write_reused_pack(struct hashfile *f)
765
766
int fd ;
766
767
767
768
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 );
769
770
770
771
fd = git_open (reuse_packfile -> pack_name );
771
772
if (fd < 0 )
772
- die_errno ("unable to open packfile for reuse: %s" ,
773
+ die_errno (_ ( "unable to open packfile for reuse: %s" ) ,
773
774
reuse_packfile -> pack_name );
774
775
775
776
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" ) );
777
778
778
779
if (reuse_packfile_offset < 0 )
779
780
reuse_packfile_offset = reuse_packfile -> pack_size - the_hash_algo -> rawsz ;
@@ -784,7 +785,7 @@ static off_t write_reused_pack(struct hashfile *f)
784
785
int read_pack = xread (fd , buffer , sizeof (buffer ));
785
786
786
787
if (read_pack <= 0 )
787
- die_errno ("unable to read from reused packfile" );
788
+ die_errno (_ ( "unable to read from reused packfile" ) );
788
789
789
790
if (read_pack > to_write )
790
791
read_pack = to_write ;
@@ -887,15 +888,15 @@ static void write_pack_file(void)
887
888
* to preserve this property.
888
889
*/
889
890
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 );
891
892
} else if (!last_mtime ) {
892
893
last_mtime = st .st_mtime ;
893
894
} else {
894
895
struct utimbuf utb ;
895
896
utb .actime = st .st_atime ;
896
897
utb .modtime = -- last_mtime ;
897
898
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 );
899
900
}
900
901
901
902
strbuf_addf (& tmpname , "%s-" , base_name );
@@ -940,8 +941,8 @@ static void write_pack_file(void)
940
941
free (write_order );
941
942
stop_progress (& progress_state );
942
943
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 );
945
946
}
946
947
947
948
static int no_try_delta (const char * path )
@@ -1485,7 +1486,7 @@ static void check_object(struct object_entry *entry)
1485
1486
while (c & 128 ) {
1486
1487
ofs += 1 ;
1487
1488
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" ) ,
1489
1490
oid_to_hex (& entry -> idx .oid ));
1490
1491
goto give_up ;
1491
1492
}
@@ -1494,7 +1495,7 @@ static void check_object(struct object_entry *entry)
1494
1495
}
1495
1496
ofs = entry -> in_pack_offset - ofs ;
1496
1497
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" ) ,
1498
1499
oid_to_hex (& entry -> idx .oid ));
1499
1500
goto give_up ;
1500
1501
}
@@ -1979,10 +1980,10 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
1979
1980
trg -> data = read_object_file (& trg_entry -> idx .oid , & type , & sz );
1980
1981
read_unlock ();
1981
1982
if (!trg -> data )
1982
- die ("object %s cannot be read" ,
1983
+ die (_ ( "object %s cannot be read" ) ,
1983
1984
oid_to_hex (& trg_entry -> idx .oid ));
1984
1985
if (sz != trg_size )
1985
- die ("object %s inconsistent object length (%lu vs %lu)" ,
1986
+ die (_ ( "object %s inconsistent object length (%lu vs %lu)" ) ,
1986
1987
oid_to_hex (& trg_entry -> idx .oid ), sz ,
1987
1988
trg_size );
1988
1989
* mem_usage += sz ;
@@ -1995,7 +1996,7 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
1995
1996
if (src_entry -> preferred_base ) {
1996
1997
static int warned = 0 ;
1997
1998
if (!warned ++ )
1998
- warning ("object %s cannot be read" ,
1999
+ warning (_ ( "object %s cannot be read" ) ,
1999
2000
oid_to_hex (& src_entry -> idx .oid ));
2000
2001
/*
2001
2002
* Those objects are not included in the
@@ -2005,11 +2006,11 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
2005
2006
*/
2006
2007
return 0 ;
2007
2008
}
2008
- die ("object %s cannot be read" ,
2009
+ die (_ ( "object %s cannot be read" ) ,
2009
2010
oid_to_hex (& src_entry -> idx .oid ));
2010
2011
}
2011
2012
if (sz != src_size )
2012
- die ("object %s inconsistent object length (%lu vs %lu)" ,
2013
+ die (_ ( "object %s inconsistent object length (%lu vs %lu)" ) ,
2013
2014
oid_to_hex (& src_entry -> idx .oid ), sz ,
2014
2015
src_size );
2015
2016
* mem_usage += sz ;
@@ -2019,7 +2020,7 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
2019
2020
if (!src -> index ) {
2020
2021
static int warned = 0 ;
2021
2022
if (!warned ++ )
2022
- warning ("suboptimal pack - out of memory" );
2023
+ warning (_ ( "suboptimal pack - out of memory" ) );
2023
2024
return 0 ;
2024
2025
}
2025
2026
* mem_usage += sizeof_delta_index (src -> index );
@@ -2346,7 +2347,7 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
2346
2347
return ;
2347
2348
}
2348
2349
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" ) ,
2350
2351
delta_search_threads );
2351
2352
p = xcalloc (delta_search_threads , sizeof (* p ));
2352
2353
@@ -2387,7 +2388,7 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
2387
2388
ret = pthread_create (& p [i ].thread , NULL ,
2388
2389
threaded_find_deltas , & p [i ]);
2389
2390
if (ret )
2390
- die ("unable to create thread: %s" , strerror (ret ));
2391
+ die (_ ( "unable to create thread: %s" ) , strerror (ret ));
2391
2392
active_threads ++ ;
2392
2393
}
2393
2394
@@ -2482,7 +2483,7 @@ static void add_tag_chain(const struct object_id *oid)
2482
2483
tag = lookup_tag (oid );
2483
2484
while (1 ) {
2484
2485
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" ) ,
2486
2487
oid_to_hex (oid ));
2487
2488
2488
2489
add_object_entry (& tag -> object .oid , OBJ_TAG , NULL , 0 );
@@ -2548,7 +2549,7 @@ static void prepare_pack(int window, int depth)
2548
2549
if (!entry -> preferred_base ) {
2549
2550
nr_deltas ++ ;
2550
2551
if (oe_type (entry ) < 0 )
2551
- die ("unable to get type of object %s" ,
2552
+ die (_ ( "unable to get type of object %s" ) ,
2552
2553
oid_to_hex (& entry -> idx .oid ));
2553
2554
} else {
2554
2555
if (oe_type (entry ) < 0 ) {
@@ -2572,7 +2573,7 @@ static void prepare_pack(int window, int depth)
2572
2573
ll_find_deltas (delta_list , n , window + 1 , depth , & nr_done );
2573
2574
stop_progress (& progress_state );
2574
2575
if (nr_done != nr_deltas )
2575
- die ("inconsistency with delta count" );
2576
+ die (_ ( "inconsistency with delta count" ) );
2576
2577
}
2577
2578
free (delta_list );
2578
2579
}
@@ -2612,11 +2613,11 @@ static int git_pack_config(const char *k, const char *v, void *cb)
2612
2613
if (!strcmp (k , "pack.threads" )) {
2613
2614
delta_search_threads = git_config_int (k , v );
2614
2615
if (delta_search_threads < 0 )
2615
- die ("invalid number of threads specified (%d)" ,
2616
+ die (_ ( "invalid number of threads specified (%d)" ) ,
2616
2617
delta_search_threads );
2617
2618
#ifdef NO_PTHREADS
2618
2619
if (delta_search_threads != 1 ) {
2619
- warning ("no threads support, ignoring %s" , k );
2620
+ warning (_ ( "no threads support, ignoring %s" ) , k );
2620
2621
delta_search_threads = 0 ;
2621
2622
}
2622
2623
#endif
@@ -2625,7 +2626,7 @@ static int git_pack_config(const char *k, const char *v, void *cb)
2625
2626
if (!strcmp (k , "pack.indexversion" )) {
2626
2627
pack_idx_opts .version = git_config_int (k , v );
2627
2628
if (pack_idx_opts .version > 2 )
2628
- die ("bad pack.indexversion=%" PRIu32 ,
2629
+ die (_ ( "bad pack.indexversion=%" PRIu32 ) ,
2629
2630
pack_idx_opts .version );
2630
2631
return 0 ;
2631
2632
}
@@ -2651,13 +2652,13 @@ static void read_object_list_from_stdin(void)
2651
2652
}
2652
2653
if (line [0 ] == '-' ) {
2653
2654
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" ) ,
2655
2656
line );
2656
2657
add_preferred_base (& oid );
2657
2658
continue ;
2658
2659
}
2659
2660
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 );
2661
2662
2662
2663
add_preferred_base_object (p + 1 );
2663
2664
add_object_entry (& oid , OBJ_NONE , p + 1 , 0 );
@@ -2796,7 +2797,7 @@ static void add_objects_in_unpacked_packs(struct rev_info *revs)
2796
2797
if (!p -> pack_local || p -> pack_keep || p -> pack_keep_in_core )
2797
2798
continue ;
2798
2799
if (open_pack_index (p ))
2799
- die ("cannot open pack index" );
2800
+ die (_ ( "cannot open pack index" ) );
2800
2801
2801
2802
ALLOC_GROW (in_pack .array ,
2802
2803
in_pack .nr + p -> num_objects ,
@@ -2827,7 +2828,7 @@ static int add_loose_object(const struct object_id *oid, const char *path,
2827
2828
enum object_type type = oid_object_info (the_repository , oid , NULL );
2828
2829
2829
2830
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 );
2831
2832
return 0 ;
2832
2833
}
2833
2834
@@ -2904,15 +2905,15 @@ static void loosen_unused_packed_objects(struct rev_info *revs)
2904
2905
continue ;
2905
2906
2906
2907
if (open_pack_index (p ))
2907
- die ("cannot open pack index" );
2908
+ die (_ ( "cannot open pack index" ) );
2908
2909
2909
2910
for (i = 0 ; i < p -> num_objects ; i ++ ) {
2910
2911
nth_packed_object_oid (& oid , p , i );
2911
2912
if (!packlist_find (& to_pack , oid .hash , NULL ) &&
2912
2913
!has_sha1_pack_kept_or_nonlocal (& oid ) &&
2913
2914
!loosened_object_can_be_discarded (& oid , p -> mtime ))
2914
2915
if (force_object_loose (& oid , p -> mtime ))
2915
- die ("unable to force loose object" );
2916
+ die (_ ( "unable to force loose object" ) );
2916
2917
}
2917
2918
}
2918
2919
}
@@ -2996,17 +2997,17 @@ static void get_object_list(int ac, const char **av)
2996
2997
use_bitmap_index = 0 ;
2997
2998
continue ;
2998
2999
}
2999
- die ("not a rev '%s'" , line );
3000
+ die (_ ( "not a rev '%s'" ) , line );
3000
3001
}
3001
3002
if (handle_revision_arg (line , & revs , flags , REVARG_CANNOT_BE_FILENAME ))
3002
- die ("bad revision '%s'" , line );
3003
+ die (_ ( "bad revision '%s'" ) , line );
3003
3004
}
3004
3005
3005
3006
if (use_bitmap_index && !get_object_list_from_bitmap (& revs ))
3006
3007
return ;
3007
3008
3008
3009
if (prepare_revision_walk (& revs ))
3009
- die ("revision walk setup failed" );
3010
+ die (_ ( "revision walk setup failed" ) );
3010
3011
mark_edges_uninteresting (& revs , show_edge );
3011
3012
3012
3013
if (!fn_show_object )
@@ -3019,9 +3020,9 @@ static void get_object_list(int ac, const char **av)
3019
3020
revs .ignore_missing_links = 1 ;
3020
3021
if (add_unseen_recent_objects_to_traversal (& revs ,
3021
3022
unpack_unreachable_expiration ))
3022
- die ("unable to add recent objects" );
3023
+ die (_ ( "unable to add recent objects" ) );
3023
3024
if (prepare_revision_walk (& revs ))
3024
- die ("revision walk setup failed" );
3025
+ die (_ ( "revision walk setup failed" ) );
3025
3026
traverse_commit_list (& revs , record_recent_commit ,
3026
3027
record_recent_object , NULL );
3027
3028
}
@@ -3256,35 +3257,35 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
3256
3257
if (pack_compression_level == -1 )
3257
3258
pack_compression_level = Z_DEFAULT_COMPRESSION ;
3258
3259
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 );
3260
3261
3261
3262
if (!delta_search_threads ) /* --threads=0 means autodetect */
3262
3263
delta_search_threads = online_cpus ();
3263
3264
3264
3265
#ifdef NO_PTHREADS
3265
3266
if (delta_search_threads != 1 )
3266
- warning ("no threads support, ignoring --threads" );
3267
+ warning (_ ( "no threads support, ignoring --threads" ) );
3267
3268
#endif
3268
3269
if (!pack_to_stdout && !pack_size_limit )
3269
3270
pack_size_limit = pack_size_limit_cfg ;
3270
3271
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" ) );
3272
3273
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" ) );
3274
3275
pack_size_limit = 1024 * 1024 ;
3275
3276
}
3276
3277
3277
3278
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" ) );
3279
3280
3280
3281
if (keep_unreachable && unpack_unreachable )
3281
- die ("--keep-unreachable and --unpack-unreachable are incompatible" );
3282
+ die (_ ( "--keep-unreachable and --unpack-unreachable are incompatible" ) );
3282
3283
if (!rev_list_all || !rev_list_reflog || !rev_list_index )
3283
3284
unpack_unreachable_expiration = 0 ;
3284
3285
3285
3286
if (filter_options .choice ) {
3286
3287
if (!pack_to_stdout )
3287
- die ("cannot use --filter without --stdout" );
3288
+ die (_ ( "cannot use --filter without --stdout" ) );
3288
3289
use_bitmap_index = 0 ;
3289
3290
}
3290
3291
@@ -3358,8 +3359,9 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
3358
3359
prepare_pack (window , depth );
3359
3360
write_pack_file ();
3360
3361
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 ")" ),
3363
3365
written , written_delta , reused , reused_delta );
3364
3366
return 0 ;
3365
3367
}
0 commit comments