diff --stat: use less columns for change counts

Number of columns required for change counts is now computed based on
the maximum number of changed lines instead of being fixed. This means
that usually a few more columns will be available for the filenames
and the graph.

The graph width logic is also modified to include enough space for
"Bin XXX -> YYY bytes".

If changes to binary files are mixed with changes to text files,
change counts are padded to take at least three columns. And the other
way around, if change counts require more than three columns, then
"Bin"s are padded to align with the change count. This way, the +-
part starts in the same column as "XXX -> YYY" part for binary files.
This makes the graph easier to parse visually thanks to the empty
column. This mimics the layout of diff --stat before this change.

Tests and the tutorial are updated to reflect the new --stat output.
This means either the removal of extra padding and/or the addition of
up to three extra characters to truncated filenames. One test is added
to check the graph alignment when a binary file change and text file
change of more than 999 lines are committed together.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
77 files changed
tree: aa5744558443d820f50be10bb17c7aa63e57e492
  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-p4.py
  128. git-parse-remote.sh
  129. git-pull.sh
  130. git-quiltimport.sh
  131. git-rebase--am.sh
  132. git-rebase--interactive.sh
  133. git-rebase--merge.sh
  134. git-rebase.sh
  135. git-relink.perl
  136. git-remote-testgit.py
  137. git-repack.sh
  138. git-request-pull.sh
  139. git-send-email.perl
  140. git-sh-i18n.sh
  141. git-sh-setup.sh
  142. git-stash.sh
  143. git-submodule.sh
  144. git-svn.perl
  145. GIT-VERSION-GEN
  146. git-web--browse.sh
  147. git.c
  148. git.spec.in
  149. gpg-interface.c
  150. gpg-interface.h
  151. graph.c
  152. graph.h
  153. grep.c
  154. grep.h
  155. hash.c
  156. hash.h
  157. help.c
  158. help.h
  159. hex.c
  160. http-backend.c
  161. http-fetch.c
  162. http-push.c
  163. http-walker.c
  164. http.c
  165. http.h
  166. ident.c
  167. imap-send.c
  168. INSTALL
  169. kwset.c
  170. kwset.h
  171. levenshtein.c
  172. levenshtein.h
  173. LGPL-2.1
  174. list-objects.c
  175. list-objects.h
  176. ll-merge.c
  177. ll-merge.h
  178. lockfile.c
  179. log-tree.c
  180. log-tree.h
  181. mailmap.c
  182. mailmap.h
  183. Makefile
  184. match-trees.c
  185. merge-file.c
  186. merge-file.h
  187. merge-recursive.c
  188. merge-recursive.h
  189. mergesort.c
  190. mergesort.h
  191. name-hash.c
  192. notes-cache.c
  193. notes-cache.h
  194. notes-merge.c
  195. notes-merge.h
  196. notes.c
  197. notes.h
  198. object.c
  199. object.h
  200. pack-check.c
  201. pack-refs.c
  202. pack-refs.h
  203. pack-revindex.c
  204. pack-revindex.h
  205. pack-write.c
  206. pack.h
  207. pager.c
  208. parse-options-cb.c
  209. parse-options.c
  210. parse-options.h
  211. patch-delta.c
  212. patch-ids.c
  213. patch-ids.h
  214. path.c
  215. pkt-line.c
  216. pkt-line.h
  217. preload-index.c
  218. pretty.c
  219. progress.c
  220. progress.h
  221. prompt.c
  222. prompt.h
  223. quote.c
  224. quote.h
  225. reachable.c
  226. reachable.h
  227. read-cache.c
  228. README
  229. reflog-walk.c
  230. reflog-walk.h
  231. refs.c
  232. refs.h
  233. remote-curl.c
  234. remote.c
  235. remote.h
  236. replace_object.c
  237. rerere.c
  238. rerere.h
  239. resolve-undo.c
  240. resolve-undo.h
  241. revision.c
  242. revision.h
  243. run-command.c
  244. run-command.h
  245. send-pack.h
  246. sequencer.c
  247. sequencer.h
  248. server-info.c
  249. setup.c
  250. sh-i18n--envsubst.c
  251. sha1-array.c
  252. sha1-array.h
  253. sha1-lookup.c
  254. sha1-lookup.h
  255. sha1_file.c
  256. sha1_name.c
  257. shallow.c
  258. shell.c
  259. shortlog.h
  260. show-index.c
  261. sideband.c
  262. sideband.h
  263. sigchain.c
  264. sigchain.h
  265. strbuf.c
  266. strbuf.h
  267. streaming.c
  268. streaming.h
  269. string-list.c
  270. string-list.h
  271. submodule.c
  272. submodule.h
  273. symlinks.c
  274. tag.c
  275. tag.h
  276. tar.h
  277. test-chmtime.c
  278. test-credential.c
  279. test-ctype.c
  280. test-date.c
  281. test-delta.c
  282. test-dump-cache-tree.c
  283. test-genrandom.c
  284. test-index-version.c
  285. test-line-buffer.c
  286. test-match-trees.c
  287. test-mergesort.c
  288. test-mktemp.c
  289. test-parse-options.c
  290. test-path-utils.c
  291. test-revision-walking.c
  292. test-run-command.c
  293. test-scrap-cache-tree.c
  294. test-sha1.c
  295. test-sha1.sh
  296. test-sigchain.c
  297. test-subprocess.c
  298. test-svn-fe.c
  299. thread-utils.c
  300. thread-utils.h
  301. trace.c
  302. transport-helper.c
  303. transport.c
  304. transport.h
  305. tree-diff.c
  306. tree-walk.c
  307. tree-walk.h
  308. tree.c
  309. tree.h
  310. unimplemented.sh
  311. unix-socket.c
  312. unix-socket.h
  313. unpack-trees.c
  314. unpack-trees.h
  315. upload-pack.c
  316. url.c
  317. url.h
  318. usage.c
  319. userdiff.c
  320. userdiff.h
  321. utf8.c
  322. utf8.h
  323. walker.c
  324. walker.h
  325. wrap-for-bin.sh
  326. wrapper.c
  327. write_or_die.c
  328. ws.c
  329. wt-status.c
  330. wt-status.h
  331. xdiff-interface.c
  332. xdiff-interface.h
  333. zlib.c