builtin-rerere: more carefully find conflict markers

When a conflicting file contains a line that begin with "=======", rerere
failed to parse conflict markers. This result to a wrong preimage file and
an unexpected error for the user.  The boundary between ours and theirs
not just begin with 7 equals, but is followed by either a SP or a LF.

This patch enforces parsing rules so that markers match in the right order,
and when ambiguous, the command does not autoresolve the conflicted file.

Especially because we are introducing rerere.autoupdate configuration
(which is off by default for safety) that automatically stages the
resolution made by rerere, it is necessary to make sure that we do not
autoresolve when there is any ambiguity.

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