[PATCH 1/2] gitattributes: Document built in hunk header patterns

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 1/2] gitattributes: Document built in hunk header patterns

Gustaf Hendeby
Since the hunk header pattern text was written patterns for Ruby and
Pascal/Delphi have been added.  For users to be able to find them they
should be documented not only in code.

Signed-off-by: Gustaf Hendeby <[hidden email]>
---

Would it maybe be a good idea to also link to this information in the
git diff documentation?  At the moment I can't find any documentation
about hunk headers and hunk header patterns at all in the diff
documentation.  The git diff documentation is the first place I would
look for that kind of information.  OTOH, the diff documentation is
already quite lengthy and I'm not really found of making it even
longer.  Oppinions how this nice feature should best be made generally
known?

/Gustaf

 Documentation/gitattributes.txt |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
index d7b4114..c61a58d 100644
--- a/Documentation/gitattributes.txt
+++ b/Documentation/gitattributes.txt
@@ -307,9 +307,16 @@ backslash, and zero or more occurrences of `sub` followed by
 There are a few built-in patterns to make this easier, and `tex`
 is one of them, so you do not have to write the above in your
 configuration file (you still need to enable this with the
-attribute mechanism, via `.gitattributes`).  Another built-in
-pattern is defined for `java` that defines a pattern suitable
-for program text in Java language.
+attribute mechanism, via `.gitattributes`).  The following built in
+patterns are available:
+
+- `java` suitable for source code in the Java lanugage.
+
+- `pascal` suitable for source code in the Pascal/Delphi language.
+
+- `ruby` suitable for source code in the Ruby language.
+
+- `tex` suitable for source code for LaTeX documents.
 
 
 Performing a three-way merge
--
1.6.0.rc2.30.gf3f0.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

[PATCH 2/2] Teach git diff about BibTeX head hunk patterns

Gustaf Hendeby
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 <[hidden email]>
---

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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html