Teach git diff about BibTeX head hunk patterns
All BibTeX entries starts with an @ followed by an entry type. Since there are many entry types and own can be defined, the pattern matches legal entry type names instead of just the default types (which would be a long list). The pattern also matches strings and comments since they will also be useful to position oneself in a bib-file. Signed-off-by: Gustaf Hendeby <hendeby@isy.liu.se> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Gustaf Hendeby committed
Aug 12, 2008 at 16:24 UTC
23b5beb28fdadbb1d80ebf686a35385609f7a180
2 files changed
+3
Documentation/gitattributes.txt
+2
@@ -310,6 +310,8 @@ configuration file (you still need to enable this with the
310
attribute mechanism, via `.gitattributes`). The following built in
311
patterns are available:
312
313
+- `bibtex` suitable for files with BibTeX coded references.
314
+
315
- `java` suitable for source code in the Java lanugage.
316
317
- `pascal` suitable for source code in the Pascal/Delphi language.
diff.c
+1
@@ -1387,6 +1387,7 @@ static struct builtin_funcname_pattern {
1387
"\\|"
1388
"^\\(.*=[ \t]*\\(class\\|record\\).*\\)$"
1389
},
1390
+ { "bibtex", "\\(@[a-zA-Z]\\{1,\\}[ \t]*{\\{0,1\\}[ \t]*[^ \t\"@',\\#}{~%]*\\).*$" },
1391
{ "tex", "^\\(\\\\\\(\\(sub\\)*section\\|chapter\\|part\\)\\*\\{0,1\\}{.*\\)$" },
1392
{ "ruby", "^\\s*\\(\\(class\\|module\\|def\\)\\s.*\\)$" },
1393
};