grep: enable threading for context line printing

If context lines are to be printed, grep separates them with hunk marks
("--\n").  These marks are printed between matches from different files,
too.  They are not printed before the first file, though.

Threading was disabled when context line printing was enabled because
avoiding to print the mark before the first line was an unsolved
synchronisation problem.  This patch separates the code for printing
hunk marks for the threaded and the unthreaded case, allowing threading
to be turned on together with the common -ABC options.

->show_hunk_mark, which controls printing of hunk marks between files in
show_line(), is now set in grep_buffer_1(), but only if some results
have already been printed and threading is disabled.  The threaded case
is handled in work_done().

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