]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Teach "git diff -p" to locate PHP class methods
authorAndreas Ericsson <ae@op5.se>
Sun, 7 Sep 2008 20:15:29 +0000 (22:15 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sun, 7 Sep 2008 22:22:24 +0000 (15:22 -0700)
Otherwise it will always print the class-name rather
than the name of the function inside that class.

While we're at it, reorder the gitattributes manpage to
list the built-in funcname pattern names in alphabetical
order.

Signed-off-by: Andreas Ericsson <ae@op5.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/gitattributes.txt
diff.c

index 5fb5007413666d0b3d0aaa4c553c1fd5a67e60d9..75124d26125f736b446b8e18826af3e444503edd 100644 (file)
@@ -311,18 +311,20 @@ patterns are available:
 
 - `bibtex` suitable for files with BibTeX coded references.
 
+- `html` suitable for HTML/XHTML documents.
+
 - `java` suitable for source code in the Java lanugage.
 
 - `pascal` suitable for source code in the Pascal/Delphi language.
 
+- `php` suitable for source code in the PHP language.
+
 - `python` suitable for source code in the Python language.
 
 - `ruby` suitable for source code in the Ruby language.
 
 - `tex` suitable for source code for LaTeX documents.
 
-- `html` suitable for HTML/XHTML documents.
-
 
 Performing a three-way merge
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/diff.c b/diff.c
index cbd151bbc80dbd0410f47230bbb645235131c754..e7afbe28c1379fbd003de905e1d7cb87ff37971e 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -1402,6 +1402,7 @@ static struct builtin_funcname_pattern {
                        "\\|"
                        "^\\(.*=[ \t]*\\(class\\|record\\).*\\)$"
                        },
+       { "php", "^[\t ]*\\(\\(function\\|class\\).*\\)" },
        { "python", "^\\s*\\(\\(class\\|def\\)\\s.*\\)$" },
        { "ruby", "^\\s*\\(\\(class\\|module\\|def\\)\\s.*\\)$" },
        { "tex", "^\\(\\\\\\(\\(sub\\)*section\\|chapter\\|part\\)\\*\\{0,1\\}{.*\\)$" },