rugged 0.26.7 → 0.27.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (341) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/ext/rugged/rugged_blame.c +6 -3
  4. data/ext/rugged/rugged_branch_collection.c +3 -6
  5. data/ext/rugged/rugged_commit.c +56 -0
  6. data/ext/rugged/rugged_config.c +44 -9
  7. data/ext/rugged/rugged_diff.c +3 -14
  8. data/ext/rugged/rugged_diff_hunk.c +1 -3
  9. data/ext/rugged/rugged_index.c +1 -5
  10. data/ext/rugged/rugged_note.c +1 -4
  11. data/ext/rugged/rugged_patch.c +1 -4
  12. data/ext/rugged/rugged_reference_collection.c +1 -7
  13. data/ext/rugged/rugged_remote.c +5 -8
  14. data/ext/rugged/rugged_remote_collection.c +1 -6
  15. data/ext/rugged/rugged_repo.c +16 -48
  16. data/ext/rugged/rugged_revwalk.c +7 -16
  17. data/ext/rugged/rugged_settings.c +28 -0
  18. data/ext/rugged/rugged_submodule_collection.c +3 -4
  19. data/ext/rugged/rugged_tag_collection.c +1 -5
  20. data/ext/rugged/rugged_tree.c +2 -3
  21. data/lib/rugged/repository.rb +43 -0
  22. data/lib/rugged/version.rb +1 -1
  23. data/vendor/libgit2/AUTHORS +1 -0
  24. data/vendor/libgit2/CMakeLists.txt +61 -510
  25. data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +14 -0
  26. data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +25 -8
  27. data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +27 -8
  28. data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +20 -0
  29. data/vendor/libgit2/cmake/Modules/IdeSplitSources.cmake +22 -0
  30. data/vendor/libgit2/deps/http-parser/CMakeLists.txt +3 -0
  31. data/vendor/libgit2/deps/regex/CMakeLists.txt +2 -0
  32. data/vendor/libgit2/deps/winhttp/CMakeLists.txt +26 -0
  33. data/vendor/libgit2/deps/zlib/CMakeLists.txt +4 -0
  34. data/vendor/libgit2/include/git2/config.h +29 -2
  35. data/vendor/libgit2/include/git2/describe.h +1 -1
  36. data/vendor/libgit2/include/git2/diff.h +59 -8
  37. data/vendor/libgit2/include/git2/graph.h +3 -0
  38. data/vendor/libgit2/include/git2/merge.h +6 -0
  39. data/vendor/libgit2/include/git2/message.h +43 -3
  40. data/vendor/libgit2/include/git2/notes.h +89 -0
  41. data/vendor/libgit2/include/git2/odb.h +8 -1
  42. data/vendor/libgit2/include/git2/patch.h +2 -2
  43. data/vendor/libgit2/include/git2/pathspec.h +35 -18
  44. data/vendor/libgit2/include/git2/refs.h +3 -0
  45. data/vendor/libgit2/include/git2/remote.h +34 -4
  46. data/vendor/libgit2/include/git2/repository.h +6 -6
  47. data/vendor/libgit2/include/git2/reset.h +4 -4
  48. data/vendor/libgit2/include/git2/status.h +4 -0
  49. data/vendor/libgit2/include/git2/sys/config.h +4 -1
  50. data/vendor/libgit2/include/git2/sys/odb_backend.h +2 -1
  51. data/vendor/libgit2/include/git2/tree.h +4 -3
  52. data/vendor/libgit2/include/git2/types.h +1 -0
  53. data/vendor/libgit2/include/git2/version.h +4 -4
  54. data/vendor/libgit2/include/git2/worktree.h +1 -1
  55. data/vendor/libgit2/src/CMakeLists.txt +463 -0
  56. data/vendor/libgit2/src/annotated_commit.c +1 -1
  57. data/vendor/libgit2/src/annotated_commit.h +2 -0
  58. data/vendor/libgit2/src/apply.c +2 -1
  59. data/vendor/libgit2/src/apply.h +2 -0
  60. data/vendor/libgit2/src/attr.c +24 -4
  61. data/vendor/libgit2/src/attr.h +2 -0
  62. data/vendor/libgit2/src/attr_file.c +9 -2
  63. data/vendor/libgit2/src/attr_file.h +2 -0
  64. data/vendor/libgit2/src/attrcache.c +9 -1
  65. data/vendor/libgit2/src/attrcache.h +2 -0
  66. data/vendor/libgit2/src/blame.c +1 -0
  67. data/vendor/libgit2/src/blame.h +2 -1
  68. data/vendor/libgit2/src/blame_git.c +1 -0
  69. data/vendor/libgit2/src/blame_git.h +2 -0
  70. data/vendor/libgit2/src/blob.c +2 -2
  71. data/vendor/libgit2/src/blob.h +2 -0
  72. data/vendor/libgit2/src/branch.c +8 -1
  73. data/vendor/libgit2/src/branch.h +2 -0
  74. data/vendor/libgit2/src/buf_text.c +7 -7
  75. data/vendor/libgit2/src/buf_text.h +3 -3
  76. data/vendor/libgit2/src/buffer.c +31 -1
  77. data/vendor/libgit2/src/buffer.h +3 -0
  78. data/vendor/libgit2/src/cache.c +2 -2
  79. data/vendor/libgit2/src/cache.h +2 -0
  80. data/vendor/libgit2/src/cc-compat.h +3 -3
  81. data/vendor/libgit2/src/checkout.c +30 -19
  82. data/vendor/libgit2/src/checkout.h +2 -0
  83. data/vendor/libgit2/src/cherrypick.c +1 -0
  84. data/vendor/libgit2/src/clone.c +2 -1
  85. data/vendor/libgit2/src/clone.h +4 -0
  86. data/vendor/libgit2/src/commit.c +2 -1
  87. data/vendor/libgit2/src/commit.h +2 -0
  88. data/vendor/libgit2/src/commit_list.c +1 -1
  89. data/vendor/libgit2/src/commit_list.h +2 -0
  90. data/vendor/libgit2/src/common.h +11 -5
  91. data/vendor/libgit2/src/config.c +12 -10
  92. data/vendor/libgit2/src/config.h +2 -0
  93. data/vendor/libgit2/src/config_cache.c +1 -0
  94. data/vendor/libgit2/src/config_file.c +287 -786
  95. data/vendor/libgit2/src/config_file.h +4 -3
  96. data/vendor/libgit2/src/config_parse.c +525 -0
  97. data/vendor/libgit2/src/config_parse.h +64 -0
  98. data/vendor/libgit2/src/crlf.c +2 -1
  99. data/vendor/libgit2/src/delta.c +28 -30
  100. data/vendor/libgit2/src/delta.h +1 -0
  101. data/vendor/libgit2/src/describe.c +3 -1
  102. data/vendor/libgit2/src/diff.c +148 -2
  103. data/vendor/libgit2/src/diff.h +3 -1
  104. data/vendor/libgit2/src/diff_driver.c +12 -9
  105. data/vendor/libgit2/src/diff_driver.h +4 -1
  106. data/vendor/libgit2/src/diff_file.c +7 -4
  107. data/vendor/libgit2/src/diff_file.h +1 -0
  108. data/vendor/libgit2/src/diff_generate.c +6 -3
  109. data/vendor/libgit2/src/diff_generate.h +6 -1
  110. data/vendor/libgit2/src/diff_parse.c +5 -4
  111. data/vendor/libgit2/src/diff_parse.h +2 -0
  112. data/vendor/libgit2/src/diff_print.c +2 -0
  113. data/vendor/libgit2/src/diff_stats.c +2 -0
  114. data/vendor/libgit2/src/diff_tform.c +2 -1
  115. data/vendor/libgit2/src/diff_tform.h +4 -1
  116. data/vendor/libgit2/src/diff_xdiff.c +5 -2
  117. data/vendor/libgit2/src/diff_xdiff.h +2 -0
  118. data/vendor/libgit2/src/errors.c +2 -0
  119. data/vendor/libgit2/src/features.h.in +36 -0
  120. data/vendor/libgit2/src/fetch.c +2 -2
  121. data/vendor/libgit2/src/fetch.h +4 -0
  122. data/vendor/libgit2/src/fetchhead.c +3 -3
  123. data/vendor/libgit2/src/fetchhead.h +3 -0
  124. data/vendor/libgit2/src/filebuf.c +2 -1
  125. data/vendor/libgit2/src/filebuf.h +2 -0
  126. data/vendor/libgit2/src/fileops.c +12 -1
  127. data/vendor/libgit2/src/fileops.h +7 -1
  128. data/vendor/libgit2/src/filter.c +2 -1
  129. data/vendor/libgit2/src/filter.h +1 -0
  130. data/vendor/libgit2/src/fnmatch.c +2 -2
  131. data/vendor/libgit2/src/fnmatch.h +3 -4
  132. data/vendor/libgit2/src/global.c +4 -3
  133. data/vendor/libgit2/src/global.h +1 -5
  134. data/vendor/libgit2/src/graph.c +2 -0
  135. data/vendor/libgit2/src/hash.c +0 -1
  136. data/vendor/libgit2/src/hash.h +3 -1
  137. data/vendor/libgit2/src/hash/hash_collisiondetect.h +3 -3
  138. data/vendor/libgit2/src/hash/hash_common_crypto.h +18 -5
  139. data/vendor/libgit2/src/hash/hash_generic.c +2 -2
  140. data/vendor/libgit2/src/hash/hash_generic.h +5 -3
  141. data/vendor/libgit2/src/hash/hash_openssl.h +3 -3
  142. data/vendor/libgit2/src/hash/hash_win32.c +57 -14
  143. data/vendor/libgit2/src/hash/hash_win32.h +4 -3
  144. data/vendor/libgit2/src/hashsig.c +3 -0
  145. data/vendor/libgit2/src/ident.c +2 -0
  146. data/vendor/libgit2/src/idxmap.h +2 -1
  147. data/vendor/libgit2/src/ignore.c +14 -2
  148. data/vendor/libgit2/src/ignore.h +2 -0
  149. data/vendor/libgit2/src/index.c +20 -40
  150. data/vendor/libgit2/src/index.h +2 -0
  151. data/vendor/libgit2/src/indexer.c +13 -5
  152. data/vendor/libgit2/src/indexer.h +5 -1
  153. data/vendor/libgit2/src/integer.h +1 -1
  154. data/vendor/libgit2/src/iterator.c +44 -3
  155. data/vendor/libgit2/src/iterator.h +3 -0
  156. data/vendor/libgit2/src/map.h +1 -1
  157. data/vendor/libgit2/src/merge.c +155 -33
  158. data/vendor/libgit2/src/merge.h +2 -0
  159. data/vendor/libgit2/src/merge_driver.c +2 -2
  160. data/vendor/libgit2/src/merge_driver.h +2 -0
  161. data/vendor/libgit2/src/merge_file.c +3 -0
  162. data/vendor/libgit2/src/message.h +3 -1
  163. data/vendor/libgit2/src/mwindow.c +1 -1
  164. data/vendor/libgit2/src/mwindow.h +2 -0
  165. data/vendor/libgit2/src/netops.c +75 -62
  166. data/vendor/libgit2/src/netops.h +2 -1
  167. data/vendor/libgit2/src/notes.c +164 -48
  168. data/vendor/libgit2/src/notes.h +1 -1
  169. data/vendor/libgit2/src/object.c +14 -3
  170. data/vendor/libgit2/src/object.h +4 -0
  171. data/vendor/libgit2/src/object_api.c +3 -2
  172. data/vendor/libgit2/src/odb.c +104 -38
  173. data/vendor/libgit2/src/odb.h +3 -1
  174. data/vendor/libgit2/src/odb_loose.c +414 -267
  175. data/vendor/libgit2/src/odb_mempack.c +1 -0
  176. data/vendor/libgit2/src/odb_pack.c +2 -1
  177. data/vendor/libgit2/src/offmap.h +1 -0
  178. data/vendor/libgit2/src/oid.c +2 -1
  179. data/vendor/libgit2/src/oid.h +3 -8
  180. data/vendor/libgit2/src/oidarray.c +2 -1
  181. data/vendor/libgit2/src/oidarray.h +1 -0
  182. data/vendor/libgit2/src/oidmap.h +1 -0
  183. data/vendor/libgit2/src/pack-objects.c +5 -1
  184. data/vendor/libgit2/src/pack-objects.h +1 -1
  185. data/vendor/libgit2/src/pack.c +2 -6
  186. data/vendor/libgit2/src/pack.h +2 -1
  187. data/vendor/libgit2/src/parse.c +121 -0
  188. data/vendor/libgit2/src/parse.h +61 -0
  189. data/vendor/libgit2/src/patch.c +9 -2
  190. data/vendor/libgit2/src/patch.h +2 -0
  191. data/vendor/libgit2/src/patch_generate.c +6 -5
  192. data/vendor/libgit2/src/patch_generate.h +1 -0
  193. data/vendor/libgit2/src/patch_parse.c +265 -276
  194. data/vendor/libgit2/src/patch_parse.h +6 -11
  195. data/vendor/libgit2/src/path.c +24 -181
  196. data/vendor/libgit2/src/path.h +14 -73
  197. data/vendor/libgit2/src/pathspec.c +2 -1
  198. data/vendor/libgit2/src/pathspec.h +2 -1
  199. data/vendor/libgit2/src/pool.c +8 -0
  200. data/vendor/libgit2/src/pool.h +1 -0
  201. data/vendor/libgit2/src/posix.c +2 -1
  202. data/vendor/libgit2/src/posix.h +1 -0
  203. data/vendor/libgit2/src/pqueue.c +1 -0
  204. data/vendor/libgit2/src/pqueue.h +2 -0
  205. data/vendor/libgit2/src/proxy.c +2 -1
  206. data/vendor/libgit2/src/proxy.h +3 -1
  207. data/vendor/libgit2/src/push.c +4 -171
  208. data/vendor/libgit2/src/push.h +2 -0
  209. data/vendor/libgit2/src/rebase.c +1 -0
  210. data/vendor/libgit2/src/refdb.c +2 -3
  211. data/vendor/libgit2/src/refdb.h +2 -0
  212. data/vendor/libgit2/src/refdb_fs.c +5 -3
  213. data/vendor/libgit2/src/refdb_fs.h +4 -0
  214. data/vendor/libgit2/src/reflog.c +1 -0
  215. data/vendor/libgit2/src/reflog.h +2 -1
  216. data/vendor/libgit2/src/refs.c +1 -0
  217. data/vendor/libgit2/src/refs.h +2 -1
  218. data/vendor/libgit2/src/refspec.c +2 -2
  219. data/vendor/libgit2/src/refspec.h +2 -0
  220. data/vendor/libgit2/src/remote.c +56 -10
  221. data/vendor/libgit2/src/remote.h +2 -0
  222. data/vendor/libgit2/src/repository.c +16 -14
  223. data/vendor/libgit2/src/repository.h +2 -0
  224. data/vendor/libgit2/src/reset.c +6 -5
  225. data/vendor/libgit2/src/revert.c +1 -0
  226. data/vendor/libgit2/src/revparse.c +3 -5
  227. data/vendor/libgit2/src/revwalk.c +2 -2
  228. data/vendor/libgit2/src/revwalk.h +2 -0
  229. data/vendor/libgit2/src/settings.c +6 -8
  230. data/vendor/libgit2/src/sha1_lookup.c +2 -216
  231. data/vendor/libgit2/src/sha1_lookup.h +2 -6
  232. data/vendor/libgit2/src/signature.c +8 -3
  233. data/vendor/libgit2/src/signature.h +2 -0
  234. data/vendor/libgit2/src/sortedcache.c +7 -0
  235. data/vendor/libgit2/src/sortedcache.h +2 -0
  236. data/vendor/libgit2/src/stash.c +1 -0
  237. data/vendor/libgit2/src/status.c +14 -9
  238. data/vendor/libgit2/src/status.h +2 -0
  239. data/vendor/libgit2/src/{curl_stream.c → streams/curl.c} +2 -0
  240. data/vendor/libgit2/src/{curl_stream.h → streams/curl.h} +4 -2
  241. data/vendor/libgit2/src/{openssl_stream.c → streams/openssl.c} +47 -18
  242. data/vendor/libgit2/src/{openssl_stream.h → streams/openssl.h} +6 -2
  243. data/vendor/libgit2/src/{socket_stream.c → streams/socket.c} +2 -2
  244. data/vendor/libgit2/src/{socket_stream.h → streams/socket.h} +4 -2
  245. data/vendor/libgit2/src/{stransport_stream.c → streams/stransport.c} +4 -2
  246. data/vendor/libgit2/src/{stransport_stream.h → streams/stransport.h} +4 -2
  247. data/vendor/libgit2/src/{tls_stream.c → streams/tls.c} +4 -3
  248. data/vendor/libgit2/src/{tls_stream.h → streams/tls.h} +4 -2
  249. data/vendor/libgit2/src/submodule.c +28 -80
  250. data/vendor/libgit2/src/submodule.h +2 -13
  251. data/vendor/libgit2/src/sysdir.c +75 -8
  252. data/vendor/libgit2/src/sysdir.h +2 -1
  253. data/vendor/libgit2/src/tag.c +2 -2
  254. data/vendor/libgit2/src/tag.h +2 -0
  255. data/vendor/libgit2/src/thread-utils.c +1 -0
  256. data/vendor/libgit2/src/thread-utils.h +1 -1
  257. data/vendor/libgit2/src/trace.c +2 -2
  258. data/vendor/libgit2/src/trace.h +2 -0
  259. data/vendor/libgit2/src/trailer.c +416 -0
  260. data/vendor/libgit2/src/transaction.c +2 -1
  261. data/vendor/libgit2/src/transport.c +2 -0
  262. data/vendor/libgit2/src/transports/auth.c +2 -1
  263. data/vendor/libgit2/src/transports/auth.h +4 -3
  264. data/vendor/libgit2/src/transports/auth_negotiate.c +2 -1
  265. data/vendor/libgit2/src/transports/auth_negotiate.h +3 -3
  266. data/vendor/libgit2/src/transports/cred.c +2 -0
  267. data/vendor/libgit2/src/transports/cred.h +4 -2
  268. data/vendor/libgit2/src/transports/cred_helpers.c +1 -0
  269. data/vendor/libgit2/src/transports/git.c +3 -1
  270. data/vendor/libgit2/src/transports/http.c +10 -14
  271. data/vendor/libgit2/src/transports/http.h +23 -0
  272. data/vendor/libgit2/src/transports/local.c +23 -5
  273. data/vendor/libgit2/src/transports/smart.c +3 -1
  274. data/vendor/libgit2/src/transports/smart.h +23 -16
  275. data/vendor/libgit2/src/transports/smart_pkt.c +114 -130
  276. data/vendor/libgit2/src/transports/smart_protocol.c +26 -22
  277. data/vendor/libgit2/src/transports/ssh.c +12 -7
  278. data/vendor/libgit2/src/transports/ssh.h +4 -2
  279. data/vendor/libgit2/src/transports/winhttp.c +19 -21
  280. data/vendor/libgit2/src/tree-cache.c +1 -0
  281. data/vendor/libgit2/src/tree-cache.h +1 -0
  282. data/vendor/libgit2/src/tree.c +20 -14
  283. data/vendor/libgit2/src/tree.h +2 -0
  284. data/vendor/libgit2/src/tsort.c +0 -1
  285. data/vendor/libgit2/src/unix/map.c +4 -1
  286. data/vendor/libgit2/src/unix/posix.h +8 -4
  287. data/vendor/libgit2/src/unix/pthread.h +1 -1
  288. data/vendor/libgit2/src/unix/realpath.c +4 -1
  289. data/vendor/libgit2/src/util.c +6 -5
  290. data/vendor/libgit2/src/util.h +39 -111
  291. data/vendor/libgit2/src/varint.c +0 -1
  292. data/vendor/libgit2/src/varint.h +2 -0
  293. data/vendor/libgit2/src/vector.c +1 -1
  294. data/vendor/libgit2/src/win32/dir.c +3 -0
  295. data/vendor/libgit2/src/win32/dir.h +4 -3
  296. data/vendor/libgit2/src/win32/error.c +1 -1
  297. data/vendor/libgit2/src/win32/error.h +4 -2
  298. data/vendor/libgit2/src/win32/findfile.c +2 -1
  299. data/vendor/libgit2/src/win32/findfile.h +4 -2
  300. data/vendor/libgit2/src/win32/map.c +2 -0
  301. data/vendor/libgit2/src/win32/mingw-compat.h +3 -3
  302. data/vendor/libgit2/src/win32/msvc-compat.h +3 -3
  303. data/vendor/libgit2/src/win32/path_w32.c +7 -12
  304. data/vendor/libgit2/src/win32/path_w32.h +3 -2
  305. data/vendor/libgit2/src/win32/posix.h +2 -2
  306. data/vendor/libgit2/src/win32/posix_w32.c +11 -5
  307. data/vendor/libgit2/src/win32/precompiled.h +2 -1
  308. data/vendor/libgit2/src/win32/reparse.h +2 -2
  309. data/vendor/libgit2/src/win32/thread.c +1 -0
  310. data/vendor/libgit2/src/win32/thread.h +2 -2
  311. data/vendor/libgit2/src/win32/utf-conv.c +0 -1
  312. data/vendor/libgit2/src/win32/utf-conv.h +4 -3
  313. data/vendor/libgit2/src/win32/w32_buffer.c +1 -1
  314. data/vendor/libgit2/src/win32/w32_buffer.h +4 -2
  315. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -1
  316. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +85 -2
  317. data/vendor/libgit2/src/win32/w32_stack.c +2 -1
  318. data/vendor/libgit2/src/win32/w32_stack.h +5 -3
  319. data/vendor/libgit2/src/win32/w32_util.h +4 -2
  320. data/vendor/libgit2/src/win32/win32-compat.h +3 -3
  321. data/vendor/libgit2/src/worktree.c +4 -5
  322. data/vendor/libgit2/src/worktree.h +2 -0
  323. data/vendor/libgit2/src/xdiff/xdiff.h +22 -13
  324. data/vendor/libgit2/src/xdiff/xdiffi.c +523 -81
  325. data/vendor/libgit2/src/xdiff/xdiffi.h +2 -2
  326. data/vendor/libgit2/src/xdiff/xemit.c +63 -39
  327. data/vendor/libgit2/src/xdiff/xemit.h +2 -2
  328. data/vendor/libgit2/src/xdiff/xhistogram.c +0 -1
  329. data/vendor/libgit2/src/xdiff/xinclude.h +3 -2
  330. data/vendor/libgit2/src/xdiff/xmacros.h +2 -2
  331. data/vendor/libgit2/src/xdiff/xmerge.c +80 -20
  332. data/vendor/libgit2/src/xdiff/xpatience.c +41 -9
  333. data/vendor/libgit2/src/xdiff/xprepare.c +2 -2
  334. data/vendor/libgit2/src/xdiff/xprepare.h +2 -2
  335. data/vendor/libgit2/src/xdiff/xtypes.h +2 -2
  336. data/vendor/libgit2/src/xdiff/xutils.c +47 -27
  337. data/vendor/libgit2/src/xdiff/xutils.h +2 -5
  338. data/vendor/libgit2/src/zstream.c +65 -45
  339. data/vendor/libgit2/src/zstream.h +9 -2
  340. metadata +27 -13
  341. data/vendor/libgit2/include/git2/sys/remote.h +0 -16
@@ -7,6 +7,8 @@
7
7
  #ifndef INCLUDE_ignore_h__
8
8
  #define INCLUDE_ignore_h__
9
9
 
10
+ #include "common.h"
11
+
10
12
  #include "repository.h"
11
13
  #include "vector.h"
12
14
  #include "attr_file.h"
@@ -5,11 +5,11 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
+ #include "index.h"
9
+
8
10
  #include <stddef.h>
9
11
 
10
- #include "common.h"
11
12
  #include "repository.h"
12
- #include "index.h"
13
13
  #include "tree.h"
14
14
  #include "tree-cache.h"
15
15
  #include "hash.h"
@@ -884,13 +884,11 @@ static int index_entry_create(
884
884
  git_index_entry **out,
885
885
  git_repository *repo,
886
886
  const char *path,
887
- struct stat *st,
888
887
  bool from_workdir)
889
888
  {
890
889
  size_t pathlen = strlen(path), alloclen;
891
890
  struct entry_internal *entry;
892
891
  unsigned int path_valid_flags = GIT_PATH_REJECT_INDEX_DEFAULTS;
893
- uint16_t mode = 0;
894
892
 
895
893
  /* always reject placing `.git` in the index and directory traversal.
896
894
  * when requested, disallow platform-specific filenames and upgrade to
@@ -898,10 +896,8 @@ static int index_entry_create(
898
896
  */
899
897
  if (from_workdir)
900
898
  path_valid_flags |= GIT_PATH_REJECT_WORKDIR_DEFAULTS;
901
- if (st)
902
- mode = st->st_mode;
903
899
 
904
- if (!git_path_isvalid(repo, path, mode, path_valid_flags)) {
900
+ if (!git_path_isvalid(repo, path, path_valid_flags)) {
905
901
  giterr_set(GITERR_INDEX, "invalid path: '%s'", path);
906
902
  return -1;
907
903
  }
@@ -926,35 +922,15 @@ static int index_entry_init(
926
922
  {
927
923
  int error = 0;
928
924
  git_index_entry *entry = NULL;
929
- git_buf path = GIT_BUF_INIT;
930
925
  struct stat st;
931
926
  git_oid oid;
932
- git_repository *repo;
933
927
 
934
928
  if (INDEX_OWNER(index) == NULL)
935
929
  return create_index_error(-1,
936
930
  "could not initialize index entry. "
937
931
  "Index is not backed up by an existing repository.");
938
932
 
939
- /*
940
- * FIXME: this is duplicated with the work in
941
- * git_blob__create_from_paths. It should accept an optional stat
942
- * structure so we can pass in the one we have to do here.
943
- */
944
- repo = INDEX_OWNER(index);
945
- if (git_repository__ensure_not_bare(repo, "create blob from file") < 0)
946
- return GIT_EBAREREPO;
947
-
948
- if (git_buf_joinpath(&path, git_repository_workdir(repo), rel_path) < 0)
949
- return -1;
950
-
951
- error = git_path_lstat(path.ptr, &st);
952
- git_buf_free(&path);
953
-
954
- if (error < 0)
955
- return error;
956
-
957
- if (index_entry_create(&entry, INDEX_OWNER(index), rel_path, &st, true) < 0)
933
+ if (index_entry_create(&entry, INDEX_OWNER(index), rel_path, true) < 0)
958
934
  return -1;
959
935
 
960
936
  /* write the blob to disk and get the oid and stat info */
@@ -1040,7 +1016,7 @@ static int index_entry_dup(
1040
1016
  git_index *index,
1041
1017
  const git_index_entry *src)
1042
1018
  {
1043
- if (index_entry_create(out, INDEX_OWNER(index), src->path, NULL, false) < 0)
1019
+ if (index_entry_create(out, INDEX_OWNER(index), src->path, false) < 0)
1044
1020
  return -1;
1045
1021
 
1046
1022
  index_entry_cpy(*out, src);
@@ -1062,7 +1038,7 @@ static int index_entry_dup_nocache(
1062
1038
  git_index *index,
1063
1039
  const git_index_entry *src)
1064
1040
  {
1065
- if (index_entry_create(out, INDEX_OWNER(index), src->path, NULL, false) < 0)
1041
+ if (index_entry_create(out, INDEX_OWNER(index), src->path, false) < 0)
1066
1042
  return -1;
1067
1043
 
1068
1044
  index_entry_cpy_nocache(*out, src);
@@ -1420,12 +1396,16 @@ static int index_conflict_to_reuc(git_index *index, const char *path)
1420
1396
  return ret;
1421
1397
  }
1422
1398
 
1423
- static bool valid_filemode(const int filemode)
1399
+ GIT_INLINE(bool) is_file_or_link(const int filemode)
1424
1400
  {
1425
1401
  return (filemode == GIT_FILEMODE_BLOB ||
1426
1402
  filemode == GIT_FILEMODE_BLOB_EXECUTABLE ||
1427
- filemode == GIT_FILEMODE_LINK ||
1428
- filemode == GIT_FILEMODE_COMMIT);
1403
+ filemode == GIT_FILEMODE_LINK);
1404
+ }
1405
+
1406
+ GIT_INLINE(bool) valid_filemode(const int filemode)
1407
+ {
1408
+ return (is_file_or_link(filemode) || filemode == GIT_FILEMODE_COMMIT);
1429
1409
  }
1430
1410
 
1431
1411
  int git_index_add_frombuffer(
@@ -1443,7 +1423,7 @@ int git_index_add_frombuffer(
1443
1423
  "could not initialize index entry. "
1444
1424
  "Index is not backed up by an existing repository.");
1445
1425
 
1446
- if (!valid_filemode(source_entry->mode)) {
1426
+ if (!is_file_or_link(source_entry->mode)) {
1447
1427
  giterr_set(GITERR_INDEX, "invalid filemode");
1448
1428
  return -1;
1449
1429
  }
@@ -1481,6 +1461,9 @@ static int add_repo_as_submodule(git_index_entry **out, git_index *index, const
1481
1461
  struct stat st;
1482
1462
  int error;
1483
1463
 
1464
+ if (index_entry_create(&entry, INDEX_OWNER(index), path, true) < 0)
1465
+ return -1;
1466
+
1484
1467
  if ((error = git_buf_joinpath(&abspath, git_repository_workdir(repo), path)) < 0)
1485
1468
  return error;
1486
1469
 
@@ -1489,9 +1472,6 @@ static int add_repo_as_submodule(git_index_entry **out, git_index *index, const
1489
1472
  return -1;
1490
1473
  }
1491
1474
 
1492
- if (index_entry_create(&entry, INDEX_OWNER(index), path, &st, true) < 0)
1493
- return -1;
1494
-
1495
1475
  git_index_entry__init_from_stat(entry, &st, !index->distrust_filemode);
1496
1476
 
1497
1477
  if ((error = git_repository_open(&sub, abspath.ptr)) < 0)
@@ -1629,7 +1609,7 @@ int git_index_add(git_index *index, const git_index_entry *source_entry)
1629
1609
  assert(index && source_entry && source_entry->path);
1630
1610
 
1631
1611
  if (!valid_filemode(source_entry->mode)) {
1632
- giterr_set(GITERR_INDEX, "invalid filemode");
1612
+ giterr_set(GITERR_INDEX, "invalid entry mode");
1633
1613
  return -1;
1634
1614
  }
1635
1615
 
@@ -2528,7 +2508,7 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
2528
2508
 
2529
2509
  /* Parse all the entries */
2530
2510
  for (i = 0; i < header.entry_count && buffer_size > INDEX_FOOTER_SIZE; ++i) {
2531
- git_index_entry *entry;
2511
+ git_index_entry *entry = NULL;
2532
2512
  size_t entry_size;
2533
2513
 
2534
2514
  if ((error = read_entry(&entry, &entry_size, index, buffer, buffer_size, last)) < 0) {
@@ -2985,7 +2965,7 @@ static int read_tree_cb(
2985
2965
  if (git_buf_joinpath(&path, root, tentry->filename) < 0)
2986
2966
  return -1;
2987
2967
 
2988
- if (index_entry_create(&entry, INDEX_OWNER(data->index), path.ptr, NULL, false) < 0)
2968
+ if (index_entry_create(&entry, INDEX_OWNER(data->index), path.ptr, false) < 0)
2989
2969
  return -1;
2990
2970
 
2991
2971
  entry->mode = tentry->attr;
@@ -7,6 +7,8 @@
7
7
  #ifndef INCLUDE_index_h__
8
8
  #define INCLUDE_index_h__
9
9
 
10
+ #include "common.h"
11
+
10
12
  #include "fileops.h"
11
13
  #include "filebuf.h"
12
14
  #include "vector.h"
@@ -5,10 +5,11 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
+ #include "indexer.h"
9
+
8
10
  #include "git2/indexer.h"
9
11
  #include "git2/object.h"
10
12
 
11
- #include "common.h"
12
13
  #include "pack.h"
13
14
  #include "mwindow.h"
14
15
  #include "posix.h"
@@ -186,13 +187,17 @@ static int store_delta(git_indexer *idx)
186
187
  return 0;
187
188
  }
188
189
 
189
- static void hash_header(git_hash_ctx *ctx, git_off_t len, git_otype type)
190
+ static int hash_header(git_hash_ctx *ctx, git_off_t len, git_otype type)
190
191
  {
191
192
  char buffer[64];
192
193
  size_t hdrlen;
194
+ int error;
195
+
196
+ if ((error = git_odb__format_object_header(&hdrlen,
197
+ buffer, sizeof(buffer), (size_t)len, type)) < 0)
198
+ return error;
193
199
 
194
- hdrlen = git_odb__format_object_header(buffer, sizeof(buffer), (size_t)len, type);
195
- git_hash_update(ctx, buffer, hdrlen);
200
+ return git_hash_update(ctx, buffer, hdrlen);
196
201
  }
197
202
 
198
203
  static int hash_object_stream(git_indexer*idx, git_packfile_stream *stream)
@@ -620,7 +625,10 @@ int git_indexer_append(git_indexer *idx, const void *data, size_t size, git_tran
620
625
  idx->have_delta = 1;
621
626
  } else {
622
627
  idx->have_delta = 0;
623
- hash_header(&idx->hash_ctx, entry_size, type);
628
+
629
+ error = hash_header(&idx->hash_ctx, entry_size, type);
630
+ if (error < 0)
631
+ goto on_error;
624
632
  }
625
633
 
626
634
  idx->have_stream = 1;
@@ -7,6 +7,10 @@
7
7
  #ifndef INCLUDE_indexer_h__
8
8
  #define INCLUDE_indexer_h__
9
9
 
10
- extern int git_indexer__set_fsync(git_indexer *idx, int do_fsync);
10
+ #include "common.h"
11
+
12
+ #include "git2/indexer.h"
13
+
14
+ extern void git_indexer__set_fsync(git_indexer *idx, int do_fsync);
11
15
 
12
16
  #endif
@@ -93,4 +93,4 @@ GIT_INLINE(bool) git__multiply_sizet_overflow(size_t *out, size_t one, size_t tw
93
93
 
94
94
  #endif
95
95
 
96
- #endif /* INCLUDE_integer_h__ */
96
+ #endif
@@ -6,6 +6,7 @@
6
6
  */
7
7
 
8
8
  #include "iterator.h"
9
+
9
10
  #include "tree.h"
10
11
  #include "index.h"
11
12
 
@@ -22,6 +23,7 @@
22
23
  #define iterator__has_been_accessed(I) iterator__flag(I,FIRST_ACCESS)
23
24
  #define iterator__honor_ignores(I) iterator__flag(I,HONOR_IGNORES)
24
25
  #define iterator__ignore_dot_git(I) iterator__flag(I,IGNORE_DOT_GIT)
26
+ #define iterator__descend_symlinks(I) iterator__flag(I,DESCEND_SYMLINKS)
25
27
 
26
28
 
27
29
  static void iterator_set_ignore_case(git_iterator *iter, bool ignore_case)
@@ -1456,10 +1458,15 @@ static void filesystem_iterator_set_current(
1456
1458
  filesystem_iterator_entry *entry)
1457
1459
  {
1458
1460
  iter->entry.ctime.seconds = entry->st.st_ctime;
1459
- iter->entry.ctime.nanoseconds = entry->st.st_ctime_nsec;
1460
-
1461
1461
  iter->entry.mtime.seconds = entry->st.st_mtime;
1462
+
1463
+ #if defined(GIT_USE_NSEC)
1464
+ iter->entry.ctime.nanoseconds = entry->st.st_ctime_nsec;
1462
1465
  iter->entry.mtime.nanoseconds = entry->st.st_mtime_nsec;
1466
+ #else
1467
+ iter->entry.ctime.nanoseconds = 0;
1468
+ iter->entry.mtime.nanoseconds = 0;
1469
+ #endif
1463
1470
 
1464
1471
  iter->entry.dev = entry->st.st_dev;
1465
1472
  iter->entry.ino = entry->st.st_ino;
@@ -1490,10 +1497,41 @@ static int filesystem_iterator_current(
1490
1497
  return 0;
1491
1498
  }
1492
1499
 
1500
+ static int filesystem_iterator_is_dir(
1501
+ bool *is_dir,
1502
+ const filesystem_iterator *iter,
1503
+ const filesystem_iterator_entry *entry)
1504
+ {
1505
+ struct stat st;
1506
+ git_buf fullpath = GIT_BUF_INIT;
1507
+ int error = 0;
1508
+
1509
+ if (S_ISDIR(entry->st.st_mode)) {
1510
+ *is_dir = 1;
1511
+ goto done;
1512
+ }
1513
+
1514
+ if (!iterator__descend_symlinks(iter) || !S_ISLNK(entry->st.st_mode)) {
1515
+ *is_dir = 0;
1516
+ goto done;
1517
+ }
1518
+
1519
+ if ((error = git_buf_joinpath(&fullpath, iter->root, entry->path)) < 0 ||
1520
+ (error = p_stat(fullpath.ptr, &st)) < 0)
1521
+ goto done;
1522
+
1523
+ *is_dir = S_ISDIR(st.st_mode);
1524
+
1525
+ done:
1526
+ git_buf_free(&fullpath);
1527
+ return error;
1528
+ }
1529
+
1493
1530
  static int filesystem_iterator_advance(
1494
1531
  const git_index_entry **out, git_iterator *i)
1495
1532
  {
1496
1533
  filesystem_iterator *iter = (filesystem_iterator *)i;
1534
+ bool is_dir;
1497
1535
  int error = 0;
1498
1536
 
1499
1537
  iter->base.flags |= GIT_ITERATOR_FIRST_ACCESS;
@@ -1518,7 +1556,10 @@ static int filesystem_iterator_advance(
1518
1556
  entry = frame->entries.contents[frame->next_idx];
1519
1557
  frame->next_idx++;
1520
1558
 
1521
- if (S_ISDIR(entry->st.st_mode)) {
1559
+ if ((error = filesystem_iterator_is_dir(&is_dir, iter, entry)) < 0)
1560
+ break;
1561
+
1562
+ if (is_dir) {
1522
1563
  if (iterator__do_autoexpand(iter)) {
1523
1564
  error = filesystem_iterator_frame_push(iter, entry);
1524
1565
 
@@ -8,6 +8,7 @@
8
8
  #define INCLUDE_iterator_h__
9
9
 
10
10
  #include "common.h"
11
+
11
12
  #include "git2/index.h"
12
13
  #include "vector.h"
13
14
  #include "buffer.h"
@@ -38,6 +39,8 @@ typedef enum {
38
39
  GIT_ITERATOR_DONT_PRECOMPOSE_UNICODE = (1u << 5),
39
40
  /** include conflicts */
40
41
  GIT_ITERATOR_INCLUDE_CONFLICTS = (1u << 6),
42
+ /** descend into symlinked directories */
43
+ GIT_ITERATOR_DESCEND_SYMLINKS = (1u << 7),
41
44
  } git_iterator_flag_t;
42
45
 
43
46
  typedef enum {
@@ -43,4 +43,4 @@ typedef struct { /* memory mapped buffer */
43
43
  extern int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offset);
44
44
  extern int p_munmap(git_map *map);
45
45
 
46
- #endif /* INCLUDE_map_h__ */
46
+ #endif
@@ -5,13 +5,13 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
- #include "common.h"
8
+ #include "merge.h"
9
+
9
10
  #include "posix.h"
10
11
  #include "buffer.h"
11
12
  #include "repository.h"
12
13
  #include "revwalk.h"
13
14
  #include "commit_list.h"
14
- #include "merge.h"
15
15
  #include "path.h"
16
16
  #include "refs.h"
17
17
  #include "object.h"
@@ -32,6 +32,8 @@
32
32
  #include "commit.h"
33
33
  #include "oidarray.h"
34
34
  #include "merge_driver.h"
35
+ #include "oidmap.h"
36
+ #include "array.h"
35
37
 
36
38
  #include "git2/types.h"
37
39
  #include "git2/repository.h"
@@ -1005,27 +1007,6 @@ struct merge_diff_similarity {
1005
1007
  size_t other_idx;
1006
1008
  };
1007
1009
 
1008
- static int index_entry_similarity_exact(
1009
- git_repository *repo,
1010
- git_index_entry *a,
1011
- size_t a_idx,
1012
- git_index_entry *b,
1013
- size_t b_idx,
1014
- void **cache,
1015
- const git_merge_options *opts)
1016
- {
1017
- GIT_UNUSED(repo);
1018
- GIT_UNUSED(a_idx);
1019
- GIT_UNUSED(b_idx);
1020
- GIT_UNUSED(cache);
1021
- GIT_UNUSED(opts);
1022
-
1023
- if (git_oid__cmp(&a->id, &b->id) == 0)
1024
- return 100;
1025
-
1026
- return 0;
1027
- }
1028
-
1029
1010
  static int index_entry_similarity_calc(
1030
1011
  void **out,
1031
1012
  git_repository *repo,
@@ -1102,12 +1083,154 @@ static int index_entry_similarity_inexact(
1102
1083
  return score;
1103
1084
  }
1104
1085
 
1105
- static int merge_diff_mark_similarity(
1086
+ /* Tracks deletes by oid for merge_diff_mark_similarity_exact(). This is a
1087
+ * non-shrinking queue where next_pos is the next position to dequeue.
1088
+ */
1089
+ typedef struct {
1090
+ git_array_t(size_t) arr;
1091
+ size_t next_pos;
1092
+ size_t first_entry;
1093
+ } deletes_by_oid_queue;
1094
+
1095
+ static void deletes_by_oid_free(git_oidmap *map) {
1096
+ deletes_by_oid_queue *queue;
1097
+
1098
+ if (!map)
1099
+ return;
1100
+
1101
+ git_oidmap_foreach_value(map, queue, {
1102
+ git_array_clear(queue->arr);
1103
+ });
1104
+ git_oidmap_free(map);
1105
+ }
1106
+
1107
+ static int deletes_by_oid_enqueue(git_oidmap *map, git_pool* pool, const git_oid *id, size_t idx) {
1108
+ khint_t pos;
1109
+ deletes_by_oid_queue *queue;
1110
+ size_t *array_entry;
1111
+ int error;
1112
+
1113
+ pos = git_oidmap_lookup_index(map, id);
1114
+ if (!git_oidmap_valid_index(map, pos)) {
1115
+ queue = git_pool_malloc(pool, sizeof(deletes_by_oid_queue));
1116
+ GITERR_CHECK_ALLOC(queue);
1117
+
1118
+ git_array_init(queue->arr);
1119
+ queue->next_pos = 0;
1120
+ queue->first_entry = idx;
1121
+
1122
+ git_oidmap_insert(map, id, queue, &error);
1123
+ if (error < 0)
1124
+ return -1;
1125
+ } else {
1126
+ queue = git_oidmap_value_at(map, pos);
1127
+ array_entry = git_array_alloc(queue->arr);
1128
+ GITERR_CHECK_ALLOC(array_entry);
1129
+ *array_entry = idx;
1130
+ }
1131
+
1132
+ return 0;
1133
+ }
1134
+
1135
+ static int deletes_by_oid_dequeue(size_t *idx, git_oidmap *map, const git_oid *id) {
1136
+ khint_t pos;
1137
+ deletes_by_oid_queue *queue;
1138
+ size_t *array_entry;
1139
+
1140
+ pos = git_oidmap_lookup_index(map, id);
1141
+
1142
+ if (!git_oidmap_valid_index(map, pos))
1143
+ return GIT_ENOTFOUND;
1144
+
1145
+ queue = git_oidmap_value_at(map, pos);
1146
+
1147
+ if (queue->next_pos == 0) {
1148
+ *idx = queue->first_entry;
1149
+ } else {
1150
+ array_entry = git_array_get(queue->arr, queue->next_pos - 1);
1151
+ if (array_entry == NULL)
1152
+ return GIT_ENOTFOUND;
1153
+
1154
+ *idx = *array_entry;
1155
+ }
1156
+
1157
+ queue->next_pos++;
1158
+ return 0;
1159
+ }
1160
+
1161
+ static int merge_diff_mark_similarity_exact(
1162
+ git_merge_diff_list *diff_list,
1163
+ struct merge_diff_similarity *similarity_ours,
1164
+ struct merge_diff_similarity *similarity_theirs)
1165
+ {
1166
+ size_t i, j;
1167
+ git_merge_diff *conflict_src, *conflict_tgt;
1168
+ git_oidmap *ours_deletes_by_oid = NULL, *theirs_deletes_by_oid = NULL;
1169
+ int error = 0;
1170
+
1171
+ if (!(ours_deletes_by_oid = git_oidmap_alloc()) ||
1172
+ !(theirs_deletes_by_oid = git_oidmap_alloc())) {
1173
+ error = -1;
1174
+ goto done;
1175
+ }
1176
+
1177
+ /* Build a map of object ids to conflicts */
1178
+ git_vector_foreach(&diff_list->conflicts, i, conflict_src) {
1179
+ /* Items can be the source of a rename iff they have an item in the
1180
+ * ancestor slot and lack an item in the ours or theirs slot. */
1181
+ if (!GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_src->ancestor_entry))
1182
+ continue;
1183
+
1184
+ if (!GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_src->our_entry)) {
1185
+ error = deletes_by_oid_enqueue(ours_deletes_by_oid, &diff_list->pool, &conflict_src->ancestor_entry.id, i);
1186
+ if (error < 0)
1187
+ goto done;
1188
+ }
1189
+
1190
+ if (!GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_src->their_entry)) {
1191
+ error = deletes_by_oid_enqueue(theirs_deletes_by_oid, &diff_list->pool, &conflict_src->ancestor_entry.id, i);
1192
+ if (error < 0)
1193
+ goto done;
1194
+ }
1195
+ }
1196
+
1197
+ git_vector_foreach(&diff_list->conflicts, j, conflict_tgt) {
1198
+ if (GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_tgt->ancestor_entry))
1199
+ continue;
1200
+
1201
+ if (GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_tgt->our_entry)) {
1202
+ if (deletes_by_oid_dequeue(&i, ours_deletes_by_oid, &conflict_tgt->our_entry.id) == 0) {
1203
+ similarity_ours[i].similarity = 100;
1204
+ similarity_ours[i].other_idx = j;
1205
+
1206
+ similarity_ours[j].similarity = 100;
1207
+ similarity_ours[j].other_idx = i;
1208
+ }
1209
+ }
1210
+
1211
+ if (GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_tgt->their_entry)) {
1212
+ if (deletes_by_oid_dequeue(&i, theirs_deletes_by_oid, &conflict_tgt->their_entry.id) == 0) {
1213
+ similarity_theirs[i].similarity = 100;
1214
+ similarity_theirs[i].other_idx = j;
1215
+
1216
+ similarity_theirs[j].similarity = 100;
1217
+ similarity_theirs[j].other_idx = i;
1218
+ }
1219
+ }
1220
+ }
1221
+
1222
+ done:
1223
+ deletes_by_oid_free(ours_deletes_by_oid);
1224
+ deletes_by_oid_free(theirs_deletes_by_oid);
1225
+
1226
+ return error;
1227
+ }
1228
+
1229
+ static int merge_diff_mark_similarity_inexact(
1106
1230
  git_repository *repo,
1107
1231
  git_merge_diff_list *diff_list,
1108
1232
  struct merge_diff_similarity *similarity_ours,
1109
1233
  struct merge_diff_similarity *similarity_theirs,
1110
- int (*similarity_fn)(git_repository *, git_index_entry *, size_t, git_index_entry *, size_t, void **, const git_merge_options *),
1111
1234
  void **cache,
1112
1235
  const git_merge_options *opts)
1113
1236
  {
@@ -1132,7 +1255,7 @@ static int merge_diff_mark_similarity(
1132
1255
 
1133
1256
  if (GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_tgt->our_entry) &&
1134
1257
  !GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_src->our_entry)) {
1135
- similarity = similarity_fn(repo, &conflict_src->ancestor_entry, i, &conflict_tgt->our_entry, our_idx, cache, opts);
1258
+ similarity = index_entry_similarity_inexact(repo, &conflict_src->ancestor_entry, i, &conflict_tgt->our_entry, our_idx, cache, opts);
1136
1259
 
1137
1260
  if (similarity == GIT_EBUFS)
1138
1261
  continue;
@@ -1158,7 +1281,7 @@ static int merge_diff_mark_similarity(
1158
1281
 
1159
1282
  if (GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_tgt->their_entry) &&
1160
1283
  !GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_src->their_entry)) {
1161
- similarity = similarity_fn(repo, &conflict_src->ancestor_entry, i, &conflict_tgt->their_entry, their_idx, cache, opts);
1284
+ similarity = index_entry_similarity_inexact(repo, &conflict_src->ancestor_entry, i, &conflict_tgt->their_entry, their_idx, cache, opts);
1162
1285
 
1163
1286
  if (similarity > similarity_theirs[i].similarity &&
1164
1287
  similarity > similarity_theirs[j].similarity) {
@@ -1396,11 +1519,10 @@ int git_merge_diff_list__find_renames(
1396
1519
  /* Calculate similarity between items that were deleted from the ancestor
1397
1520
  * and added in the other branch.
1398
1521
  */
1399
- if ((error = merge_diff_mark_similarity(repo, diff_list, similarity_ours,
1400
- similarity_theirs, index_entry_similarity_exact, NULL, opts)) < 0)
1522
+ if ((error = merge_diff_mark_similarity_exact(diff_list, similarity_ours, similarity_theirs)) < 0)
1401
1523
  goto done;
1402
1524
 
1403
- if (diff_list->conflicts.length <= opts->target_limit) {
1525
+ if (opts->rename_threshold < 100 && diff_list->conflicts.length <= opts->target_limit) {
1404
1526
  GITERR_CHECK_ALLOC_MULTIPLY(&cache_size, diff_list->conflicts.length, 3);
1405
1527
  cache = git__calloc(cache_size, sizeof(void *));
1406
1528
  GITERR_CHECK_ALLOC(cache);
@@ -1410,9 +1532,8 @@ int git_merge_diff_list__find_renames(
1410
1532
  if (src_count > opts->target_limit || tgt_count > opts->target_limit) {
1411
1533
  /* TODO: report! */
1412
1534
  } else {
1413
- if ((error = merge_diff_mark_similarity(
1414
- repo, diff_list, similarity_ours, similarity_theirs,
1415
- index_entry_similarity_inexact, cache, opts)) < 0)
1535
+ if ((error = merge_diff_mark_similarity_inexact(
1536
+ repo, diff_list, similarity_ours, similarity_theirs, cache, opts)) < 0)
1416
1537
  goto done;
1417
1538
  }
1418
1539
  }
@@ -1954,6 +2075,7 @@ int git_merge__iterators(
1954
2075
  file_opts.our_label = "Temporary merge branch 1";
1955
2076
  file_opts.their_label = "Temporary merge branch 2";
1956
2077
  file_opts.flags |= GIT_MERGE_FILE_FAVOR__CONFLICTED;
2078
+ file_opts.marker_size = GIT_MERGE_CONFLICT_MARKER_SIZE + 2;
1957
2079
  }
1958
2080
 
1959
2081
  diff_list = git_merge_diff_list__alloc(repo);