git-commit: Allow to amend a merge commit that does not change the tree

Normally, it should not be allowed to generate an empty commit. A merge
commit generated with git 'merge -s ours' does not change the tree (along
the first parent), but merges are not "empty" even if they do not change
the tree. Hence, commit 8588452ceb7 allowed to amend a merge commit that
does not change the tree, but 4fb5fd5d301 disallowed it again in an
attempt to avoid that an existing commit is amended such that it becomes
empty. With this change, a commit can be edited (create a new one or amend
an existing one) either if there are changes or if there are at least two
parents.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 files changed
tree: 212234441c9d52a3112e1ba67cda3a7b2435f858
  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-config.c
  39. builtin-count-objects.c
  40. builtin-describe.c
  41. builtin-diff-files.c
  42. builtin-diff-index.c
  43. builtin-diff-tree.c
  44. builtin-diff.c
  45. builtin-fast-export.c
  46. builtin-fetch--tool.c
  47. builtin-fetch-pack.c
  48. builtin-fetch.c
  49. builtin-fmt-merge-msg.c
  50. builtin-for-each-ref.c
  51. builtin-fsck.c
  52. builtin-gc.c
  53. builtin-grep.c
  54. builtin-http-fetch.c
  55. builtin-init-db.c
  56. builtin-log.c
  57. builtin-ls-files.c
  58. builtin-ls-remote.c
  59. builtin-ls-tree.c
  60. builtin-mailinfo.c
  61. builtin-mailsplit.c
  62. builtin-merge-base.c
  63. builtin-merge-file.c
  64. builtin-merge-ours.c
  65. builtin-mv.c
  66. builtin-name-rev.c
  67. builtin-pack-objects.c
  68. builtin-pack-refs.c
  69. builtin-prune-packed.c
  70. builtin-prune.c
  71. builtin-push.c
  72. builtin-read-tree.c
  73. builtin-reflog.c
  74. builtin-rerere.c
  75. builtin-reset.c
  76. builtin-rev-list.c
  77. builtin-rev-parse.c
  78. builtin-revert.c
  79. builtin-rm.c
  80. builtin-runstatus.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-commit.sh
  153. git-compat-util.h
  154. git-cvsexportcommit.perl
  155. git-cvsimport.perl
  156. git-cvsserver.perl
  157. git-filter-branch.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. wt-status.c
  299. wt-status.h
  300. xdiff-interface.c
  301. xdiff-interface.h