Commit 20a864c
gitweb: Refactor diff body line classification
Simplify classification of diff line body in format_diff_line(),
replacing two long if-elsif chains (one for ordinary diff and one for
combined diff of a merge commit) with a single regexp match. Refactor
this code into diff_line_class() function.
While at it:
* Fix an artifact in that $diff_class included leading space to be
able to compose classes like this "class=\"diff$diff_class\"', even
when $diff_class was an empty string. This made code unnecessary
ugly: $diff_class is now just class name or an empty string.
* Introduce "ctx" class for context lines ($diff_class was set to ""
in this case before this commit).
Idea and initial code by Junio C Hamano, polish and testing by Jakub
Narebski. Inspired by patch adding side-by-side diff by Kato Kazuyoshi,
which required $diff_class to be name of class without extra space.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent be3fa91 commit 20a864c
1 file changed
+37
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2225 | 2225 | | |
2226 | 2226 | | |
2227 | 2227 | | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
2228 | 2257 | | |
2229 | 2258 | | |
2230 | 2259 | | |
2231 | 2260 | | |
2232 | | - | |
2233 | 2261 | | |
2234 | | - | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
2235 | 2265 | | |
2236 | | - | |
2237 | | - | |
2238 | | - | |
2239 | | - | |
2240 | | - | |
2241 | | - | |
2242 | | - | |
2243 | | - | |
2244 | | - | |
2245 | | - | |
2246 | | - | |
2247 | | - | |
2248 | | - | |
2249 | | - | |
2250 | | - | |
2251 | | - | |
2252 | | - | |
2253 | | - | |
2254 | | - | |
2255 | | - | |
2256 | | - | |
2257 | | - | |
2258 | | - | |
2259 | | - | |
2260 | | - | |
| 2266 | + | |
2261 | 2267 | | |
| 2268 | + | |
2262 | 2269 | | |
2263 | 2270 | | |
2264 | 2271 | | |
| |||
2276 | 2283 | | |
2277 | 2284 | | |
2278 | 2285 | | |
2279 | | - | |
| 2286 | + | |
2280 | 2287 | | |
2281 | 2288 | | |
2282 | 2289 | | |
| |||
2309 | 2316 | | |
2310 | 2317 | | |
2311 | 2318 | | |
2312 | | - | |
| 2319 | + | |
2313 | 2320 | | |
2314 | | - | |
| 2321 | + | |
2315 | 2322 | | |
2316 | 2323 | | |
2317 | 2324 | | |
| |||
0 commit comments