git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Teach "git diff" HTML funcname patterns

From
Johan Herland <johan@herland.net>
Date
Aug 20, 2008, 17:27 UTC
Message-ID
<200808201927.47099.johan@herland.net>
Finds lines with <h1>..<h6> tags. The pattern is adapted from the ruby one.
Signed-off-by: Johan Herland <johan@herland.net>
---
 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 db16b0c..8bb05e6 100644
--- a/Documentation/gitattributes.txt
+++ b/Documentation/gitattributes.txt
@@ -320,6 +320,8 @@ patterns are available:
 
 - `tex` suitable for source code for LaTeX documents.
 
+- `html` suitable for HTML/XHTML documents.
+
 
 Performing a three-way merge
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/diff.c b/diff.c
index a6c1432..13ae85d 100644
--- a/diff.c
+++ b/diff.c
@@ -1382,6 +1382,7 @@ static struct builtin_funcname_pattern {
 	{ "bibtex", "\\(@[a-zA-Z]\\{1,\\}[ \t]*{\\{0,1\\}[ \t]*[^ \t\"@',\\#}{~%]*\\).*$" },
 	{ "tex", "^\\(\\\\\\(\\(sub\\)*section\\|chapter\\|part\\)\\*\\{0,1\\}{.*\\)$" },
 	{ "ruby", "^\\s*\\(\\(class\\|module\\|def\\)\\s.*\\)$" },
+	{ "html", "^\\s*\\(<h[1-6]\\s.*>.*\\)$" },
 };
 
 static const char *diff_funcname_pattern(struct diff_filespec *one)
-- 
1.6.0.96.g2fad1
Next: Mike Hommey
Message 1 of 3 in “Teach "git diff" HTML funcname patterns”
  1. Teach "git diff" HTML funcname patternsJohan Herland, Aug 20, 2008
  2. Mike HommeyAug 20, 2008
  3. Teach "git diff" HTML funcname patternsJohan Herland, Aug 20, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.