Skip to content

Commit

Permalink
Teach git diff about BibTeX head hunk patterns
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Gustaf Hendeby authored and Junio C Hamano committed Aug 12, 2008
1 parent d08ed6d commit 23b5beb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Documentation/gitattributes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ configuration file (you still need to enable this with the
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.
Expand Down
1 change: 1 addition & 0 deletions diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1387,6 +1387,7 @@ static struct builtin_funcname_pattern {
"\\|"
"^\\(.*=[ \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.*\\)$" },
};
Expand Down

0 comments on commit 23b5beb

Please sign in to comment.