@matheusbsbs / matheus-bagliano / commits / 4f342b96d1
Fork 0

builtin-reflog.c: guard config parser from value=NULL

gc.reflogexpire and gc.reflogexpireunreachable configuration expect a string value suitable for calling approxidate() with. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Feb 11, 2008 at 10:50 UTC 4f342b96d15205ec052e400f10121dd7cee39963
1 file changed +11 -5
builtin-reflog.c
+11 -5
@@ -307,13 +307,19 @@ static int collect_reflog(const char *ref, const unsigned char *sha1, int unused
307
308 static int reflog_expire_config(const char *var, const char *value)
309 {
310 - if (!strcmp(var, "gc.reflogexpire"))
310 + if (!strcmp(var, "gc.reflogexpire")) {
311 + if (!value)
312 + config_error_nonbool(var);
313 default_reflog_expire = approxidate(value);
312 - else if (!strcmp(var, "gc.reflogexpireunreachable"))
314 + return 0;
315 + }
316 + if (!strcmp(var, "gc.reflogexpireunreachable")) {
317 + if (!value)
318 + config_error_nonbool(var);
319 default_reflog_expire_unreachable = approxidate(value);
314 - else
315 - return git_default_config(var, value);
316 - return 0;
320 + return 0;
321 + }
322 + return git_default_config(var, value);
323 }
324
325 static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)