git config --get-colorbool

This adds an option to help scripts find out color settings from
the configuration file.

    git config --get-colorbool color.diff

inspects color.diff variable, and exits with status 0 (i.e. success) if
color is to be used.  It exits with status 1 otherwise.

If a script wants "true"/"false" answer to the standard output of the
command, it can pass an additional boolean parameter to its command
line, telling if its standard output is a terminal, like this:

    git config --get-colorbool color.diff true

When called like this, the command outputs "true" to its standard output
if color is to be used (i.e. "color.diff" says "always", "auto", or
"true"), and "false" otherwise.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 files changed
tree: ee37c3b7e05ff21f223508ce71ff3cc3f862f32e
  1. arm/
  2. compat/
  3. contrib/
  4. Documentation/
  5. git-gui/
  6. gitk-git/
  7. gitweb/
  8. mozilla-sha1/
  9. perl/
  10. ppc/
  11. t/
  12. templates/
  13. xdiff/
  14. .gitignore
  15. .mailmap
  16. alloc.c
  17. archive-tar.c
  18. archive-zip.c
  19. archive.h
  20. attr.c
  21. attr.h
  22. base85.c
  23. blob.c
  24. blob.h
  25. builtin-add.c
  26. builtin-annotate.c
  27. builtin-apply.c
  28. builtin-archive.c
  29. builtin-blame.c
  30. builtin-branch.c
  31. builtin-bundle.c
  32. builtin-cat-file.c
  33. builtin-check-attr.c
  34. builtin-check-ref-format.c
  35. builtin-checkout-index.c
  36. builtin-clean.c
  37. builtin-commit-tree.c
  38. builtin-commit.c
  39. builtin-config.c
  40. builtin-count-objects.c
  41. builtin-describe.c
  42. builtin-diff-files.c
  43. builtin-diff-index.c
  44. builtin-diff-tree.c
  45. builtin-diff.c
  46. builtin-fast-export.c
  47. builtin-fetch--tool.c
  48. builtin-fetch-pack.c
  49. builtin-fetch.c
  50. builtin-fmt-merge-msg.c
  51. builtin-for-each-ref.c
  52. builtin-fsck.c
  53. builtin-gc.c
  54. builtin-grep.c
  55. builtin-http-fetch.c
  56. builtin-init-db.c
  57. builtin-log.c
  58. builtin-ls-files.c
  59. builtin-ls-remote.c
  60. builtin-ls-tree.c
  61. builtin-mailinfo.c
  62. builtin-mailsplit.c
  63. builtin-merge-base.c
  64. builtin-merge-file.c
  65. builtin-merge-ours.c
  66. builtin-mv.c
  67. builtin-name-rev.c
  68. builtin-pack-objects.c
  69. builtin-pack-refs.c
  70. builtin-prune-packed.c
  71. builtin-prune.c
  72. builtin-push.c
  73. builtin-read-tree.c
  74. builtin-reflog.c
  75. builtin-rerere.c
  76. builtin-reset.c
  77. builtin-rev-list.c
  78. builtin-rev-parse.c
  79. builtin-revert.c
  80. builtin-rm.c
  81. builtin-runstatus.c
  82. builtin-send-pack.c
  83. builtin-shortlog.c
  84. builtin-show-branch.c
  85. builtin-show-ref.c
  86. builtin-stripspace.c
  87. builtin-symbolic-ref.c
  88. builtin-tag.c
  89. builtin-tar-tree.c
  90. builtin-unpack-objects.c
  91. builtin-update-index.c
  92. builtin-update-ref.c
  93. builtin-upload-archive.c
  94. builtin-verify-pack.c
  95. builtin-verify-tag.c
  96. builtin-write-tree.c
  97. builtin.h
  98. bundle.c
  99. bundle.h
  100. cache-tree.c
  101. cache-tree.h
  102. cache.h
  103. check-builtins.sh
  104. check-racy.c
  105. color.c
  106. color.h
  107. combine-diff.c
  108. command-list.txt
  109. commit.c
  110. commit.h
  111. config.c
  112. config.mak.in
  113. configure.ac
  114. connect.c
  115. convert.c
  116. copy.c
  117. COPYING
  118. csum-file.c
  119. csum-file.h
  120. ctype.c
  121. daemon.c
  122. date.c
  123. decorate.c
  124. decorate.h
  125. delta.h
  126. diff-delta.c
  127. diff-lib.c
  128. diff.c
  129. diff.h
  130. diffcore-break.c
  131. diffcore-delta.c
  132. diffcore-order.c
  133. diffcore-pickaxe.c
  134. diffcore-rename.c
  135. diffcore.h
  136. dir.c
  137. dir.h
  138. dump-cache-tree.c
  139. entry.c
  140. environment.c
  141. exec_cmd.c
  142. exec_cmd.h
  143. fast-import.c
  144. fetch-pack.h
  145. fixup-builtins
  146. generate-cmdlist.sh
  147. git-add--interactive.perl
  148. git-am.sh
  149. git-archimport.perl
  150. git-bisect.sh
  151. git-checkout.sh
  152. git-clone.sh
  153. git-compat-util.h
  154. git-cvsexportcommit.perl
  155. git-cvsimport.perl
  156. git-cvsserver.perl
  157. git-filter-branch.sh
  158. git-instaweb.sh
  159. git-lost-found.sh
  160. git-merge-octopus.sh
  161. git-merge-one-file.sh
  162. git-merge-resolve.sh
  163. git-merge-stupid.sh
  164. git-merge.sh
  165. git-mergetool.sh
  166. git-parse-remote.sh
  167. git-pull.sh
  168. git-quiltimport.sh
  169. git-rebase--interactive.sh
  170. git-rebase.sh
  171. git-relink.perl
  172. git-remote.perl
  173. git-repack.sh
  174. git-request-pull.sh
  175. git-send-email.perl
  176. git-sh-setup.sh
  177. git-stash.sh
  178. git-submodule.sh
  179. git-svn.perl
  180. GIT-VERSION-GEN
  181. git.c
  182. git.spec.in
  183. grep.c
  184. grep.h
  185. hash-object.c
  186. hash.c
  187. hash.h
  188. help.c
  189. http-push.c
  190. http-walker.c
  191. http.c
  192. http.h
  193. ident.c
  194. imap-send.c
  195. index-pack.c
  196. INSTALL
  197. interpolate.c
  198. interpolate.h
  199. list-objects.c
  200. list-objects.h
  201. lockfile.c
  202. log-tree.c
  203. log-tree.h
  204. mailmap.c
  205. mailmap.h
  206. Makefile
  207. match-trees.c
  208. merge-file.c
  209. merge-index.c
  210. merge-recursive.c
  211. merge-tree.c
  212. mktag.c
  213. mktree.c
  214. object-refs.c
  215. object.c
  216. object.h
  217. pack-check.c
  218. pack-redundant.c
  219. pack-write.c
  220. pack.h
  221. pager.c
  222. parse-options.c
  223. parse-options.h
  224. patch-delta.c
  225. patch-id.c
  226. patch-ids.c
  227. patch-ids.h
  228. path-list.c
  229. path-list.h
  230. path.c
  231. pkt-line.c
  232. pkt-line.h
  233. pretty.c
  234. progress.c
  235. progress.h
  236. quote.c
  237. quote.h
  238. reachable.c
  239. reachable.h
  240. read-cache.c
  241. README
  242. receive-pack.c
  243. reflog-walk.c
  244. reflog-walk.h
  245. refs.c
  246. refs.h
  247. remote.c
  248. remote.h
  249. revision.c
  250. revision.h
  251. run-command.c
  252. run-command.h
  253. send-pack.h
  254. server-info.c
  255. setup.c
  256. sha1_file.c
  257. sha1_name.c
  258. shallow.c
  259. shell.c
  260. show-index.c
  261. sideband.c
  262. sideband.h
  263. strbuf.c
  264. strbuf.h
  265. symlinks.c
  266. tag.c
  267. tag.h
  268. tar.h
  269. test-absolute-path.c
  270. test-chmtime.c
  271. test-date.c
  272. test-delta.c
  273. test-genrandom.c
  274. test-match-trees.c
  275. test-parse-options.c
  276. test-sha1.c
  277. test-sha1.sh
  278. trace.c
  279. transport.c
  280. transport.h
  281. tree-diff.c
  282. tree-walk.c
  283. tree-walk.h
  284. tree.c
  285. tree.h
  286. unpack-file.c
  287. unpack-trees.c
  288. unpack-trees.h
  289. update-server-info.c
  290. upload-pack.c
  291. usage.c
  292. utf8.c
  293. utf8.h
  294. var.c
  295. walker.c
  296. walker.h
  297. write_or_die.c
  298. wt-status.c
  299. wt-status.h
  300. xdiff-interface.c
  301. xdiff-interface.h