@@ -48,7 +48,7 @@ static void sendline(struct helper_data *helper, struct strbuf *buffer)
48
48
if (debug )
49
49
fprintf (stderr , "Debug: Remote helper: -> %s" , buffer -> buf );
50
50
if (write_in_full (helper -> helper -> in , buffer -> buf , buffer -> len ) < 0 )
51
- die_errno ("full write to remote helper failed" );
51
+ die_errno (_ ( "full write to remote helper failed" ) );
52
52
}
53
53
54
54
static int recvline_fh (FILE * helper , struct strbuf * buffer )
@@ -77,7 +77,7 @@ static void write_constant(int fd, const char *str)
77
77
if (debug )
78
78
fprintf (stderr , "Debug: Remote helper: -> %s" , str );
79
79
if (write_in_full (fd , str , strlen (str )) < 0 )
80
- die_errno ("full write to remote helper failed" );
80
+ die_errno (_ ( "full write to remote helper failed" ) );
81
81
}
82
82
83
83
static const char * remove_ext_force (const char * url )
@@ -129,7 +129,7 @@ static struct child_process *get_helper(struct transport *transport)
129
129
130
130
code = start_command (helper );
131
131
if (code < 0 && errno == ENOENT )
132
- die ("unable to find remote helper for '%s'" , data -> name );
132
+ die (_ ( "unable to find remote helper for '%s'" ) , data -> name );
133
133
else if (code != 0 )
134
134
exit (code );
135
135
@@ -145,7 +145,7 @@ static struct child_process *get_helper(struct transport *transport)
145
145
*/
146
146
duped = dup (helper -> out );
147
147
if (duped < 0 )
148
- die_errno ("can't dup helper output fd" );
148
+ die_errno (_ ( "can't dup helper output fd" ) );
149
149
data -> out = xfdopen (duped , "r" );
150
150
151
151
write_constant (helper -> in , "capabilities\n" );
@@ -196,13 +196,13 @@ static struct child_process *get_helper(struct transport *transport)
196
196
} else if (starts_with (capname , "no-private-update" )) {
197
197
data -> no_private_update = 1 ;
198
198
} else if (mandatory ) {
199
- die ("unknown mandatory capability %s; this remote "
200
- "helper probably needs newer version of Git" ,
199
+ die (_ ( "unknown mandatory capability %s; this remote "
200
+ "helper probably needs newer version of Git" ) ,
201
201
capname );
202
202
}
203
203
}
204
204
if (!data -> rs .nr && (data -> import || data -> bidi_import || data -> export )) {
205
- warning ("this remote helper should implement refspec capability" );
205
+ warning (_ ( "this remote helper should implement refspec capability" ) );
206
206
}
207
207
strbuf_release (& buf );
208
208
if (debug )
@@ -269,7 +269,7 @@ static int strbuf_set_helper_option(struct helper_data *data,
269
269
else if (!strcmp (buf -> buf , "unsupported" ))
270
270
ret = 1 ;
271
271
else {
272
- warning ("%s unexpectedly said: '%s'" , data -> name , buf -> buf );
272
+ warning (_ ( "%s unexpectedly said: '%s'" ) , data -> name , buf -> buf );
273
273
ret = 1 ;
274
274
}
275
275
return ret ;
@@ -398,7 +398,7 @@ static int fetch_with_fetch(struct transport *transport,
398
398
if (starts_with (buf .buf , "lock " )) {
399
399
const char * name = buf .buf + 5 ;
400
400
if (transport -> pack_lockfile )
401
- warning ("%s also locked %s" , data -> name , name );
401
+ warning (_ ( "%s also locked %s" ) , data -> name , name );
402
402
else
403
403
transport -> pack_lockfile = xstrdup (name );
404
404
}
@@ -409,7 +409,7 @@ static int fetch_with_fetch(struct transport *transport,
409
409
else if (!buf .len )
410
410
break ;
411
411
else
412
- warning ("%s unexpectedly said: '%s'" , data -> name , buf .buf );
412
+ warning (_ ( "%s unexpectedly said: '%s'" ) , data -> name , buf .buf );
413
413
}
414
414
strbuf_release (& buf );
415
415
return 0 ;
@@ -476,7 +476,7 @@ static int fetch_with_import(struct transport *transport,
476
476
get_helper (transport );
477
477
478
478
if (get_importer (transport , & fastimport ))
479
- die ("couldn't run fast-import" );
479
+ die (_ ( "couldn't run fast-import" ) );
480
480
481
481
for (i = 0 ; i < nr_heads ; i ++ ) {
482
482
posn = to_fetch [i ];
@@ -499,7 +499,7 @@ static int fetch_with_import(struct transport *transport,
499
499
*/
500
500
501
501
if (finish_command (& fastimport ))
502
- die ("error while running fast-import" );
502
+ die (_ ( "error while running fast-import" ) );
503
503
504
504
/*
505
505
* The fast-import stream of a remote helper that advertises
@@ -528,7 +528,7 @@ static int fetch_with_import(struct transport *transport,
528
528
private = xstrdup (name );
529
529
if (private ) {
530
530
if (read_ref (private , & posn -> old_oid ) < 0 )
531
- die ("could not read ref %s" , private );
531
+ die (_ ( "could not read ref %s" ) , private );
532
532
free (private );
533
533
}
534
534
}
@@ -554,7 +554,7 @@ static int run_connect(struct transport *transport, struct strbuf *cmdbuf)
554
554
*/
555
555
duped = dup (helper -> out );
556
556
if (duped < 0 )
557
- die_errno ("can't dup helper output fd" );
557
+ die_errno (_ ( "can't dup helper output fd" ) );
558
558
input = xfdopen (duped , "r" );
559
559
setvbuf (input , NULL , _IONBF , 0 );
560
560
@@ -573,8 +573,8 @@ static int run_connect(struct transport *transport, struct strbuf *cmdbuf)
573
573
fprintf (stderr , "Debug: Falling back to dumb "
574
574
"transport.\n" );
575
575
} else {
576
- die ("unknown response to connect: %s" ,
577
- cmdbuf -> buf );
576
+ die (_ ( _ ( "unknown response to connect: %s" )) ,
577
+ cmdbuf -> buf );
578
578
}
579
579
580
580
fclose (input );
@@ -595,9 +595,9 @@ static int process_connect_service(struct transport *transport,
595
595
if (strcmp (name , exec )) {
596
596
int r = set_helper_option (transport , "servpath" , exec );
597
597
if (r > 0 )
598
- warning ("setting remote service path not supported by protocol" );
598
+ warning (_ ( "setting remote service path not supported by protocol" ) );
599
599
else if (r < 0 )
600
- warning ("invalid remote service path" );
600
+ warning (_ ( "invalid remote service path" ) );
601
601
}
602
602
603
603
if (data -> connect ) {
@@ -640,10 +640,10 @@ static int connect_helper(struct transport *transport, const char *name,
640
640
/* Get_helper so connect is inited. */
641
641
get_helper (transport );
642
642
if (!data -> connect )
643
- die ("operation not supported by protocol" );
643
+ die (_ ( "operation not supported by protocol" ) );
644
644
645
645
if (!process_connect_service (transport , name , exec ))
646
- die ("can't connect to subservice %s" , name );
646
+ die (_ ( "can't connect to subservice %s" ) , name );
647
647
648
648
fd [0 ] = data -> helper -> out ;
649
649
fd [1 ] = data -> helper -> in ;
@@ -707,7 +707,7 @@ static int push_update_ref_status(struct strbuf *buf,
707
707
status = REF_STATUS_REMOTE_REJECT ;
708
708
refname = buf -> buf + 6 ;
709
709
} else
710
- die ("expected ok/error, helper said '%s'" , buf -> buf );
710
+ die (_ ( "expected ok/error, helper said '%s'" ) , buf -> buf );
711
711
712
712
msg = strchr (refname , ' ' );
713
713
if (msg ) {
@@ -760,7 +760,7 @@ static int push_update_ref_status(struct strbuf *buf,
760
760
if (!* ref )
761
761
* ref = find_ref_by_name (remote_refs , refname );
762
762
if (!* ref ) {
763
- warning ("helper reported unexpected status of %s" , refname );
763
+ warning (_ ( "helper reported unexpected status of %s" ) , refname );
764
764
return 1 ;
765
765
}
766
766
@@ -821,20 +821,20 @@ static void set_common_push_options(struct transport *transport,
821
821
{
822
822
if (flags & TRANSPORT_PUSH_DRY_RUN ) {
823
823
if (set_helper_option (transport , "dry-run" , "true" ) != 0 )
824
- die ("helper %s does not support dry-run" , name );
824
+ die (_ ( "helper %s does not support dry-run" ) , name );
825
825
} else if (flags & TRANSPORT_PUSH_CERT_ALWAYS ) {
826
826
if (set_helper_option (transport , TRANS_OPT_PUSH_CERT , "true" ) != 0 )
827
- die ("helper %s does not support --signed" , name );
827
+ die (_ ( "helper %s does not support --signed" ) , name );
828
828
} else if (flags & TRANSPORT_PUSH_CERT_IF_ASKED ) {
829
829
if (set_helper_option (transport , TRANS_OPT_PUSH_CERT , "if-asked" ) != 0 )
830
- die ("helper %s does not support --signed=if-asked" , name );
830
+ die (_ ( "helper %s does not support --signed=if-asked" ) , name );
831
831
}
832
832
833
833
if (flags & TRANSPORT_PUSH_OPTIONS ) {
834
834
struct string_list_item * item ;
835
835
for_each_string_list_item (item , transport -> push_options )
836
836
if (set_helper_option (transport , "push-option" , item -> string ) != 0 )
837
- die ("helper %s does not support 'push-option'" , name );
837
+ die (_ ( "helper %s does not support 'push-option'" ) , name );
838
838
}
839
839
}
840
840
@@ -926,12 +926,12 @@ static int push_refs_with_export(struct transport *transport,
926
926
struct strbuf buf = STRBUF_INIT ;
927
927
928
928
if (!data -> rs .nr )
929
- die ("remote-helper doesn't support push; refspec needed" );
929
+ die (_ ( "remote-helper doesn't support push; refspec needed" ) );
930
930
931
931
set_common_push_options (transport , data -> name , flags );
932
932
if (flags & TRANSPORT_PUSH_FORCE ) {
933
933
if (set_helper_option (transport , "force" , "true" ) != 0 )
934
- warning ("helper %s does not support 'force'" , data -> name );
934
+ warning (_ ( "helper %s does not support 'force'" ) , data -> name );
935
935
}
936
936
937
937
helper = get_helper (transport );
@@ -978,12 +978,12 @@ static int push_refs_with_export(struct transport *transport,
978
978
}
979
979
980
980
if (get_exporter (transport , & exporter , & revlist_args ))
981
- die ("couldn't run fast-export" );
981
+ die (_ ( "couldn't run fast-export" ) );
982
982
983
983
string_list_clear (& revlist_args , 1 );
984
984
985
985
if (finish_command (& exporter ))
986
- die ("error while running fast-export" );
986
+ die (_ ( "error while running fast-export" ) );
987
987
if (push_update_refs_status (data , remote_refs , flags ))
988
988
return 1 ;
989
989
@@ -1007,8 +1007,9 @@ static int push_refs(struct transport *transport,
1007
1007
}
1008
1008
1009
1009
if (!remote_refs ) {
1010
- fprintf (stderr , "No refs in common and none specified; doing nothing.\n"
1011
- "Perhaps you should specify a branch such as 'master'.\n" );
1010
+ fprintf (stderr ,
1011
+ _ ("No refs in common and none specified; doing nothing.\n"
1012
+ "Perhaps you should specify a branch such as 'master'.\n" ));
1012
1013
return 0 ;
1013
1014
}
1014
1015
@@ -1070,7 +1071,7 @@ static struct ref *get_refs_list(struct transport *transport, int for_push,
1070
1071
1071
1072
eov = strchr (buf .buf , ' ' );
1072
1073
if (!eov )
1073
- die ("malformed response in ref list: %s" , buf .buf );
1074
+ die (_ ( "malformed response in ref list: %s" ) , buf .buf );
1074
1075
eon = strchr (eov + 1 , ' ' );
1075
1076
* eov = '\0' ;
1076
1077
if (eon )
@@ -1223,7 +1224,7 @@ static int udt_do_read(struct unidirectional_transfer *t)
1223
1224
bytes = read (t -> src , t -> buf + t -> bufuse , BUFFERSIZE - t -> bufuse );
1224
1225
if (bytes < 0 && errno != EWOULDBLOCK && errno != EAGAIN &&
1225
1226
errno != EINTR ) {
1226
- error_errno ("read(%s) failed" , t -> src_name );
1227
+ error_errno (_ ( "read(%s) failed" ) , t -> src_name );
1227
1228
return -1 ;
1228
1229
} else if (bytes == 0 ) {
1229
1230
transfer_debug ("%s EOF (with %i bytes in buffer)" ,
@@ -1250,7 +1251,7 @@ static int udt_do_write(struct unidirectional_transfer *t)
1250
1251
transfer_debug ("%s is writable" , t -> dest_name );
1251
1252
bytes = xwrite (t -> dest , t -> buf , t -> bufuse );
1252
1253
if (bytes < 0 && errno != EWOULDBLOCK ) {
1253
- error_errno ("write(%s) failed" , t -> dest_name );
1254
+ error_errno (_ ( "write(%s) failed" ) , t -> dest_name );
1254
1255
return -1 ;
1255
1256
} else if (bytes > 0 ) {
1256
1257
t -> bufuse -= bytes ;
@@ -1299,11 +1300,11 @@ static int tloop_join(pthread_t thread, const char *name)
1299
1300
void * tret ;
1300
1301
err = pthread_join (thread , & tret );
1301
1302
if (!tret ) {
1302
- error ("%s thread failed" , name );
1303
+ error (_ ( "%s thread failed" ) , name );
1303
1304
return 1 ;
1304
1305
}
1305
1306
if (err ) {
1306
- error ("%s thread failed to join: %s" , name , strerror (err ));
1307
+ error (_ ( "%s thread failed to join: %s" ) , name , strerror (err ));
1307
1308
return 1 ;
1308
1309
}
1309
1310
return 0 ;
@@ -1322,11 +1323,11 @@ static int tloop_spawnwait_tasks(struct bidirectional_transfer_state *s)
1322
1323
err = pthread_create (& gtp_thread , NULL , udt_copy_task_routine ,
1323
1324
& s -> gtp );
1324
1325
if (err )
1325
- die ("can't start thread for copying data: %s" , strerror (err ));
1326
+ die (_ ( "can't start thread for copying data: %s" ) , strerror (err ));
1326
1327
err = pthread_create (& ptg_thread , NULL , udt_copy_task_routine ,
1327
1328
& s -> ptg );
1328
1329
if (err )
1329
- die ("can't start thread for copying data: %s" , strerror (err ));
1330
+ die (_ ( "can't start thread for copying data: %s" ) , strerror (err ));
1330
1331
1331
1332
ret |= tloop_join (gtp_thread , "Git to program copy" );
1332
1333
ret |= tloop_join (ptg_thread , "Program to git copy" );
@@ -1363,11 +1364,11 @@ static int tloop_join(pid_t pid, const char *name)
1363
1364
{
1364
1365
int tret ;
1365
1366
if (waitpid (pid , & tret , 0 ) < 0 ) {
1366
- error_errno ("%s process failed to wait" , name );
1367
+ error_errno (_ ( "%s process failed to wait" ) , name );
1367
1368
return 1 ;
1368
1369
}
1369
1370
if (!WIFEXITED (tret ) || WEXITSTATUS (tret )) {
1370
- error ("%s process failed" , name );
1371
+ error (_ ( "%s process failed" ) , name );
1371
1372
return 1 ;
1372
1373
}
1373
1374
return 0 ;
@@ -1385,7 +1386,7 @@ static int tloop_spawnwait_tasks(struct bidirectional_transfer_state *s)
1385
1386
/* Fork thread #1: git to program. */
1386
1387
pid1 = fork ();
1387
1388
if (pid1 < 0 )
1388
- die_errno ("can't start thread for copying data" );
1389
+ die_errno (_ ( "can't start thread for copying data" ) );
1389
1390
else if (pid1 == 0 ) {
1390
1391
udt_kill_transfer (& s -> ptg );
1391
1392
exit (udt_copy_task_routine (& s -> gtp ) ? 0 : 1 );
@@ -1394,7 +1395,7 @@ static int tloop_spawnwait_tasks(struct bidirectional_transfer_state *s)
1394
1395
/* Fork thread #2: program to git. */
1395
1396
pid2 = fork ();
1396
1397
if (pid2 < 0 )
1397
- die_errno ("can't start thread for copying data" );
1398
+ die_errno (_ ( "can't start thread for copying data" ) );
1398
1399
else if (pid2 == 0 ) {
1399
1400
udt_kill_transfer (& s -> gtp );
1400
1401
exit (udt_copy_task_routine (& s -> ptg ) ? 0 : 1 );
0 commit comments