grep: --count over binary

The intent of showing the message "Binary file xyz matches" for
binary files is to avoid annoying users by potentially messing up
their terminals by printing control characters.  In --count mode,
this precaution isn't necessary.

Display counts of matches if -c/--count was specified, even if -a
was not given.  GNU grep does the same.

Moving the check for ->count before the code for handling binary
file also avoids printing context lines if --count and -[ABC] were
used together, so we can remove the part of the comment that
mentions this behaviour.  Again, GNU grep does the same.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 files changed
tree: 133faa3c35e830c55743a1f2b1066adb12ac367e
  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-cache.c
  161. notes-cache.h
  162. notes.c
  163. notes.h
  164. object.c
  165. object.h
  166. pack-check.c
  167. pack-refs.c
  168. pack-refs.h
  169. pack-revindex.c
  170. pack-revindex.h
  171. pack-write.c
  172. pack.h
  173. pager.c
  174. parse-options.c
  175. parse-options.h
  176. patch-delta.c
  177. patch-ids.c
  178. patch-ids.h
  179. path.c
  180. pkt-line.c
  181. pkt-line.h
  182. preload-index.c
  183. pretty.c
  184. progress.c
  185. progress.h
  186. quote.c
  187. quote.h
  188. reachable.c
  189. reachable.h
  190. read-cache.c
  191. README
  192. reflog-walk.c
  193. reflog-walk.h
  194. refs.c
  195. refs.h
  196. remote-curl.c
  197. remote.c
  198. remote.h
  199. replace_object.c
  200. rerere.c
  201. rerere.h
  202. resolve-undo.c
  203. resolve-undo.h
  204. revision.c
  205. revision.h
  206. run-command.c
  207. run-command.h
  208. send-pack.h
  209. server-info.c
  210. setup.c
  211. sha1-lookup.c
  212. sha1-lookup.h
  213. sha1_file.c
  214. sha1_name.c
  215. shallow.c
  216. shell.c
  217. shortlog.h
  218. show-index.c
  219. sideband.c
  220. sideband.h
  221. sigchain.c
  222. sigchain.h
  223. strbuf.c
  224. strbuf.h
  225. string-list.c
  226. string-list.h
  227. submodule.c
  228. submodule.h
  229. symlinks.c
  230. tag.c
  231. tag.h
  232. tar.h
  233. test-chmtime.c
  234. test-ctype.c
  235. test-date.c
  236. test-delta.c
  237. test-dump-cache-tree.c
  238. test-genrandom.c
  239. test-index-version.c
  240. test-match-trees.c
  241. test-parse-options.c
  242. test-path-utils.c
  243. test-run-command.c
  244. test-sha1.c
  245. test-sha1.sh
  246. test-sigchain.c
  247. thread-utils.c
  248. thread-utils.h
  249. trace.c
  250. transport-helper.c
  251. transport.c
  252. transport.h
  253. tree-diff.c
  254. tree-walk.c
  255. tree-walk.h
  256. tree.c
  257. tree.h
  258. unimplemented.sh
  259. unpack-trees.c
  260. unpack-trees.h
  261. upload-pack.c
  262. usage.c
  263. userdiff.c
  264. userdiff.h
  265. utf8.c
  266. utf8.h
  267. walker.c
  268. walker.h
  269. wrap-for-bin.sh
  270. wrapper.c
  271. write_or_die.c
  272. ws.c
  273. wt-status.c
  274. wt-status.h
  275. xdiff-interface.c
  276. xdiff-interface.h