Git fork

userdiff: expand detected chunk headers for css

The regex used for the CSS builtin diff driver in git is only
able to show chunk headers for lines that start with a number,
a letter or an underscore.

However, the regex fails to detect classes (starts with a .), ids
(starts with a #), :root and attribute-value based selectors (for
example [class*="col-"]), as well as @based block-level statements
like @page,@keyframes and @media since all of them, start with a
special character.

Allow the selectors and block level statements to begin with these
special characters.

Signed-off-by: Sohom Datta <sohom.datta@learner.manipal.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Sohom Datta and committed by
Junio C Hamano
ff01513f d98273ba

+27 -1
+4
t/t4018/css-attribute-value-selector
··· 1 + [class*="RIGHT"] { 2 + background : #000; 3 + border : 10px ChangeMe #C6C6C6; 4 + }
+10
t/t4018/css-block-level-@-statements
··· 1 + @keyframes RIGHT { 2 + from { 3 + background : #000; 4 + border : 10px ChangeMe #C6C6C6; 5 + } 6 + to { 7 + background : #fff; 8 + border : 10px solid #C6C6C6; 9 + } 10 + }
+4
t/t4018/css-class-selector
··· 1 + .RIGHT { 2 + background : #000; 3 + border : 10px ChangeMe #C6C6C6; 4 + }
+4
t/t4018/css-id-selector
··· 1 + #RIGHT { 2 + background : #000; 3 + border : 10px ChangeMe #C6C6C6; 4 + }
+4
t/t4018/css-root-selector
··· 1 + :RIGHT { 2 + background : #000; 3 + border : 10px ChangeMe #C6C6C6; 4 + }
+1 -1
userdiff.c
··· 200 200 "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"), 201 201 IPATTERN("css", 202 202 "![:;][[:space:]]*$\n" 203 - "^[_a-z0-9].*$", 203 + "^[:[@.#]?[_a-z0-9].*$", 204 204 /* -- */ 205 205 /* 206 206 * This regex comes from W3C CSS specs. Should theoretically also