merge: handle --ff/--no-ff/--ff-only as a tri-state option

These three options mean "favor fast-forwarding when possible,
without creating an unnecessary merge", "never fast-forward and
always create a merge commit even when the commit being merged is a
strict descendant", and "we do not want to create any merge commit;
update only when the merged commit is a strict descendant".

They are "pick one out of these three possibilities" options, and
correspond to "merge.ff" configuration that is tri-state (yes, no
and only).

However, the implementation did not follow the usual convention for
the command line options (later one wins, and command line overrides
what is in the configuration).

Fix this by consolidating two variables (fast_forward_only and
allow_fast_forward) used in the implementation into one enum that
can take one of the three possible values.

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