@@ -332,7 +332,7 @@ int git_config_string(const char **dest, const char *var, const char *value)
332
332
return 0 ;
333
333
}
334
334
335
- int git_default_config (const char * var , const char * value , void * dummy )
335
+ static int git_default_core_config (const char * var , const char * value )
336
336
{
337
337
/* This needs a better name */
338
338
if (!strcmp (var , "core.filemode" )) {
@@ -444,6 +444,33 @@ int git_default_config(const char *var, const char *value, void *dummy)
444
444
return 0 ;
445
445
}
446
446
447
+ if (!strcmp (var , "core.pager" ))
448
+ return git_config_string (& pager_program , var , value );
449
+
450
+ if (!strcmp (var , "core.editor" ))
451
+ return git_config_string (& editor_program , var , value );
452
+
453
+ if (!strcmp (var , "core.excludesfile" ))
454
+ return git_config_string (& excludes_file , var , value );
455
+
456
+ if (!strcmp (var , "core.whitespace" )) {
457
+ if (!value )
458
+ return config_error_nonbool (var );
459
+ whitespace_rule_cfg = parse_whitespace_rule (value );
460
+ return 0 ;
461
+ }
462
+
463
+ if (!strcmp (var , "core.fsyncobjectfiles" )) {
464
+ fsync_object_files = git_config_bool (var , value );
465
+ return 0 ;
466
+ }
467
+
468
+ /* Add other config variables here and to Documentation/config.txt. */
469
+ return 0 ;
470
+ }
471
+
472
+ static int git_default_user_config (const char * var , const char * value )
473
+ {
447
474
if (!strcmp (var , "user.name" )) {
448
475
if (!value )
449
476
return config_error_nonbool (var );
@@ -462,32 +489,24 @@ int git_default_config(const char *var, const char *value, void *dummy)
462
489
return 0 ;
463
490
}
464
491
492
+ /* Add other config variables here and to Documentation/config.txt. */
493
+ return 0 ;
494
+ }
495
+
496
+ static int git_default_i18n_config (const char * var , const char * value )
497
+ {
465
498
if (!strcmp (var , "i18n.commitencoding" ))
466
499
return git_config_string (& git_commit_encoding , var , value );
467
500
468
501
if (!strcmp (var , "i18n.logoutputencoding" ))
469
502
return git_config_string (& git_log_output_encoding , var , value );
470
503
471
- if (!strcmp (var , "pager.color" ) || !strcmp (var , "color.pager" )) {
472
- pager_use_color = git_config_bool (var ,value );
473
- return 0 ;
474
- }
475
-
476
- if (!strcmp (var , "core.pager" ))
477
- return git_config_string (& pager_program , var , value );
478
-
479
- if (!strcmp (var , "core.editor" ))
480
- return git_config_string (& editor_program , var , value );
481
-
482
- if (!strcmp (var , "core.excludesfile" ))
483
- return git_config_string (& excludes_file , var , value );
504
+ /* Add other config variables here and to Documentation/config.txt. */
505
+ return 0 ;
506
+ }
484
507
485
- if (!strcmp (var , "core.whitespace" )) {
486
- if (!value )
487
- return config_error_nonbool (var );
488
- whitespace_rule_cfg = parse_whitespace_rule (value );
489
- return 0 ;
490
- }
508
+ static int git_default_branch_config (const char * var , const char * value )
509
+ {
491
510
if (!strcmp (var , "branch.autosetupmerge" )) {
492
511
if (value && !strcasecmp (value , "always" )) {
493
512
git_branch_track = BRANCH_TRACK_ALWAYS ;
@@ -516,6 +535,29 @@ int git_default_config(const char *var, const char *value, void *dummy)
516
535
return 0 ;
517
536
}
518
537
538
+ int git_default_config (const char * var , const char * value , void * dummy )
539
+ {
540
+ if (!prefixcmp (var , "core." ))
541
+ return git_default_core_config (var , value );
542
+
543
+ if (!prefixcmp (var , "user." ))
544
+ return git_default_user_config (var , value );
545
+
546
+ if (!prefixcmp (var , "i18n." ))
547
+ return git_default_i18n_config (var , value );
548
+
549
+ if (!prefixcmp (var , "branch." ))
550
+ return git_default_branch_config (var , value );
551
+
552
+ if (!strcmp (var , "pager.color" ) || !strcmp (var , "color.pager" )) {
553
+ pager_use_color = git_config_bool (var ,value );
554
+ return 0 ;
555
+ }
556
+
557
+ /* Add other config variables here and to Documentation/config.txt. */
558
+ return 0 ;
559
+ }
560
+
519
561
int git_config_from_file (config_fn_t fn , const char * filename , void * data )
520
562
{
521
563
int ret ;
0 commit comments