@matheusbsbs / matheus-bagliano / commits / 7c17205b64
Fork 0

Teach "git diff -p" Python funcname patterns

Find classes, functions, and methods definitions. Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Kirill Smelkov committed Aug 20, 2008 at 19:57 UTC 7c17205b64a0e668d8a6e59109043bd4f2af3a0c
2 files changed +3
Documentation/gitattributes.txt
+2
@@ -316,6 +316,8 @@ patterns are available:
316
317 - `pascal` suitable for source code in the Pascal/Delphi language.
318
319 +- `python` suitable for source code in the Python language.
320 +
321 - `ruby` suitable for source code in the Ruby language.
322
323 - `tex` suitable for source code for LaTeX documents.
diff.c
+1
@@ -1394,6 +1394,7 @@ static struct builtin_funcname_pattern {
1394 },
1395 { "bibtex", "\\(@[a-zA-Z]\\{1,\\}[ \t]*{\\{0,1\\}[ \t]*[^ \t\"@',\\#}{~%]*\\).*$" },
1396 { "tex", "^\\(\\\\\\(\\(sub\\)*section\\|chapter\\|part\\)\\*\\{0,1\\}{.*\\)$" },
1397 + { "python", "^\\s*\\(\\(class\\|def\\)\\s.*\\)$" },
1398 { "ruby", "^\\s*\\(\\(class\\|module\\|def\\)\\s.*\\)$" },
1399 };
1400