@@ -55,6 +55,17 @@ static void remove_pidfile_on_signal(int signo)
5555 raise (signo );
5656}
5757
58+ static void git_config_date_string (const char * key , const char * * output )
59+ {
60+ if (git_config_get_string_const (key , output ))
61+ return ;
62+ if (strcmp (* output , "now" )) {
63+ unsigned long now = approxidate ("now" );
64+ if (approxidate (* output ) >= now )
65+ git_die_config (key , _ ("Invalid %s: '%s'" ), key , * output );
66+ }
67+ }
68+
5869static void gc_config (void )
5970{
6071 const char * value ;
@@ -71,16 +82,7 @@ static void gc_config(void)
7182 git_config_get_int ("gc.auto" , & gc_auto_threshold );
7283 git_config_get_int ("gc.autopacklimit" , & gc_auto_pack_limit );
7384 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" )) {
77- unsigned long now = approxidate ("now" );
78- if (approxidate (prune_expire ) >= now ) {
79- git_die_config ("gc.pruneexpire" , _ ("Invalid gc.pruneexpire: '%s'" ),
80- prune_expire );
81- }
82- }
83- }
85+ git_config_date_string ("gc.pruneexpire" , & prune_expire );
8486 git_config (git_default_config , NULL );
8587}
8688
0 commit comments