Code

Merge branch 'bc/maint-diff-hunk-header-fix' into bc/master-diff-hunk-header-fix
authorJunio C Hamano <gitster@pobox.com>
Sat, 20 Sep 2008 06:51:01 +0000 (23:51 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 20 Sep 2008 06:51:01 +0000 (23:51 -0700)
* bc/maint-diff-hunk-header-fix:
  diff: use extended regexp to find hunk headers

Conflicts:
diff.c

1  2 
diff.c

diff --cc diff.c
index 7b24672d31b09c9f7d7de840c57f75adba598b84,175a044a344aa848530e72b16355be9694249494..5b9b074856f3b3a4d47d9e8f7ed6cd059a005d64
--- 1/diff.c
--- 2/diff.c
+++ b/diff.c
@@@ -1404,23 -1399,23 +1404,26 @@@ static const struct funcname_pattern_en
  }
  
  static const struct funcname_pattern_entry builtin_funcname_pattern[] = {
-       { "bibtex", "\\(@[a-zA-Z]\\{1,\\}[ \t]*{\\{0,1\\}[ \t]*[^ \t\"@',\\#}{~%]*\\).*$", 0 },
++      { "bibtex", "(@[a-zA-Z]{1,}[ \t]*\{{0,1}[ \t]*[^ \t\"@',\\#}{~%]*).*$",
++        REG_EXTENDED },
 +      { "html", "^\\s*\\(<[Hh][1-6]\\s.*>.*\\)$", 0 },
-       { "java", "!^[  ]*\\(catch\\|do\\|for\\|if\\|instanceof\\|"
-                       "new\\|return\\|switch\\|throw\\|while\\)\n"
-                       "^[     ]*\\(\\([       ]*"
-                       "[A-Za-z_][A-Za-z_0-9]*\\)\\{2,\\}"
-                       "[      ]*([^;]*\\)$", 0 },
-       { "pascal", "^\\(\\(procedure\\|function\\|constructor\\|"
-                       "destructor\\|interface\\|implementation\\|"
-                       "initialization\\|finalization\\)[ \t]*.*\\)$"
-                       "\\|"
-                       "^\\(.*=[ \t]*\\(class\\|record\\).*\\)$",
-                       0 },
+       { "java",
+         "!^[ \t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\n"
+         "^[ \t]*(([ \t]*[A-Za-z_][A-Za-z_0-9]*){2,}[ \t]*\\([^;]*)$",
+         REG_EXTENDED },
+       { "pascal",
+         "^((procedure|function|constructor|destructor|interface|"
+               "implementation|initialization|finalization)[ \t]*.*)$"
+         "|"
+         "^(.*=[ \t]*(class|record).*)$",
+         REG_EXTENDED },
 -      { "bibtex", "(@[a-zA-Z]{1,}[ \t]*\{{0,1}[ \t]*[^ \t\"@',\\#}{~%]*).*$",
 +      { "php", "^[\t ]*\\(\\(function\\|class\\).*\\)", 0 },
 +      { "python", "^\\s*\\(\\(class\\|def\\)\\s.*\\)$", 0 },
-       { "ruby", "^\\s*\\(\\(class\\|module\\|def\\)\\s.*\\)$", 0 },
-       { "tex", "^\\(\\\\\\(\\(sub\\)*section\\|chapter\\|part\\)\\*\\{0,1\\}{.*\\)$", 0 },
++      { "ruby", "^[ \t]*((class|module|def)[ \t].*)$",
+         REG_EXTENDED },
+       { "tex",
+         "^(\\\\((sub)*section|chapter|part)\\*{0,1}\{.*)$",
+         REG_EXTENDED },
 -      { "ruby", "^[ \t]*((class|module|def)[ \t].*)$",
 -        REG_EXTENDED },
  };
  
  static const struct funcname_pattern_entry *diff_funcname_pattern(struct diff_filespec *one)