{"thread":{"id":"14961","subject":"[PATCH 1/2] gitattributes: Document built in hunk header patterns","startedAt":"2008-08-12T14:24:25Z","lastAt":"2008-08-12T14:24:26Z","messageCount":2,"participants":["Gustaf Hendeby"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"86931","messageId":"1218551066-13012-1-git-send-email-hendeby@isy.liu.se","threadId":"14961","inReplyTo":null,"subject":"[PATCH 1/2] gitattributes: Document built in hunk header patterns","fromName":"Gustaf Hendeby","fromEmail":"hendeby@isy.liu.se","sentAt":"2008-08-12T14:24:25Z","receivedAt":"2008-08-12T14:24:25Z","isPatch":true,"sender":{"key":"hendeby@isy.liu.se","avatar":"https://avatars.githubusercontent.com/u/730316?v=4"},"body":"Since the hunk header pattern text was written patterns for Ruby and\nPascal/Delphi have been added.  For users to be able to find them they\nshould be documented not only in code.\n\nSigned-off-by: Gustaf Hendeby <hendeby@isy.liu.se>\n---\n\nWould it maybe be a good idea to also link to this information in the\ngit diff documentation?  At the moment I can't find any documentation\nabout hunk headers and hunk header patterns at all in the diff\ndocumentation.  The git diff documentation is the first place I would\nlook for that kind of information.  OTOH, the diff documentation is\nalready quite lengthy and I'm not really found of making it even\nlonger.  Oppinions how this nice feature should best be made generally\nknown?\n\n/Gustaf\n\n Documentation/gitattributes.txt |   13 ++++++++++---\n 1 files changed, 10 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\nindex d7b4114..c61a58d 100644\n--- a/Documentation/gitattributes.txt\n+++ b/Documentation/gitattributes.txt\n@@ -307,9 +307,16 @@ backslash, and zero or more occurrences of `sub` followed by\n There are a few built-in patterns to make this easier, and `tex`\n is one of them, so you do not have to write the above in your\n configuration file (you still need to enable this with the\n-attribute mechanism, via `.gitattributes`).  Another built-in\n-pattern is defined for `java` that defines a pattern suitable\n-for program text in Java language.\n+attribute mechanism, via `.gitattributes`).  The following built in\n+patterns are available:\n+\n+- `java` suitable for source code in the Java lanugage.\n+\n+- `pascal` suitable for source code in the Pascal/Delphi language.\n+\n+- `ruby` suitable for source code in the Ruby language.\n+\n+- `tex` suitable for source code for LaTeX documents.\n \n \n Performing a three-way merge\n-- \n1.6.0.rc2.30.gf3f0.dirty\n"},{"id":"86932","messageId":"1218551066-13012-2-git-send-email-hendeby@isy.liu.se","threadId":"14961","inReplyTo":"1218551066-13012-1-git-send-email-hendeby@isy.liu.se","subject":"[PATCH 2/2] Teach git diff about BibTeX head hunk patterns","fromName":"Gustaf Hendeby","fromEmail":"hendeby@isy.liu.se","sentAt":"2008-08-12T14:24:26Z","receivedAt":"2008-08-12T14:24:26Z","isPatch":true,"sender":{"key":"hendeby@isy.liu.se","avatar":"https://avatars.githubusercontent.com/u/730316?v=4"},"body":"All BibTeX entries starts with an @ followed by an entry type.  Since\nthere are many entry types and own can be defined, the pattern matches\nlegal entry type names instead of just the default types (which would\nbe a long list).  The pattern also matches strings and comments since\nthey will also be useful to position oneself in a bib-file.\n\nSigned-off-by: Gustaf Hendeby <hendeby@isy.liu.se>\n---\n\nI know this is the wrong time to introduce something new, late in the\nrc cycle.  However I had it bundled with the documentation update I\nthink should be considered now.  Feel free to ignore for the moment\nand I'll resend post 1.6.0.\n\nA quick question here is what the policy there is for introducing new\nbuilt in head hunk patterns, and if a BibTeX pattern fits there.  If\nnot, may I suggest a list somewhere with suggested patterns so that\neach user doesn't have to reinvent the wheel?\n\n/Gustaf\n\n Documentation/gitattributes.txt |    2 ++\n diff.c                          |    1 +\n 2 files changed, 3 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\nindex c61a58d..db16b0c 100644\n--- a/Documentation/gitattributes.txt\n+++ b/Documentation/gitattributes.txt\n@@ -310,6 +310,8 @@ configuration file (you still need to enable this with the\n attribute mechanism, via `.gitattributes`).  The following built in\n patterns are available:\n \n+- `bibtex` suitable for files with BibTeX coded references.\n+\n - `java` suitable for source code in the Java lanugage.\n \n - `pascal` suitable for source code in the Pascal/Delphi language.\ndiff --git a/diff.c b/diff.c\nindex 6954f99..fa8c620 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -1387,7 +1387,7 @@ static struct builtin_funcname_pattern {\n \t\t\t\"\\\\|\"\n \t\t\t\"^\\\\(.*=[ \\t]*\\\\(class\\\\|record\\\\).*\\\\)$\"\n \t\t\t},\n+\t{ \"bibtex\", \"\\\\(@[a-zA-Z]\\\\{1,\\\\}[ \\t]*{\\\\{0,1\\\\}[ \\t]*[^ \\t\\\"@',\\\\#}{~%]*\\\\).*$\" },\n \t{ \"tex\", \"^\\\\(\\\\\\\\\\\\(\\\\(sub\\\\)*section\\\\|chapter\\\\|part\\\\)\\\\*\\\\{0,1\\\\}{.*\\\\)$\" },\n \t{ \"ruby\", \"^\\\\s*\\\\(\\\\(class\\\\|module\\\\|def\\\\)\\\\s.*\\\\)$\" },\n };\n-- \n1.6.0.rc2.30.gf3f0.dirty\n"}]}