summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-02-11 18:50:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-02-11 21:11:36 (GMT)
commit4f342b96d15205ec052e400f10121dd7cee39963 (patch)
treec7929514ad3f14c3c5c4bca1291f3de78ae4eec0
parent995c45279e270811f53b7ff8bf44a07ed3457ddc (diff)
downloadgit-4f342b96d15205ec052e400f10121dd7cee39963.zip
git-4f342b96d15205ec052e400f10121dd7cee39963.tar.gz
git-4f342b96d15205ec052e400f10121dd7cee39963.tar.bz2
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>
-rw-r--r--builtin-reflog.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/builtin-reflog.c b/builtin-reflog.c
index e6834dd..4836ec9 100644
--- a/builtin-reflog.c
+++ b/builtin-reflog.c
@@ -307,13 +307,19 @@ static int collect_reflog(const char *ref, const unsigned char *sha1, int unused
static int reflog_expire_config(const char *var, const char *value)
{
- if (!strcmp(var, "gc.reflogexpire"))
+ if (!strcmp(var, "gc.reflogexpire")) {
+ if (!value)
+ config_error_nonbool(var);
default_reflog_expire = approxidate(value);
- else if (!strcmp(var, "gc.reflogexpireunreachable"))
+ return 0;
+ }
+ if (!strcmp(var, "gc.reflogexpireunreachable")) {
+ if (!value)
+ config_error_nonbool(var);
default_reflog_expire_unreachable = approxidate(value);
- else
- return git_default_config(var, value);
- return 0;
+ return 0;
+ }
+ return git_default_config(var, value);
}
static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)