git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gustaf Hendeby <hendeby@isy.liu.se>
To: git@vger.kernel.org
Cc: Gustaf Hendeby <hendeby@isy.liu.se>
Subject: [PATCH 2/2] Teach git diff about BibTeX head hunk patterns
Date: Tue, 12 Aug 2008 16:24:26 +0200	[thread overview]
Message-ID: <1218551066-13012-2-git-send-email-hendeby@isy.liu.se> (raw)
In-Reply-To: <1218551066-13012-1-git-send-email-hendeby@isy.liu.se>

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>
---

I know this is the wrong time to introduce something new, late in the
rc cycle.  However I had it bundled with the documentation update I
think should be considered now.  Feel free to ignore for the moment
and I'll resend post 1.6.0.

A quick question here is what the policy there is for introducing new
built in head hunk patterns, and if a BibTeX pattern fits there.  If
not, may I suggest a list somewhere with suggested patterns so that
each user doesn't have to reinvent the wheel?

/Gustaf

 Documentation/gitattributes.txt |    2 ++
 diff.c                          |    1 +
 2 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
index c61a58d..db16b0c 100644
--- a/Documentation/gitattributes.txt
+++ b/Documentation/gitattributes.txt
@@ -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.
diff --git a/diff.c b/diff.c
index 6954f99..fa8c620 100644
--- a/diff.c
+++ b/diff.c
@@ -1387,7 +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.*\\)$" },
 };
-- 
1.6.0.rc2.30.gf3f0.dirty

      reply	other threads:[~2008-08-12 14:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-12 14:24 [PATCH 1/2] gitattributes: Document built in hunk header patterns Gustaf Hendeby
2008-08-12 14:24 ` Gustaf Hendeby [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1218551066-13012-2-git-send-email-hendeby@isy.liu.se \
    --to=hendeby@isy.liu.se \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).