@@ -337,44 +337,49 @@ static int handle_config(const char *key, const char *value)
337337 return 0 ;
338338 }
339339 remote = make_remote (name , subkey - name );
340- if (!value ) {
341- /* if we ever have a boolean variable, e.g. "remote.*.disabled"
342- * [remote "frotz"]
343- * disabled
344- * is a valid way to set it to true; we get NULL in value so
345- * we need to handle it here.
346- *
347- * if (!strcmp(subkey, ".disabled")) {
348- * val = git_config_bool(key, value);
349- * return 0;
350- * } else
351- *
352- */
353- return 0 ; /* ignore unknown booleans */
354- }
355- if (!strcmp (subkey , ".url" )) {
356- add_url (remote , xstrdup (value ));
340+ if (!strcmp (subkey , ".mirror" ))
341+ remote -> mirror = git_config_bool (key , value );
342+ else if (!strcmp (subkey , ".skipdefaultupdate" ))
343+ remote -> skip_default_update = git_config_bool (key , value );
344+
345+ else if (!strcmp (subkey , ".url" )) {
346+ const char * v ;
347+ if (git_config_string (& v , key , value ))
348+ return -1 ;
349+ add_url (remote , v );
357350 } else if (!strcmp (subkey , ".push" )) {
358- add_push_refspec (remote , xstrdup (value ));
351+ const char * v ;
352+ if (git_config_string (& v , key , value ))
353+ return -1 ;
354+ add_push_refspec (remote , v );
359355 } else if (!strcmp (subkey , ".fetch" )) {
360- add_fetch_refspec (remote , xstrdup (value ));
356+ const char * v ;
357+ if (git_config_string (& v , key , value ))
358+ return -1 ;
359+ add_fetch_refspec (remote , v );
361360 } else if (!strcmp (subkey , ".receivepack" )) {
361+ const char * v ;
362+ if (git_config_string (& v , key , value ))
363+ return -1 ;
362364 if (!remote -> receivepack )
363- remote -> receivepack = xstrdup ( value ) ;
365+ remote -> receivepack = v ;
364366 else
365367 error ("more than one receivepack given, using the first" );
366368 } else if (!strcmp (subkey , ".uploadpack" )) {
369+ const char * v ;
370+ if (git_config_string (& v , key , value ))
371+ return -1 ;
367372 if (!remote -> uploadpack )
368- remote -> uploadpack = xstrdup ( value ) ;
373+ remote -> uploadpack = v ;
369374 else
370375 error ("more than one uploadpack given, using the first" );
371376 } else if (!strcmp (subkey , ".tagopt" )) {
372377 if (!strcmp (value , "--no-tags" ))
373378 remote -> fetch_tags = -1 ;
374379 } else if (!strcmp (subkey , ".proxy" )) {
375- remote -> http_proxy = xstrdup ( value );
376- } else if (! strcmp ( subkey , ".skipdefaultupdate" ))
377- remote -> skip_default_update = 1 ;
380+ return git_config_string (( const char * * ) & remote -> http_proxy ,
381+ key , value );
382+ }
378383 return 0 ;
379384}
380385
0 commit comments