make config --add behave correctly for empty and NULL values
[gitweb.git] / config.c
index 2634457f6b07ca55b69f3b4a22b8a9e4339fd121..ffe010423d6a44bb12218ded95c4e86dfed8848d 100644 (file)
--- a/config.c
+++ b/config.c
@@ -1233,7 +1233,7 @@ static int matches(const char *key, const char *value)
        return !strcmp(key, store.key) &&
                (store.value_regex == NULL ||
                 (store.do_not_match ^
-                 !regexec(store.value_regex, value, 0, NULL, 0)));
+                 (value && !regexec(store.value_regex, value, 0, NULL, 0))));
 }
 
 static int store_aux(const char *key, const char *value, void *cb)