Skip to content

Commit 23b5beb

Browse files
hendebygitster
authored andcommitted
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>
1 parent d08ed6d commit 23b5beb

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

Documentation/gitattributes.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,8 @@ configuration file (you still need to enable this with the
310310
attribute mechanism, via `.gitattributes`). The following built in
311311
patterns are available:
312312

313+
- `bibtex` suitable for files with BibTeX coded references.
314+
313315
- `java` suitable for source code in the Java lanugage.
314316

315317
- `pascal` suitable for source code in the Pascal/Delphi language.

diff.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,6 +1387,7 @@ static struct builtin_funcname_pattern {
13871387
"\\|"
13881388
"^\\(.*=[ \t]*\\(class\\|record\\).*\\)$"
13891389
},
1390+
{ "bibtex", "\\(@[a-zA-Z]\\{1,\\}[ \t]*{\\{0,1\\}[ \t]*[^ \t\"@',\\#}{~%]*\\).*$" },
13901391
{ "tex", "^\\(\\\\\\(\\(sub\\)*section\\|chapter\\|part\\)\\*\\{0,1\\}{.*\\)$" },
13911392
{ "ruby", "^\\s*\\(\\(class\\|module\\|def\\)\\s.*\\)$" },
13921393
};

0 commit comments

Comments
 (0)