@@ -67,7 +67,7 @@ static int show_origin;
67
67
{ OPTION_CALLBACK, (s), (l), (v), NULL, (h), PARSE_OPT_NOARG | \
68
68
PARSE_OPT_NONEG, option_parse_type, (i) }
69
69
70
- static struct option builtin_config_options [] ;
70
+ static NORETURN void usage_builtin_config ( void ) ;
71
71
72
72
static int option_parse_type (const struct option * opt , const char * arg ,
73
73
int unset )
@@ -111,8 +111,7 @@ static int option_parse_type(const struct option *opt, const char *arg,
111
111
* --type=int'.
112
112
*/
113
113
error ("only one type at a time." );
114
- usage_with_options (builtin_config_usage ,
115
- builtin_config_options );
114
+ usage_builtin_config ();
116
115
}
117
116
* to_type = new_type ;
118
117
@@ -157,11 +156,16 @@ static struct option builtin_config_options[] = {
157
156
OPT_END (),
158
157
};
159
158
159
+ static NORETURN void usage_builtin_config (void )
160
+ {
161
+ usage_with_options (builtin_config_usage , builtin_config_options );
162
+ }
163
+
160
164
static void check_argc (int argc , int min , int max ) {
161
165
if (argc >= min && argc <= max )
162
166
return ;
163
167
error ("wrong number of arguments" );
164
- usage_with_options ( builtin_config_usage , builtin_config_options );
168
+ usage_builtin_config ( );
165
169
}
166
170
167
171
static void show_config_origin (struct strbuf * buf )
@@ -596,7 +600,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
596
600
if (use_global_config + use_system_config + use_local_config +
597
601
!!given_config_source .file + !!given_config_source .blob > 1 ) {
598
602
error ("only one config file at a time." );
599
- usage_with_options ( builtin_config_usage , builtin_config_options );
603
+ usage_builtin_config ( );
600
604
}
601
605
602
606
if (use_local_config && nongit )
@@ -660,38 +664,37 @@ int cmd_config(int argc, const char **argv, const char *prefix)
660
664
661
665
if ((actions & (ACTION_GET_COLOR |ACTION_GET_COLORBOOL )) && type ) {
662
666
error ("--get-color and variable type are incoherent" );
663
- usage_with_options ( builtin_config_usage , builtin_config_options );
667
+ usage_builtin_config ( );
664
668
}
665
669
666
670
if (HAS_MULTI_BITS (actions )) {
667
671
error ("only one action at a time." );
668
- usage_with_options ( builtin_config_usage , builtin_config_options );
672
+ usage_builtin_config ( );
669
673
}
670
674
if (actions == 0 )
671
675
switch (argc ) {
672
676
case 1 : actions = ACTION_GET ; break ;
673
677
case 2 : actions = ACTION_SET ; break ;
674
678
case 3 : actions = ACTION_SET_ALL ; break ;
675
679
default :
676
- usage_with_options ( builtin_config_usage , builtin_config_options );
680
+ usage_builtin_config ( );
677
681
}
678
682
if (omit_values &&
679
683
!(actions == ACTION_LIST || actions == ACTION_GET_REGEXP )) {
680
684
error ("--name-only is only applicable to --list or --get-regexp" );
681
- usage_with_options ( builtin_config_usage , builtin_config_options );
685
+ usage_builtin_config ( );
682
686
}
683
687
684
688
if (show_origin && !(actions &
685
689
(ACTION_GET |ACTION_GET_ALL |ACTION_GET_REGEXP |ACTION_LIST ))) {
686
690
error ("--show-origin is only applicable to --get, --get-all, "
687
691
"--get-regexp, and --list." );
688
- usage_with_options ( builtin_config_usage , builtin_config_options );
692
+ usage_builtin_config ( );
689
693
}
690
694
691
695
if (default_value && !(actions & ACTION_GET )) {
692
696
error ("--default is only applicable to --get" );
693
- usage_with_options (builtin_config_usage ,
694
- builtin_config_options );
697
+ usage_builtin_config ();
695
698
}
696
699
697
700
if (actions & PAGING_ACTIONS )
0 commit comments