am: match --signoff to the original scripted version

Linus noticed that the recently reimplemented "git am -s" defines
the trailer block too rigidly, resulting in an unnecessary blank
line between the existing sign-offs and his new sign-off.  An e-mail
submission sent to Linus in real life ends with mixture of sign-offs
and commentaries, e.g.

	title here

	message here

	Signed-off-by: Original Author <original@auth.or>
	[rv: tweaked frotz and nitfol]
	Signed-off-by: Re Viewer <rv@ew.er>
	Signed-off-by: Other Reviewer <other@rev.ewer>
	---
	patch here

Because the reimplementation reused append_signoff() helper that is
used by other codepaths, which is unaware that people intermix such
comments with their sign-offs in the trailer block, such a message
was judged to end with a non-trailer, resulting in an extra blank
line before adding a new sign-off.

The original scripted version of "git am" used a lot looser
definition, i.e. "if and only if there is no line that begins with
Signed-off-by:, add a blank line before adding a new sign-off".  For
the upcoming release, stop using the append_signoff() in "git am"
and reimplement the looser definition used by the scripted version
to use only in "git am" to fix this regression in "am" while
avoiding new regressions to other users of append_signoff().

In the longer term, we should look into loosening append_signoff()
so that other codepaths that add a new sign-off behave the same way
as "git am -s", but that is a task for post-release.

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