@matheusbsbs / matheus-bagliano / commits / 9e4bbeb95f
Fork 0

git config: Don't rely on regexec() returning 1 on non-match

Some systems don't return 1 from regexec() when the pattern does not match (notably HP-UX which returns 20). Bug identified by Dscho and H.Merijn Brand. Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de> Tested-by: H.Merijn Brand <h.m.brand@xs4all.nl> Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Björn Steinbrink committed Dec 5, 2007 at 16:11 UTC 9e4bbeb95f5c9d046b671070eb35b3aa6f3ec5e6
1 file changed +1 -2
builtin-config.c
+1 -2
@@ -38,8 +38,7 @@ static int show_config(const char* key_, const char* value_)
38 if (use_key_regexp && regexec(key_regexp, key_, 0, NULL, 0))
39 return 0;
40 if (regexp != NULL &&
41 - (do_not_match ^
42 - regexec(regexp, (value_?value_:""), 0, NULL, 0)))
41 + (do_not_match ^ !!regexec(regexp, (value_?value_:""), 0, NULL, 0)))
42 return 0;
43
44 if (show_keys) {