Relative timestamps in git log

I noticed that I was looking at the kernel gitweb output at some point
rather than just do "git log", simply because I liked seeing the
simplified date-format, ie the "5 days ago" rather than a full date.

This adds infrastructure to do that for "git log" too. It does NOT add the
actual flag to enable it, though, so right now this patch is a no-op, but
it should now be easy to add a command line flag (and possibly a config
file option) to just turn on the "relative" date format.

The exact cut-off points when it switches from days to weeks etc are
totally arbitrary, but are picked somewhat to avoid the "1 weeks ago"
thing (by making it show "10 days ago" rather than "1 week", or "70
minutes ago" rather than "1 hour ago").

[jc: with minor fix and tweak around "month" and "week" area.]

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
4 files changed
tree: 0052b6cbadca2f1f1f6c0d2fbcb9e9aff4ff6f9f
  1. arm/
  2. compat/
  3. contrib/
  4. Documentation/
  5. gitweb/
  6. mozilla-sha1/
  7. ppc/
  8. t/
  9. templates/
  10. xdiff/
  11. .gitignore
  12. alloc.c
  13. base85.c
  14. blame.c
  15. blob.c
  16. blob.h
  17. builtin-add.c
  18. builtin-apply.c
  19. builtin-cat-file.c
  20. builtin-check-ref-format.c
  21. builtin-checkout-index.c
  22. builtin-commit-tree.c
  23. builtin-count-objects.c
  24. builtin-diff-files.c
  25. builtin-diff-index.c
  26. builtin-diff-stages.c
  27. builtin-diff-tree.c
  28. builtin-diff.c
  29. builtin-fmt-merge-msg.c
  30. builtin-grep.c
  31. builtin-init-db.c
  32. builtin-log.c
  33. builtin-ls-files.c
  34. builtin-ls-tree.c
  35. builtin-mailinfo.c
  36. builtin-mailsplit.c
  37. builtin-mv.c
  38. builtin-name-rev.c
  39. builtin-pack-objects.c
  40. builtin-prune-packed.c
  41. builtin-prune.c
  42. builtin-push.c
  43. builtin-read-tree.c
  44. builtin-repo-config.c
  45. builtin-rev-list.c
  46. builtin-rev-parse.c
  47. builtin-rm.c
  48. builtin-show-branch.c
  49. builtin-stripspace.c
  50. builtin-symbolic-ref.c
  51. builtin-tar-tree.c
  52. builtin-unpack-objects.c
  53. builtin-update-index.c
  54. builtin-update-ref.c
  55. builtin-upload-tar.c
  56. builtin-verify-pack.c
  57. builtin-write-tree.c
  58. builtin-zip-tree.c
  59. builtin.h
  60. cache-tree.c
  61. cache-tree.h
  62. cache.h
  63. check-racy.c
  64. combine-diff.c
  65. commit.c
  66. commit.h
  67. config.c
  68. config.mak.in
  69. configure.ac
  70. connect.c
  71. convert-objects.c
  72. copy.c
  73. COPYING
  74. csum-file.c
  75. csum-file.h
  76. ctype.c
  77. daemon.c
  78. date.c
  79. delta.h
  80. describe.c
  81. diff-delta.c
  82. diff-lib.c
  83. diff.c
  84. diff.h
  85. diffcore-break.c
  86. diffcore-delta.c
  87. diffcore-order.c
  88. diffcore-pickaxe.c
  89. diffcore-rename.c
  90. diffcore.h
  91. dir.c
  92. dir.h
  93. dump-cache-tree.c
  94. entry.c
  95. environment.c
  96. exec_cmd.c
  97. exec_cmd.h
  98. fetch-clone.c
  99. fetch-pack.c
  100. fetch.c
  101. fetch.h
  102. fsck-objects.c
  103. generate-cmdlist.sh
  104. git-am.sh
  105. git-annotate.perl
  106. git-applymbox.sh
  107. git-applypatch.sh
  108. git-archimport.perl
  109. git-bisect.sh
  110. git-branch.sh
  111. git-checkout.sh
  112. git-cherry.sh
  113. git-clean.sh
  114. git-clone.sh
  115. git-commit.sh
  116. git-compat-util.h
  117. git-cvsexportcommit.perl
  118. git-cvsimport.perl
  119. git-cvsserver.perl
  120. git-fetch.sh
  121. git-instaweb.sh
  122. git-lost-found.sh
  123. git-ls-remote.sh
  124. git-merge-octopus.sh
  125. git-merge-one-file.sh
  126. git-merge-ours.sh
  127. git-merge-recursive.py
  128. git-merge-resolve.sh
  129. git-merge-stupid.sh
  130. git-merge.sh
  131. git-p4import.py
  132. git-parse-remote.sh
  133. git-pull.sh
  134. git-quiltimport.sh
  135. git-rebase.sh
  136. git-relink.perl
  137. git-repack.sh
  138. git-request-pull.sh
  139. git-rerere.perl
  140. git-reset.sh
  141. git-resolve.sh
  142. git-revert.sh
  143. git-send-email.perl
  144. git-sh-setup.sh
  145. git-shortlog.perl
  146. git-svn.perl
  147. git-svnimport.perl
  148. git-tag.sh
  149. git-verify-tag.sh
  150. GIT-VERSION-GEN
  151. git.c
  152. git.spec.in
  153. gitk
  154. gitMergeCommon.py
  155. hash-object.c
  156. help.c
  157. http-fetch.c
  158. http-push.c
  159. http.c
  160. http.h
  161. ident.c
  162. imap-send.c
  163. index-pack.c
  164. INSTALL
  165. local-fetch.c
  166. lockfile.c
  167. log-tree.c
  168. log-tree.h
  169. Makefile
  170. merge-base.c
  171. merge-file.c
  172. merge-index.c
  173. merge-tree.c
  174. mktag.c
  175. mktree.c
  176. object-refs.c
  177. object.c
  178. object.h
  179. pack-check.c
  180. pack-redundant.c
  181. pack.h
  182. pager.c
  183. patch-delta.c
  184. patch-id.c
  185. path-list.c
  186. path-list.h
  187. path.c
  188. peek-remote.c
  189. pkt-line.c
  190. pkt-line.h
  191. quote.c
  192. quote.h
  193. read-cache.c
  194. README
  195. receive-pack.c
  196. refs.c
  197. refs.h
  198. revision.c
  199. revision.h
  200. rsh.c
  201. rsh.h
  202. run-command.c
  203. run-command.h
  204. send-pack.c
  205. server-info.c
  206. setup.c
  207. sha1_file.c
  208. sha1_name.c
  209. shell.c
  210. show-index.c
  211. ssh-fetch.c
  212. ssh-pull.c
  213. ssh-push.c
  214. ssh-upload.c
  215. strbuf.c
  216. strbuf.h
  217. tag.c
  218. tag.h
  219. tar.h
  220. test-date.c
  221. test-delta.c
  222. test-sha1.c
  223. test-sha1.sh
  224. tree-diff.c
  225. tree-walk.c
  226. tree-walk.h
  227. tree.c
  228. tree.h
  229. unpack-file.c
  230. unpack-trees.c
  231. unpack-trees.h
  232. update-server-info.c
  233. upload-pack.c
  234. usage.c
  235. var.c
  236. write_or_die.c
  237. xdiff-interface.c
  238. xdiff-interface.h