fix git commit --amend -m "new message"

The prepare_log_message() function serves two purposes:

 - Prepares the commit log message template, to be given to the end
   user;

 - Return true if there is something committable;

7168624c3530d8c7ee32f930f8fb2ba302b9801f (Do not generate full commit
log message if it is not going to be used) cheated to omit the former
when we know the log message template is not going to be used.  However,
its replacement logic to see if there is something committable was
botched.  When amending, it should compare the index with the parent of
the HEAD, not the current HEAD.  Otherwise you cannot run --amend to
fix only the message without changing the tree.

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