userdiff: fix HTML hunk header regexp
authorIlya Kantor <iliakan@gmail.com>
Sat, 23 Sep 2017 07:53:47 +0000 (10:53 +0300)
committerJunio C Hamano <gitster@pobox.com>
Sun, 24 Sep 2017 01:13:28 +0000 (10:13 +0900)
Current HTML header regexp doesn't match headers without attributes.

So it fails to match <h1>...</h1>, while <h1 class="smth">...</h1> matches.

Make attributes optional to fix this. The regexp is still far from
perfect, but now it at least handles the common case.

Signed-off-by: Ilya Kantor <iliakan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
userdiff.c
index 2125d6da26dbdc01f7397415ef1f67616e6f2a71..4a0e5202e489bc5254fa4c621ca470d362005748 100644 (file)
@@ -37,7 +37,7 @@ IPATTERN("fortran",
         "|//|\\*\\*|::|[/<>=]="),
 IPATTERN("fountain", "^((\\.[^.]|(int|ext|est|int\\.?/ext|i/e)[. ]).*)$",
         "[^ \t-]+"),
-PATTERNS("html", "^[ \t]*(<[Hh][1-6][ \t].*>.*)$",
+PATTERNS("html", "^[ \t]*(<[Hh][1-6]([ \t].*)?>.*)$",
         "[^<>= \t]+"),
 PATTERNS("java",
         "!^[ \t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\n"