Junio C Hamano [off-list ref] writes:
Neither has [4/4] on it. I'd like two patches so that:
* [PATCH 1/2] applies to bc/maint-diff-hunk-header-fix, so that the
languages in 1.6.0.2 are fixed for non GNU platforms;
* After applying [1/2] to bc/maint-diff-hunk-header-fix, I'll merge the
branch to bc/master-diff-hunk-header-fix and then...
* [PATCH 2/2] applies on top of it to convert new languages that are
supported only on 'master' to use xfuncname.
If you apply the previous one on top of 45d9414 (diff.*.xfuncname which
uses "extended" regex's for hunk header selection, 2008-09-18), and then
merge the result to dde4af4 (Merge branch 'bc/maint-diff-hunk-header-fix'
into bc/master-diff-hunk-header-fix, 2008-09-18), you will get some
trivial conflicts. This patch is [2/2] that applies on top of that merge,
and should result in this:
static const struct funcname_pattern_entry builtin_funcname_pattern[] = {
{ "bibtex", "(@[a-zA-Z]{1,}[ \t]*\{{0,1}[ \t]*[^ \t\"@',\\#}{~%]*).*$",
REG_EXTENDED },
{ "html", "^[ \t]*(<[Hh][1-6][ \t].*>.*)$", REG_EXTENDED },
{ "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 },
{ "php", "^[\t ]*((function|class).*)", REG_EXTENDED },
{ "python", "^[ \t]*((class|def)[ \t].*)$", REG_EXTENDED },
{ "ruby", "^[ \t]*((class|module|def)[ \t].*)$",
REG_EXTENDED },
{ "tex",
"^(\\\\((sub)*section|chapter|part)\\*{0,1}\{.*)$",
REG_EXTENDED },
};
-- >8 --
Subject: [PATCH] diff: use extended regexp to find hunk headers
Using ERE elements such as "|" (alternation) by backquoting in BRE
is a GNU extension and should not be done in portable programs.
Signed-off-by: Junio C Hamano <redacted>
---
diff.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/diff.c b/diff.c
index 5b9b074..a733010 100644
--- a/diff.c
+++ b/diff.c
@@ -1406,7 +1406,7 @@ static const struct funcname_pattern_entry *funcname_pattern(const char *ident)
static const struct funcname_pattern_entry builtin_funcname_pattern[] = {
{ "bibtex", "(@[a-zA-Z]{1,}[ \t]*\{{0,1}[ \t]*[^ \t\"@',\\#}{~%]*).*$",
REG_EXTENDED },
- { "html", "^\\s*\\(<[Hh][1-6]\\s.*>.*\\)$", 0 },
+ { "html", "^[ \t]*(<[Hh][1-6][ \t].*>.*)$", REG_EXTENDED },
{ "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]*\\([^;]*)$",@@ -1417,8 +1417,8 @@ static const struct funcname_pattern_entry builtin_funcname_pattern[] = {
"|"
"^(.*=[ \t]*(class|record).*)$",
REG_EXTENDED },
- { "php", "^[\t ]*\\(\\(function\\|class\\).*\\)", 0 },
- { "python", "^\\s*\\(\\(class\\|def\\)\\s.*\\)$", 0 },
+ { "php", "^[\t ]*((function|class).*)", REG_EXTENDED },
+ { "python", "^[ \t]*((class|def)[ \t].*)$", REG_EXTENDED },
{ "ruby", "^[ \t]*((class|module|def)[ \t].*)$",
REG_EXTENDED },
{ "tex",--
1.6.0.2.414.g0bf11