Skip to contentSkip to conversation

Teach "git diff -p" to locate PHP class methods

PATCH New Andreas Ericsson 1 participant 1 message Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Teach "git diff -p" to locate PHP class methods

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.

---

Documentation/gitattributes.txt |    6 ++++--
diff.c                          |    1 +
2 files changed, 5 insertions(+), 2 deletions(-)
Documentation/gitattributes.txt +4 -8
index 5fb5007..75124d2 100644
@@ -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.c +0 -0
index cbd151b..e7afbe2 100644
@@ -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\\}{.*\\)$" },
Signature · 1 line
1.6.0.1.196.g01914