format-patch: print in-body "From" only when needed

Commit a908047 taught format-patch the "--from" option,
which places the author ident into an in-body from header,
and uses the committer ident in the rfc822 from header.  The
documentation claims that it will omit the in-body header
when it is the same as the rfc822 header, but the code never
implemented that behavior.

This patch completes the feature by comparing the two idents
and doing nothing when they are the same (this is the same
as simply omitting the in-body header, as the two are by
definition indistinguishable in this case). This makes it
reasonable to turn on "--from" all the time (if it matches
your particular workflow), rather than only using it when
exporting other people's patches.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 files changed
tree: d05ea629e93ae982f0bb6941e5c052a8b4f9f348
  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. column.c
  56. column.h
  57. combine-diff.c
  58. command-list.txt
  59. commit-slab.h
  60. commit.c
  61. commit.h
  62. config.c
  63. config.mak.in
  64. config.mak.uname
  65. configure.ac
  66. connect.c
  67. connected.c
  68. connected.h
  69. convert.c
  70. convert.h
  71. copy.c
  72. COPYING
  73. credential-cache--daemon.c
  74. credential-cache.c
  75. credential-store.c
  76. credential.c
  77. credential.h
  78. csum-file.c
  79. csum-file.h
  80. ctype.c
  81. daemon.c
  82. date.c
  83. decorate.c
  84. decorate.h
  85. delta.h
  86. diff-delta.c
  87. diff-lib.c
  88. diff-no-index.c
  89. diff.c
  90. diff.h
  91. diffcore-break.c
  92. diffcore-delta.c
  93. diffcore-order.c
  94. diffcore-pickaxe.c
  95. diffcore-rename.c
  96. diffcore.h
  97. dir.c
  98. dir.h
  99. editor.c
  100. entry.c
  101. environment.c
  102. exec_cmd.c
  103. exec_cmd.h
  104. fast-import.c
  105. fetch-pack.c
  106. fetch-pack.h
  107. fixup-builtins
  108. fmt-merge-msg.h
  109. fsck.c
  110. fsck.h
  111. generate-cmdlist.sh
  112. gettext.c
  113. gettext.h
  114. git-add--interactive.perl
  115. git-am.sh
  116. git-archimport.perl
  117. git-bisect.sh
  118. git-compat-util.h
  119. git-cvsexportcommit.perl
  120. git-cvsimport.perl
  121. git-cvsserver.perl
  122. git-difftool--helper.sh
  123. git-difftool.perl
  124. git-filter-branch.sh
  125. git-instaweb.sh
  126. git-lost-found.sh
  127. git-merge-octopus.sh
  128. git-merge-one-file.sh
  129. git-merge-resolve.sh
  130. git-mergetool--lib.sh
  131. git-mergetool.sh
  132. git-p4.py
  133. git-parse-remote.sh
  134. git-pull.sh
  135. git-quiltimport.sh
  136. git-rebase--am.sh
  137. git-rebase--interactive.sh
  138. git-rebase--merge.sh
  139. git-rebase.sh
  140. git-relink.perl
  141. git-remote-testgit.sh
  142. git-remote-testpy.py
  143. git-repack.sh
  144. git-request-pull.sh
  145. git-send-email.perl
  146. git-sh-i18n.sh
  147. git-sh-setup.sh
  148. git-stash.sh
  149. git-submodule.sh
  150. git-svn.perl
  151. GIT-VERSION-GEN
  152. git-web--browse.sh
  153. git.c
  154. git.rc
  155. git.spec.in
  156. gpg-interface.c
  157. gpg-interface.h
  158. graph.c
  159. graph.h
  160. grep.c
  161. grep.h
  162. hash.c
  163. hash.h
  164. help.c
  165. help.h
  166. hex.c
  167. http-backend.c
  168. http-fetch.c
  169. http-push.c
  170. http-walker.c
  171. http.c
  172. http.h
  173. ident.c
  174. imap-send.c
  175. INSTALL
  176. kwset.c
  177. kwset.h
  178. levenshtein.c
  179. levenshtein.h
  180. LGPL-2.1
  181. line-log.c
  182. line-log.h
  183. line-range.c
  184. line-range.h
  185. list-objects.c
  186. list-objects.h
  187. ll-merge.c
  188. ll-merge.h
  189. lockfile.c
  190. log-tree.c
  191. log-tree.h
  192. mailmap.c
  193. mailmap.h
  194. Makefile
  195. match-trees.c
  196. merge-blobs.c
  197. merge-blobs.h
  198. merge-recursive.c
  199. merge-recursive.h
  200. merge.c
  201. mergesort.c
  202. mergesort.h
  203. name-hash.c
  204. notes-cache.c
  205. notes-cache.h
  206. notes-merge.c
  207. notes-merge.h
  208. notes-utils.c
  209. notes-utils.h
  210. notes.c
  211. notes.h
  212. object.c
  213. object.h
  214. pack-check.c
  215. pack-revindex.c
  216. pack-revindex.h
  217. pack-write.c
  218. pack.h
  219. pager.c
  220. parse-options-cb.c
  221. parse-options.c
  222. parse-options.h
  223. patch-delta.c
  224. patch-ids.c
  225. patch-ids.h
  226. path.c
  227. pathspec.c
  228. pathspec.h
  229. pkt-line.c
  230. pkt-line.h
  231. preload-index.c
  232. pretty.c
  233. prio-queue.c
  234. prio-queue.h
  235. progress.c
  236. progress.h
  237. prompt.c
  238. prompt.h
  239. quote.c
  240. quote.h
  241. reachable.c
  242. reachable.h
  243. read-cache.c
  244. README
  245. reflog-walk.c
  246. reflog-walk.h
  247. refs.c
  248. refs.h
  249. remote-curl.c
  250. remote-testsvn.c
  251. remote.c
  252. remote.h
  253. replace_object.c
  254. rerere.c
  255. rerere.h
  256. resolve-undo.c
  257. resolve-undo.h
  258. revision.c
  259. revision.h
  260. run-command.c
  261. run-command.h
  262. send-pack.c
  263. send-pack.h
  264. sequencer.c
  265. sequencer.h
  266. server-info.c
  267. setup.c
  268. sh-i18n--envsubst.c
  269. sha1-array.c
  270. sha1-array.h
  271. sha1-lookup.c
  272. sha1-lookup.h
  273. sha1_file.c
  274. sha1_name.c
  275. shallow.c
  276. shell.c
  277. shortlog.h
  278. show-index.c
  279. sideband.c
  280. sideband.h
  281. sigchain.c
  282. sigchain.h
  283. strbuf.c
  284. strbuf.h
  285. streaming.c
  286. streaming.h
  287. string-list.c
  288. string-list.h
  289. submodule.c
  290. submodule.h
  291. symlinks.c
  292. tag.c
  293. tag.h
  294. tar.h
  295. test-chmtime.c
  296. test-ctype.c
  297. test-date.c
  298. test-delta.c
  299. test-dump-cache-tree.c
  300. test-genrandom.c
  301. test-index-version.c
  302. test-line-buffer.c
  303. test-match-trees.c
  304. test-mergesort.c
  305. test-mktemp.c
  306. test-parse-options.c
  307. test-path-utils.c
  308. test-prio-queue.c
  309. test-read-cache.c
  310. test-regex.c
  311. test-revision-walking.c
  312. test-run-command.c
  313. test-scrap-cache-tree.c
  314. test-sha1.c
  315. test-sha1.sh
  316. test-sigchain.c
  317. test-string-list.c
  318. test-subprocess.c
  319. test-svn-fe.c
  320. test-wildmatch.c
  321. thread-utils.c
  322. thread-utils.h
  323. trace.c
  324. transport-helper.c
  325. transport.c
  326. transport.h
  327. tree-diff.c
  328. tree-walk.c
  329. tree-walk.h
  330. tree.c
  331. tree.h
  332. unimplemented.sh
  333. unix-socket.c
  334. unix-socket.h
  335. unpack-trees.c
  336. unpack-trees.h
  337. upload-pack.c
  338. url.c
  339. url.h
  340. usage.c
  341. userdiff.c
  342. userdiff.h
  343. utf8.c
  344. utf8.h
  345. varint.c
  346. varint.h
  347. version.c
  348. version.h
  349. walker.c
  350. walker.h
  351. wildmatch.c
  352. wildmatch.h
  353. wrap-for-bin.sh
  354. wrapper.c
  355. write_or_die.c
  356. ws.c
  357. wt-status.c
  358. wt-status.h
  359. xdiff-interface.c
  360. xdiff-interface.h
  361. zlib.c