Gustaf Hendeby  committed 23b5beb

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 <>
Signed-off-by: Junio C Hamano <>

  • Participants
  • Parent commits d08ed6d

Comments (0)

Files changed (2)

File Documentation/gitattributes.txt

 attribute mechanism, via `.gitattributes`).  The following built in
 patterns are available:
+- `bibtex` suitable for files with BibTeX coded references.
 - `java` suitable for source code in the Java lanugage.
 - `pascal` suitable for source code in the Pascal/Delphi language.
 			"^\\(.*=[ \t]*\\(class\\|record\\).*\\)$"
+	{ "bibtex", "\\(@[a-zA-Z]\\{1,\\}[ \t]*{\\{0,1\\}[ \t]*[^ \t\"@',\\#}{~%]*\\).*$" },
 	{ "tex", "^\\(\\\\\\(\\(sub\\)*section\\|chapter\\|part\\)\\*\\{0,1\\}{.*\\)$" },
 	{ "ruby", "^\\s*\\(\\(class\\|module\\|def\\)\\s.*\\)$" },