@@ -110,7 +110,7 @@ static int option_parse_type(const struct option *opt, const char *arg,
110
110
* --int' and '--type=bool
111
111
* --type=int'.
112
112
*/
113
- error ("only one type at a time" );
113
+ error (_ ( "only one type at a time" ) );
114
114
usage_with_options (builtin_config_usage ,
115
115
builtin_config_options );
116
116
}
@@ -161,9 +161,9 @@ static void check_argc(int argc, int min, int max) {
161
161
if (argc >= min && argc <= max )
162
162
return ;
163
163
if (min == max )
164
- error ("wrong number of arguments, should be %d" , min );
164
+ error (_ ( "wrong number of arguments, should be %d" ) , min );
165
165
else
166
- error ("wrong number of arguments, should be from %d to %d" ,
166
+ error (_ ( "wrong number of arguments, should be from %d to %d" ) ,
167
167
min , max );
168
168
usage_with_options (builtin_config_usage , builtin_config_options );
169
169
}
@@ -297,7 +297,7 @@ static int get_value(const char *key_, const char *regex_)
297
297
298
298
key_regexp = (regex_t * )xmalloc (sizeof (regex_t ));
299
299
if (regcomp (key_regexp , key , REG_EXTENDED )) {
300
- error ("invalid key pattern: %s" , key_ );
300
+ error (_ ( "invalid key pattern: %s" ) , key_ );
301
301
FREE_AND_NULL (key_regexp );
302
302
ret = CONFIG_INVALID_PATTERN ;
303
303
goto free_strings ;
@@ -317,7 +317,7 @@ static int get_value(const char *key_, const char *regex_)
317
317
318
318
regexp = (regex_t * )xmalloc (sizeof (regex_t ));
319
319
if (regcomp (regexp , regex_ , REG_EXTENDED )) {
320
- error ("invalid pattern: %s" , regex_ );
320
+ error (_ ( "invalid pattern: %s" ) , regex_ );
321
321
FREE_AND_NULL (regexp );
322
322
ret = CONFIG_INVALID_PATTERN ;
323
323
goto free_strings ;
@@ -390,7 +390,7 @@ static char *normalize_value(const char *key, const char *value)
390
390
if (type == TYPE_COLOR ) {
391
391
char v [COLOR_MAXLEN ];
392
392
if (git_config_color (v , key , value ))
393
- die ("cannot parse color '%s'" , value );
393
+ die (_ ( "cannot parse color '%s'" ) , value );
394
394
395
395
/*
396
396
* The contents of `v` now contain an ANSI escape
@@ -485,13 +485,13 @@ static int get_colorbool(const char *var, int print)
485
485
static void check_write (void )
486
486
{
487
487
if (!given_config_source .file && !startup_info -> have_repository )
488
- die ("not in a git directory" );
488
+ die (_ ( "not in a git directory" ) );
489
489
490
490
if (given_config_source .use_stdin )
491
- die ("writing to stdin is not supported" );
491
+ die (_ ( "writing to stdin is not supported" ) );
492
492
493
493
if (given_config_source .blob )
494
- die ("writing config blobs is not supported" );
494
+ die (_ ( "writing config blobs is not supported" ) );
495
495
}
496
496
497
497
struct urlmatch_current_candidate_value {
@@ -599,7 +599,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
599
599
600
600
if (use_global_config + use_system_config + use_local_config +
601
601
!!given_config_source .file + !!given_config_source .blob > 1 ) {
602
- error ("only one config file at a time" );
602
+ error (_ ( "only one config file at a time" ) );
603
603
usage_with_options (builtin_config_usage , builtin_config_options );
604
604
}
605
605
@@ -626,7 +626,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
626
626
* location; error out even if XDG_CONFIG_HOME
627
627
* is set and points at a sane location.
628
628
*/
629
- die ("$HOME not set" );
629
+ die (_ ( "$HOME not set" ) );
630
630
631
631
if (access_or_warn (user_config , R_OK , 0 ) &&
632
632
xdg_config && !access_or_warn (xdg_config , R_OK , 0 )) {
@@ -663,12 +663,12 @@ int cmd_config(int argc, const char **argv, const char *prefix)
663
663
}
664
664
665
665
if ((actions & (ACTION_GET_COLOR |ACTION_GET_COLORBOOL )) && type ) {
666
- error ("--get-color and variable type are incoherent" );
666
+ error (_ ( "--get-color and variable type are incoherent" ) );
667
667
usage_with_options (builtin_config_usage , builtin_config_options );
668
668
}
669
669
670
670
if (HAS_MULTI_BITS (actions )) {
671
- error ("only one action at a time" );
671
+ error (_ ( "only one action at a time" ) );
672
672
usage_with_options (builtin_config_usage , builtin_config_options );
673
673
}
674
674
if (actions == 0 )
@@ -681,19 +681,19 @@ int cmd_config(int argc, const char **argv, const char *prefix)
681
681
}
682
682
if (omit_values &&
683
683
!(actions == ACTION_LIST || actions == ACTION_GET_REGEXP )) {
684
- error ("--name-only is only applicable to --list or --get-regexp" );
684
+ error (_ ( "--name-only is only applicable to --list or --get-regexp" ) );
685
685
usage_with_options (builtin_config_usage , builtin_config_options );
686
686
}
687
687
688
688
if (show_origin && !(actions &
689
689
(ACTION_GET |ACTION_GET_ALL |ACTION_GET_REGEXP |ACTION_LIST ))) {
690
- error ("--show-origin is only applicable to --get, --get-all, "
691
- "--get-regexp, and --list" );
690
+ error (_ ( "--show-origin is only applicable to --get, --get-all, "
691
+ "--get-regexp, and --list" ) );
692
692
usage_with_options (builtin_config_usage , builtin_config_options );
693
693
}
694
694
695
695
if (default_value && !(actions & ACTION_GET )) {
696
- error ("--default is only applicable to --get" );
696
+ error (_ ( "--default is only applicable to --get" ) );
697
697
usage_with_options (builtin_config_usage ,
698
698
builtin_config_options );
699
699
}
@@ -707,22 +707,22 @@ int cmd_config(int argc, const char **argv, const char *prefix)
707
707
& given_config_source ,
708
708
& config_options ) < 0 ) {
709
709
if (given_config_source .file )
710
- die_errno ("unable to read config file '%s'" ,
710
+ die_errno (_ ( "unable to read config file '%s'" ) ,
711
711
given_config_source .file );
712
712
else
713
- die ("error processing config file(s)" );
713
+ die (_ ( "error processing config file(s)" ) );
714
714
}
715
715
}
716
716
else if (actions == ACTION_EDIT ) {
717
717
char * config_file ;
718
718
719
719
check_argc (argc , 0 , 0 );
720
720
if (!given_config_source .file && nongit )
721
- die ("not in a git directory" );
721
+ die (_ ( "not in a git directory" ) );
722
722
if (given_config_source .use_stdin )
723
- die ("editing stdin is not supported" );
723
+ die (_ ( "editing stdin is not supported" ) );
724
724
if (given_config_source .blob )
725
- die ("editing blobs is not supported" );
725
+ die (_ ( "editing blobs is not supported" ) );
726
726
git_config (git_default_config , NULL );
727
727
config_file = given_config_source .file ?
728
728
xstrdup (given_config_source .file ) :
@@ -823,7 +823,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
823
823
if (ret < 0 )
824
824
return ret ;
825
825
if (ret == 0 )
826
- die ("no such section: %s" , argv [0 ]);
826
+ die (_ ( "no such section: %s" ) , argv [0 ]);
827
827
}
828
828
else if (actions == ACTION_REMOVE_SECTION ) {
829
829
int ret ;
@@ -834,7 +834,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
834
834
if (ret < 0 )
835
835
return ret ;
836
836
if (ret == 0 )
837
- die ("no such section: %s" , argv [0 ]);
837
+ die (_ ( "no such section: %s" ) , argv [0 ]);
838
838
}
839
839
else if (actions == ACTION_GET_COLOR ) {
840
840
check_argc (argc , 1 , 2 );
0 commit comments