@@ -55,44 +55,33 @@ static void remove_pidfile_on_signal(int signo)
55
55
raise (signo );
56
56
}
57
57
58
- static int gc_config (const char * var , const char * value , void * cb )
58
+ static void gc_config (void )
59
59
{
60
- if (!strcmp (var , "gc.packrefs" )) {
60
+ const char * value ;
61
+
62
+ if (!git_config_get_value ("gc.packrefs" , & value )) {
61
63
if (value && !strcmp (value , "notbare" ))
62
64
pack_refs = -1 ;
63
65
else
64
- pack_refs = git_config_bool (var , value );
65
- return 0 ;
66
- }
67
- if (!strcmp (var , "gc.aggressivewindow" )) {
68
- aggressive_window = git_config_int (var , value );
69
- return 0 ;
70
- }
71
- if (!strcmp (var , "gc.aggressivedepth" )) {
72
- aggressive_depth = git_config_int (var , value );
73
- return 0 ;
74
- }
75
- if (!strcmp (var , "gc.auto" )) {
76
- gc_auto_threshold = git_config_int (var , value );
77
- return 0 ;
78
- }
79
- if (!strcmp (var , "gc.autopacklimit" )) {
80
- gc_auto_pack_limit = git_config_int (var , value );
81
- return 0 ;
66
+ pack_refs = git_config_bool ("gc.packrefs" , value );
82
67
}
83
- if (!strcmp (var , "gc.autodetach" )) {
84
- detach_auto = git_config_bool (var , value );
85
- return 0 ;
86
- }
87
- if (!strcmp (var , "gc.pruneexpire" )) {
88
- if (value && strcmp (value , "now" )) {
68
+
69
+ git_config_get_int ("gc.aggressivewindow" , & aggressive_window );
70
+ git_config_get_int ("gc.aggressivedepth" , & aggressive_depth );
71
+ git_config_get_int ("gc.auto" , & gc_auto_threshold );
72
+ git_config_get_int ("gc.autopacklimit" , & gc_auto_pack_limit );
73
+ git_config_get_bool ("gc.autodetach" , & detach_auto );
74
+
75
+ if (!git_config_get_string_const ("gc.pruneexpire" , & prune_expire )) {
76
+ if (strcmp (prune_expire , "now" )) {
89
77
unsigned long now = approxidate ("now" );
90
- if (approxidate (value ) >= now )
91
- return error (_ ("Invalid %s: '%s'" ), var , value );
78
+ if (approxidate (prune_expire ) >= now ) {
79
+ git_die_config ("gc.pruneexpire" , _ ("Invalid gc.pruneexpire: '%s'" ),
80
+ prune_expire );
81
+ }
92
82
}
93
- return git_config_string (& prune_expire , var , value );
94
83
}
95
- return git_default_config ( var , value , cb );
84
+ git_config ( git_default_config , NULL );
96
85
}
97
86
98
87
static int too_many_loose_objects (void )
@@ -301,7 +290,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
301
290
argv_array_pushl (& prune , "prune" , "--expire" , NULL );
302
291
argv_array_pushl (& rerere , "rerere" , "gc" , NULL );
303
292
304
- git_config ( gc_config , NULL );
293
+ gc_config ( );
305
294
306
295
if (pack_refs < 0 )
307
296
pack_refs = !is_bare_repository ();
0 commit comments