]> rtime.felk.cvut.cz Git - git.git/commitdiff
diff: Support visibility modifiers in the PHP hunk header regexp
authorBjörn Steinbrink <B.Steinbrink@gmx.de>
Sun, 23 May 2010 18:05:40 +0000 (20:05 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 27 May 2010 14:12:07 +0000 (07:12 -0700)
Starting with PHP5, class methods can have a visibility modifier, which
caused the methods not to be matched by the existing regexp, so extend
the regexp to match those modifiers. And while we're at it, allow the
"static" modifier as well.

Since the "static" modifier can appear either before or after the
visibility modifier, let's just allow any number of modifiers to appear
in any order, as that simplifies the regexp and shouldn't cause any
false positives.

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
userdiff.c

index df992490d5f86b5eff2b87e90090b1ec576aae9a..38563daa3c7582ca87565886d74f16d11b292a57 100644 (file)
@@ -44,7 +44,9 @@ PATTERNS("pascal",
         "|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+"
         "|<>|<=|>=|:=|\\.\\."
         "|[^[:space:]]|[\x80-\xff]+"),
-PATTERNS("php", "^[\t ]*((function|class).*)",
+PATTERNS("php",
+        "^[\t ]*(((public|protected|private|static)[\t ]+)*function.*)$\n"
+        "^[\t ]*(class.*)$",
         /* -- */
         "[a-zA-Z_][a-zA-Z0-9_]*"
         "|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+"