commit: show interesting ident information in summary

There are a few cases of user identity information that we consider
interesting:

  (1) When the author and committer identities do not match.

  (2) When the committer identity was picked automatically from the
      username, hostname and GECOS information.

In these cases, we already show the information in the commit
message template. However, users do not always see that template
because they might use "-m" or "-F". With this patch, we show these
interesting cases after the commit, along with the subject and
change summary. The new output looks like:

  $ git commit \
      -m "federalist papers" \
      --author='Publius <alexander@hamilton.com>'
  [master 3d226a7] federalist papers
   Author: Publius <alexander@hamilton.com>
   1 files changed, 1 insertions(+), 0 deletions(-)

for case (1), and:

  $ git config --global --unset user.name
  $ git config --global --unset user.email
  $ git commit -m foo
  [master 7c2a927] foo
   Committer: Jeff King <peff@c-71-185-130-222.hsd1.va.comcast.net>
  Your name and email address were configured automatically based
  on your username and hostname. Please check that they are accurate.
  You can suppress this message by setting them explicitly:

      git config --global user.name Your Name
      git config --global user.email you@example.com

  If the identity used for this commit is wrong, you can fix it with:

      git commit --amend --author='Your Name <you@example.com>'

   1 files changed, 1 insertions(+), 0 deletions(-)

for case (2).

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