gitweb: Refinement highlightning in combined diffs

The highlightning of combined diffs is currently disabled.  This is
because output from a combined diff is much harder to highlight because
it is not obvious which removed and added lines should be compared.

Current code requires that the number of added lines is equal to the
number of removed lines and only skips first +/- character, treating
second +/- as a line content, Thus, it is not possible to simply use
existing algorithm unchanged for combined diffs.

Let's start with a simple case: only highlight changes that come from
one parent, i.e. when every removed line has a corresponding added line
for the same parent.  This way the highlightning cannot get wrong. For
example, following diffs would be highlighted:

	- removed line for first parent
	+ added line for first parent
	  context line
	 -removed line for second parent
	 +added line for second parent

or

	- removed line for first parent
	 -removed line for second parent
	+ added line for first parent
	 +added line for second parent

but following output will not:

	- removed line for first parent
	 -removed line for second parent
	 +added line for second parent
	++added line for both parents

In other words, we require that pattern of '-'-es in pre-image matches
pattern of '+'-es in post-image.

Further changes may introduce more intelligent approach that better
handles combined diffs.

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Acked-by: Jakub Narębski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 file changed
tree: aeeca17d955decf2b0b20cbf8741192e378dbe9e
  1. block-sha1/
  2. builtin/
  3. compat/
  4. contrib/
  5. Documentation/
  6. git-gui/
  7. git_remote_helpers/
  8. gitk-git/
  9. gitweb/
  10. mergetools/
  11. perl/
  12. po/
  13. ppc/
  14. t/
  15. templates/
  16. vcs-svn/
  17. xdiff/
  18. .gitattributes
  19. .gitignore
  20. .mailmap
  21. abspath.c
  22. aclocal.m4
  23. advice.c
  24. advice.h
  25. alias.c
  26. alloc.c
  27. archive-tar.c
  28. archive-zip.c
  29. archive.c
  30. archive.h
  31. argv-array.c
  32. argv-array.h
  33. attr.c
  34. attr.h
  35. base85.c
  36. bisect.c
  37. bisect.h
  38. blob.c
  39. blob.h
  40. branch.c
  41. branch.h
  42. builtin.h
  43. bulk-checkin.c
  44. bulk-checkin.h
  45. bundle.c
  46. bundle.h
  47. cache-tree.c
  48. cache-tree.h
  49. cache.h
  50. check-builtins.sh
  51. check-racy.c
  52. check_bindir
  53. color.c
  54. color.h
  55. combine-diff.c
  56. command-list.txt
  57. commit.c
  58. commit.h
  59. config.c
  60. config.mak.in
  61. configure.ac
  62. connect.c
  63. connected.c
  64. connected.h
  65. convert.c
  66. convert.h
  67. copy.c
  68. COPYING
  69. credential-cache--daemon.c
  70. credential-cache.c
  71. credential-store.c
  72. credential.c
  73. credential.h
  74. csum-file.c
  75. csum-file.h
  76. ctype.c
  77. daemon.c
  78. date.c
  79. decorate.c
  80. decorate.h
  81. delta.h
  82. diff-delta.c
  83. diff-lib.c
  84. diff-no-index.c
  85. diff.c
  86. diff.h
  87. diffcore-break.c
  88. diffcore-delta.c
  89. diffcore-order.c
  90. diffcore-pickaxe.c
  91. diffcore-rename.c
  92. diffcore.h
  93. dir.c
  94. dir.h
  95. editor.c
  96. entry.c
  97. environment.c
  98. exec_cmd.c
  99. exec_cmd.h
  100. fast-import.c
  101. fetch-pack.h
  102. fixup-builtins
  103. fmt-merge-msg.h
  104. fsck.c
  105. fsck.h
  106. generate-cmdlist.sh
  107. gettext.c
  108. gettext.h
  109. git-add--interactive.perl
  110. git-am.sh
  111. git-archimport.perl
  112. git-bisect.sh
  113. git-compat-util.h
  114. git-cvsexportcommit.perl
  115. git-cvsimport.perl
  116. git-cvsserver.perl
  117. git-difftool--helper.sh
  118. git-difftool.perl
  119. git-filter-branch.sh
  120. git-instaweb.sh
  121. git-lost-found.sh
  122. git-merge-octopus.sh
  123. git-merge-one-file.sh
  124. git-merge-resolve.sh
  125. git-mergetool--lib.sh
  126. git-mergetool.sh
  127. git-parse-remote.sh
  128. git-pull.sh
  129. git-quiltimport.sh
  130. git-rebase--am.sh
  131. git-rebase--interactive.sh
  132. git-rebase--merge.sh
  133. git-rebase.sh
  134. git-relink.perl
  135. git-remote-testgit.py
  136. git-repack.sh
  137. git-request-pull.sh
  138. git-send-email.perl
  139. git-sh-i18n.sh
  140. git-sh-setup.sh
  141. git-stash.sh
  142. git-submodule.sh
  143. git-svn.perl
  144. GIT-VERSION-GEN
  145. git-web--browse.sh
  146. git.c
  147. git.spec.in
  148. gpg-interface.c
  149. gpg-interface.h
  150. graph.c
  151. graph.h
  152. grep.c
  153. grep.h
  154. hash.c
  155. hash.h
  156. help.c
  157. help.h
  158. hex.c
  159. http-backend.c
  160. http-fetch.c
  161. http-push.c
  162. http-walker.c
  163. http.c
  164. http.h
  165. ident.c
  166. imap-send.c
  167. INSTALL
  168. kwset.c
  169. kwset.h
  170. levenshtein.c
  171. levenshtein.h
  172. LGPL-2.1
  173. list-objects.c
  174. list-objects.h
  175. ll-merge.c
  176. ll-merge.h
  177. lockfile.c
  178. log-tree.c
  179. log-tree.h
  180. mailmap.c
  181. mailmap.h
  182. Makefile
  183. match-trees.c
  184. merge-file.c
  185. merge-file.h
  186. merge-recursive.c
  187. merge-recursive.h
  188. name-hash.c
  189. notes-cache.c
  190. notes-cache.h
  191. notes-merge.c
  192. notes-merge.h
  193. notes.c
  194. notes.h
  195. object.c
  196. object.h
  197. pack-check.c
  198. pack-refs.c
  199. pack-refs.h
  200. pack-revindex.c
  201. pack-revindex.h
  202. pack-write.c
  203. pack.h
  204. pager.c
  205. parse-options-cb.c
  206. parse-options.c
  207. parse-options.h
  208. patch-delta.c
  209. patch-ids.c
  210. patch-ids.h
  211. path.c
  212. pkt-line.c
  213. pkt-line.h
  214. preload-index.c
  215. pretty.c
  216. progress.c
  217. progress.h
  218. prompt.c
  219. prompt.h
  220. quote.c
  221. quote.h
  222. reachable.c
  223. reachable.h
  224. read-cache.c
  225. README
  226. reflog-walk.c
  227. reflog-walk.h
  228. refs.c
  229. refs.h
  230. remote-curl.c
  231. remote.c
  232. remote.h
  233. replace_object.c
  234. rerere.c
  235. rerere.h
  236. resolve-undo.c
  237. resolve-undo.h
  238. revision.c
  239. revision.h
  240. run-command.c
  241. run-command.h
  242. send-pack.h
  243. sequencer.c
  244. sequencer.h
  245. server-info.c
  246. setup.c
  247. sh-i18n--envsubst.c
  248. sha1-array.c
  249. sha1-array.h
  250. sha1-lookup.c
  251. sha1-lookup.h
  252. sha1_file.c
  253. sha1_name.c
  254. shallow.c
  255. shell.c
  256. shortlog.h
  257. show-index.c
  258. sideband.c
  259. sideband.h
  260. sigchain.c
  261. sigchain.h
  262. strbuf.c
  263. strbuf.h
  264. streaming.c
  265. streaming.h
  266. string-list.c
  267. string-list.h
  268. submodule.c
  269. submodule.h
  270. symlinks.c
  271. tag.c
  272. tag.h
  273. tar.h
  274. test-chmtime.c
  275. test-credential.c
  276. test-ctype.c
  277. test-date.c
  278. test-delta.c
  279. test-dump-cache-tree.c
  280. test-genrandom.c
  281. test-index-version.c
  282. test-line-buffer.c
  283. test-match-trees.c
  284. test-mktemp.c
  285. test-parse-options.c
  286. test-path-utils.c
  287. test-run-command.c
  288. test-scrap-cache-tree.c
  289. test-sha1.c
  290. test-sha1.sh
  291. test-sigchain.c
  292. test-subprocess.c
  293. test-svn-fe.c
  294. thread-utils.c
  295. thread-utils.h
  296. trace.c
  297. transport-helper.c
  298. transport.c
  299. transport.h
  300. tree-diff.c
  301. tree-walk.c
  302. tree-walk.h
  303. tree.c
  304. tree.h
  305. unimplemented.sh
  306. unix-socket.c
  307. unix-socket.h
  308. unpack-trees.c
  309. unpack-trees.h
  310. upload-pack.c
  311. url.c
  312. url.h
  313. usage.c
  314. userdiff.c
  315. userdiff.h
  316. utf8.c
  317. utf8.h
  318. walker.c
  319. walker.h
  320. wrap-for-bin.sh
  321. wrapper.c
  322. write_or_die.c
  323. ws.c
  324. wt-status.c
  325. wt-status.h
  326. xdiff-interface.c
  327. xdiff-interface.h
  328. zlib.c