rugged 0.27.10 → 0.27.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (420) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rugged/version.rb +1 -1
  3. data/vendor/libgit2/AUTHORS +0 -1
  4. data/vendor/libgit2/CMakeLists.txt +54 -98
  5. data/vendor/libgit2/COPYING +0 -28
  6. data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +1 -15
  7. data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +8 -9
  8. data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +2 -2
  9. data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +1 -1
  10. data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
  11. data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +0 -6
  12. data/vendor/libgit2/deps/http-parser/CMakeLists.txt +0 -2
  13. data/vendor/libgit2/deps/http-parser/{COPYING → LICENSE-MIT} +0 -0
  14. data/vendor/libgit2/deps/http-parser/http_parser.c +6 -11
  15. data/vendor/libgit2/deps/regex/CMakeLists.txt +2 -0
  16. data/vendor/libgit2/deps/regex/config.h +7 -0
  17. data/vendor/libgit2/deps/regex/regcomp.c +3857 -0
  18. data/vendor/libgit2/deps/regex/regex.c +92 -0
  19. data/vendor/libgit2/deps/regex/regex.h +582 -0
  20. data/vendor/libgit2/deps/regex/regex_internal.c +1744 -0
  21. data/vendor/libgit2/deps/regex/regex_internal.h +819 -0
  22. data/vendor/libgit2/deps/regex/regexec.c +4369 -0
  23. data/vendor/libgit2/deps/zlib/CMakeLists.txt +0 -1
  24. data/vendor/libgit2/deps/zlib/adler32.c +7 -0
  25. data/vendor/libgit2/deps/zlib/crc32.c +7 -0
  26. data/vendor/libgit2/include/git2.h +0 -5
  27. data/vendor/libgit2/include/git2/annotated_commit.h +0 -9
  28. data/vendor/libgit2/include/git2/attr.h +20 -38
  29. data/vendor/libgit2/include/git2/blame.h +25 -42
  30. data/vendor/libgit2/include/git2/blob.h +13 -45
  31. data/vendor/libgit2/include/git2/branch.h +1 -1
  32. data/vendor/libgit2/include/git2/buffer.h +16 -22
  33. data/vendor/libgit2/include/git2/checkout.h +32 -65
  34. data/vendor/libgit2/include/git2/cherrypick.h +7 -9
  35. data/vendor/libgit2/include/git2/clone.h +10 -12
  36. data/vendor/libgit2/include/git2/commit.h +3 -53
  37. data/vendor/libgit2/include/git2/common.h +8 -60
  38. data/vendor/libgit2/include/git2/config.h +19 -30
  39. data/vendor/libgit2/include/git2/describe.h +9 -32
  40. data/vendor/libgit2/include/git2/diff.h +156 -208
  41. data/vendor/libgit2/include/git2/errors.h +46 -54
  42. data/vendor/libgit2/include/git2/filter.h +0 -8
  43. data/vendor/libgit2/include/git2/ignore.h +2 -2
  44. data/vendor/libgit2/include/git2/index.h +52 -74
  45. data/vendor/libgit2/include/git2/indexer.h +6 -76
  46. data/vendor/libgit2/include/git2/inttypes.h +309 -0
  47. data/vendor/libgit2/include/git2/merge.h +18 -35
  48. data/vendor/libgit2/include/git2/net.h +5 -0
  49. data/vendor/libgit2/include/git2/notes.h +1 -1
  50. data/vendor/libgit2/include/git2/object.h +29 -17
  51. data/vendor/libgit2/include/git2/odb.h +11 -12
  52. data/vendor/libgit2/include/git2/odb_backend.h +9 -10
  53. data/vendor/libgit2/include/git2/oid.h +2 -2
  54. data/vendor/libgit2/include/git2/pack.h +3 -14
  55. data/vendor/libgit2/include/git2/proxy.h +8 -14
  56. data/vendor/libgit2/include/git2/rebase.h +6 -53
  57. data/vendor/libgit2/include/git2/refs.h +15 -33
  58. data/vendor/libgit2/include/git2/refspec.h +0 -17
  59. data/vendor/libgit2/include/git2/remote.h +24 -123
  60. data/vendor/libgit2/include/git2/repository.h +39 -76
  61. data/vendor/libgit2/include/git2/revert.h +4 -6
  62. data/vendor/libgit2/include/git2/revwalk.h +7 -7
  63. data/vendor/libgit2/include/git2/signature.h +2 -2
  64. data/vendor/libgit2/include/git2/stash.h +12 -15
  65. data/vendor/libgit2/include/git2/status.h +20 -33
  66. data/vendor/libgit2/include/git2/submodule.h +12 -30
  67. data/vendor/libgit2/include/git2/sys/commit.h +1 -1
  68. data/vendor/libgit2/include/git2/sys/config.h +13 -13
  69. data/vendor/libgit2/include/git2/sys/filter.h +6 -6
  70. data/vendor/libgit2/include/git2/sys/index.h +0 -3
  71. data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
  72. data/vendor/libgit2/include/git2/sys/merge.h +4 -9
  73. data/vendor/libgit2/include/git2/sys/odb_backend.h +22 -66
  74. data/vendor/libgit2/include/git2/sys/refdb_backend.h +40 -76
  75. data/vendor/libgit2/include/git2/sys/repository.h +1 -5
  76. data/vendor/libgit2/include/git2/sys/stream.h +12 -92
  77. data/vendor/libgit2/include/git2/sys/time.h +31 -0
  78. data/vendor/libgit2/include/git2/sys/transport.h +83 -129
  79. data/vendor/libgit2/include/git2/tag.h +4 -13
  80. data/vendor/libgit2/include/git2/trace.h +2 -2
  81. data/vendor/libgit2/include/git2/transaction.h +0 -1
  82. data/vendor/libgit2/include/git2/transport.h +311 -11
  83. data/vendor/libgit2/include/git2/tree.h +4 -4
  84. data/vendor/libgit2/include/git2/types.h +111 -33
  85. data/vendor/libgit2/include/git2/version.h +4 -4
  86. data/vendor/libgit2/include/git2/worktree.h +13 -48
  87. data/vendor/libgit2/libgit2.pc.in +13 -0
  88. data/vendor/libgit2/src/CMakeLists.txt +164 -96
  89. data/vendor/libgit2/src/annotated_commit.c +8 -15
  90. data/vendor/libgit2/src/apply.c +31 -537
  91. data/vendor/libgit2/src/apply.h +1 -3
  92. data/vendor/libgit2/src/array.h +2 -2
  93. data/vendor/libgit2/src/attr.c +75 -81
  94. data/vendor/libgit2/src/attr_file.c +121 -207
  95. data/vendor/libgit2/src/attr_file.h +9 -9
  96. data/vendor/libgit2/src/attrcache.c +53 -51
  97. data/vendor/libgit2/src/attrcache.h +1 -2
  98. data/vendor/libgit2/src/blame.c +20 -47
  99. data/vendor/libgit2/src/blame.h +1 -2
  100. data/vendor/libgit2/src/blame_git.c +20 -37
  101. data/vendor/libgit2/src/blob.c +42 -128
  102. data/vendor/libgit2/src/blob.h +2 -19
  103. data/vendor/libgit2/src/branch.c +43 -67
  104. data/vendor/libgit2/src/buf_text.c +6 -7
  105. data/vendor/libgit2/src/buffer.c +57 -69
  106. data/vendor/libgit2/src/buffer.h +1 -1
  107. data/vendor/libgit2/src/cache.c +45 -38
  108. data/vendor/libgit2/src/cache.h +3 -3
  109. data/vendor/libgit2/src/cc-compat.h +3 -20
  110. data/vendor/libgit2/src/checkout.c +90 -109
  111. data/vendor/libgit2/src/cherrypick.c +9 -15
  112. data/vendor/libgit2/src/clone.c +27 -49
  113. data/vendor/libgit2/src/clone.h +0 -4
  114. data/vendor/libgit2/src/commit.c +49 -117
  115. data/vendor/libgit2/src/commit.h +0 -7
  116. data/vendor/libgit2/src/commit_list.c +78 -30
  117. data/vendor/libgit2/src/commit_list.h +2 -2
  118. data/vendor/libgit2/src/common.h +91 -27
  119. data/vendor/libgit2/src/config.c +176 -194
  120. data/vendor/libgit2/src/config.h +20 -8
  121. data/vendor/libgit2/src/config_cache.c +35 -41
  122. data/vendor/libgit2/src/config_file.c +753 -439
  123. data/vendor/libgit2/src/config_file.h +73 -0
  124. data/vendor/libgit2/src/config_parse.c +63 -114
  125. data/vendor/libgit2/src/config_parse.h +16 -17
  126. data/vendor/libgit2/src/crlf.c +190 -219
  127. data/vendor/libgit2/src/delta.c +18 -25
  128. data/vendor/libgit2/src/describe.c +41 -42
  129. data/vendor/libgit2/src/diff.c +68 -53
  130. data/vendor/libgit2/src/diff.h +1 -2
  131. data/vendor/libgit2/src/diff_driver.c +49 -47
  132. data/vendor/libgit2/src/diff_file.c +17 -19
  133. data/vendor/libgit2/src/diff_file.h +1 -1
  134. data/vendor/libgit2/src/diff_generate.c +106 -162
  135. data/vendor/libgit2/src/diff_generate.h +3 -3
  136. data/vendor/libgit2/src/diff_parse.c +4 -4
  137. data/vendor/libgit2/src/diff_print.c +30 -42
  138. data/vendor/libgit2/src/diff_stats.c +7 -22
  139. data/vendor/libgit2/src/diff_tform.c +16 -16
  140. data/vendor/libgit2/src/diff_xdiff.c +3 -15
  141. data/vendor/libgit2/src/errors.c +39 -51
  142. data/vendor/libgit2/src/features.h.in +3 -11
  143. data/vendor/libgit2/src/fetch.c +5 -10
  144. data/vendor/libgit2/src/fetchhead.c +17 -17
  145. data/vendor/libgit2/src/filebuf.c +36 -32
  146. data/vendor/libgit2/src/filebuf.h +2 -2
  147. data/vendor/libgit2/src/{futils.c → fileops.c} +73 -80
  148. data/vendor/libgit2/src/{futils.h → fileops.h} +6 -6
  149. data/vendor/libgit2/src/filter.c +38 -46
  150. data/vendor/libgit2/src/filter.h +10 -0
  151. data/vendor/libgit2/src/fnmatch.c +248 -0
  152. data/vendor/libgit2/src/fnmatch.h +48 -0
  153. data/vendor/libgit2/src/global.c +63 -48
  154. data/vendor/libgit2/src/global.h +2 -0
  155. data/vendor/libgit2/src/hash.c +0 -61
  156. data/vendor/libgit2/src/hash.h +19 -20
  157. data/vendor/libgit2/src/hash/hash_collisiondetect.h +47 -0
  158. data/vendor/libgit2/src/hash/{sha1/common_crypto.c → hash_common_crypto.h} +17 -17
  159. data/vendor/libgit2/src/hash/{sha1/generic.c → hash_generic.c} +10 -22
  160. data/vendor/libgit2/src/hash/{sha1/generic.h → hash_generic.h} +10 -4
  161. data/vendor/libgit2/src/hash/hash_openssl.h +59 -0
  162. data/vendor/libgit2/src/hash/{sha1/win32.c → hash_win32.c} +37 -47
  163. data/vendor/libgit2/src/hash/{sha1/win32.h → hash_win32.h} +19 -6
  164. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.c +3 -14
  165. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.h +0 -0
  166. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.c +0 -0
  167. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.h +0 -0
  168. data/vendor/libgit2/src/hashsig.c +5 -5
  169. data/vendor/libgit2/src/idxmap.c +61 -107
  170. data/vendor/libgit2/src/idxmap.h +31 -153
  171. data/vendor/libgit2/src/ignore.c +47 -43
  172. data/vendor/libgit2/src/index.c +232 -337
  173. data/vendor/libgit2/src/index.h +1 -17
  174. data/vendor/libgit2/src/indexer.c +175 -346
  175. data/vendor/libgit2/src/integer.h +26 -71
  176. data/vendor/libgit2/src/iterator.c +70 -142
  177. data/vendor/libgit2/src/iterator.h +0 -15
  178. data/vendor/libgit2/src/khash.h +1 -3
  179. data/vendor/libgit2/src/map.h +1 -1
  180. data/vendor/libgit2/src/merge.c +100 -144
  181. data/vendor/libgit2/src/merge_driver.c +11 -11
  182. data/vendor/libgit2/src/merge_file.c +2 -2
  183. data/vendor/libgit2/src/mwindow.c +29 -24
  184. data/vendor/libgit2/src/mwindow.h +4 -4
  185. data/vendor/libgit2/src/netops.c +156 -55
  186. data/vendor/libgit2/src/netops.h +23 -3
  187. data/vendor/libgit2/src/notes.c +11 -16
  188. data/vendor/libgit2/src/object.c +69 -120
  189. data/vendor/libgit2/src/object.h +9 -22
  190. data/vendor/libgit2/src/object_api.c +8 -8
  191. data/vendor/libgit2/src/odb.c +93 -116
  192. data/vendor/libgit2/src/odb.h +7 -8
  193. data/vendor/libgit2/src/odb_loose.c +55 -62
  194. data/vendor/libgit2/src/odb_mempack.c +34 -21
  195. data/vendor/libgit2/src/odb_pack.c +14 -18
  196. data/vendor/libgit2/src/offmap.c +35 -53
  197. data/vendor/libgit2/src/offmap.h +21 -108
  198. data/vendor/libgit2/src/oid.c +7 -12
  199. data/vendor/libgit2/src/oidmap.c +47 -49
  200. data/vendor/libgit2/src/oidmap.h +24 -101
  201. data/vendor/libgit2/src/pack-objects.c +87 -88
  202. data/vendor/libgit2/src/pack-objects.h +8 -2
  203. data/vendor/libgit2/src/pack.c +101 -99
  204. data/vendor/libgit2/src/pack.h +19 -17
  205. data/vendor/libgit2/src/parse.c +0 -10
  206. data/vendor/libgit2/src/parse.h +3 -3
  207. data/vendor/libgit2/src/patch.c +4 -4
  208. data/vendor/libgit2/src/patch_generate.c +20 -20
  209. data/vendor/libgit2/src/patch_parse.c +63 -151
  210. data/vendor/libgit2/src/path.c +104 -117
  211. data/vendor/libgit2/src/path.h +71 -3
  212. data/vendor/libgit2/src/pathspec.c +19 -19
  213. data/vendor/libgit2/src/pool.c +22 -26
  214. data/vendor/libgit2/src/pool.h +7 -7
  215. data/vendor/libgit2/src/posix.c +10 -10
  216. data/vendor/libgit2/src/posix.h +1 -12
  217. data/vendor/libgit2/src/proxy.c +3 -8
  218. data/vendor/libgit2/src/push.c +31 -37
  219. data/vendor/libgit2/src/push.h +1 -2
  220. data/vendor/libgit2/src/rebase.c +59 -115
  221. data/vendor/libgit2/src/refdb.c +3 -15
  222. data/vendor/libgit2/src/refdb_fs.c +254 -381
  223. data/vendor/libgit2/src/reflog.c +15 -13
  224. data/vendor/libgit2/src/refs.c +88 -118
  225. data/vendor/libgit2/src/refs.h +3 -5
  226. data/vendor/libgit2/src/refspec.c +37 -56
  227. data/vendor/libgit2/src/refspec.h +1 -1
  228. data/vendor/libgit2/src/remote.c +215 -266
  229. data/vendor/libgit2/src/remote.h +2 -11
  230. data/vendor/libgit2/src/repository.c +225 -280
  231. data/vendor/libgit2/src/repository.h +40 -52
  232. data/vendor/libgit2/src/reset.c +8 -8
  233. data/vendor/libgit2/src/revert.c +9 -14
  234. data/vendor/libgit2/src/revparse.c +48 -47
  235. data/vendor/libgit2/src/revwalk.c +57 -120
  236. data/vendor/libgit2/src/revwalk.h +1 -22
  237. data/vendor/libgit2/src/settings.c +10 -47
  238. data/vendor/libgit2/src/signature.c +11 -11
  239. data/vendor/libgit2/src/sortedcache.c +36 -22
  240. data/vendor/libgit2/src/sortedcache.h +1 -1
  241. data/vendor/libgit2/src/stash.c +99 -125
  242. data/vendor/libgit2/src/status.c +22 -28
  243. data/vendor/libgit2/src/stream.h +2 -17
  244. data/vendor/libgit2/src/streams/curl.c +385 -0
  245. data/vendor/libgit2/src/{allocators/stdalloc.h → streams/curl.h} +5 -5
  246. data/vendor/libgit2/src/streams/openssl.c +114 -224
  247. data/vendor/libgit2/src/streams/openssl.h +108 -4
  248. data/vendor/libgit2/src/streams/socket.c +30 -55
  249. data/vendor/libgit2/src/streams/stransport.c +32 -57
  250. data/vendor/libgit2/src/streams/stransport.h +0 -5
  251. data/vendor/libgit2/src/streams/tls.c +19 -50
  252. data/vendor/libgit2/src/streams/tls.h +4 -12
  253. data/vendor/libgit2/src/strmap.c +74 -47
  254. data/vendor/libgit2/src/strmap.h +33 -108
  255. data/vendor/libgit2/src/submodule.c +216 -272
  256. data/vendor/libgit2/src/submodule.h +1 -1
  257. data/vendor/libgit2/src/sysdir.c +19 -29
  258. data/vendor/libgit2/src/tag.c +28 -41
  259. data/vendor/libgit2/src/tag.h +1 -2
  260. data/vendor/libgit2/src/trace.c +2 -2
  261. data/vendor/libgit2/src/trace.h +3 -3
  262. data/vendor/libgit2/src/trailer.c +38 -52
  263. data/vendor/libgit2/src/transaction.c +29 -30
  264. data/vendor/libgit2/src/transport.c +5 -5
  265. data/vendor/libgit2/src/transports/auth.c +11 -15
  266. data/vendor/libgit2/src/transports/auth.h +3 -10
  267. data/vendor/libgit2/src/transports/auth_negotiate.c +18 -33
  268. data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
  269. data/vendor/libgit2/src/transports/cred.c +24 -24
  270. data/vendor/libgit2/src/{allocators/win32_crtdbg.h → transports/cred.h} +4 -5
  271. data/vendor/libgit2/src/transports/git.c +31 -26
  272. data/vendor/libgit2/src/transports/http.c +348 -881
  273. data/vendor/libgit2/src/transports/http.h +0 -2
  274. data/vendor/libgit2/src/transports/local.c +35 -35
  275. data/vendor/libgit2/src/transports/smart.c +47 -70
  276. data/vendor/libgit2/src/transports/smart.h +4 -3
  277. data/vendor/libgit2/src/transports/smart_pkt.c +40 -43
  278. data/vendor/libgit2/src/transports/smart_protocol.c +116 -96
  279. data/vendor/libgit2/src/transports/ssh.c +66 -77
  280. data/vendor/libgit2/src/transports/winhttp.c +314 -318
  281. data/vendor/libgit2/src/tree-cache.c +12 -19
  282. data/vendor/libgit2/src/tree.c +142 -103
  283. data/vendor/libgit2/src/tree.h +12 -1
  284. data/vendor/libgit2/src/unix/map.c +3 -3
  285. data/vendor/libgit2/src/unix/posix.h +11 -1
  286. data/vendor/libgit2/src/userdiff.h +1 -3
  287. data/vendor/libgit2/src/util.c +56 -70
  288. data/vendor/libgit2/src/util.h +156 -28
  289. data/vendor/libgit2/src/vector.c +4 -4
  290. data/vendor/libgit2/src/win32/dir.c +3 -3
  291. data/vendor/libgit2/src/win32/findfile.c +3 -3
  292. data/vendor/libgit2/src/win32/map.c +11 -9
  293. data/vendor/libgit2/src/win32/msvc-compat.h +0 -6
  294. data/vendor/libgit2/src/win32/path_w32.c +9 -113
  295. data/vendor/libgit2/src/win32/path_w32.h +29 -18
  296. data/vendor/libgit2/src/win32/posix.h +4 -1
  297. data/vendor/libgit2/src/win32/posix_w32.c +45 -70
  298. data/vendor/libgit2/src/win32/precompiled.h +2 -0
  299. data/vendor/libgit2/src/win32/thread.c +10 -5
  300. data/vendor/libgit2/src/win32/w32_buffer.c +5 -9
  301. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -3
  302. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +75 -26
  303. data/vendor/libgit2/src/win32/w32_stack.c +11 -6
  304. data/vendor/libgit2/src/win32/w32_stack.h +3 -3
  305. data/vendor/libgit2/src/win32/w32_util.c +64 -27
  306. data/vendor/libgit2/src/win32/w32_util.h +49 -5
  307. data/vendor/libgit2/src/worktree.c +60 -95
  308. data/vendor/libgit2/src/worktree.h +0 -2
  309. data/vendor/libgit2/src/xdiff/xdiffi.c +5 -7
  310. data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
  311. data/vendor/libgit2/src/xdiff/xmerge.c +15 -27
  312. data/vendor/libgit2/src/xdiff/xpatience.c +0 -3
  313. data/vendor/libgit2/src/zstream.c +4 -4
  314. metadata +33 -122
  315. data/vendor/libgit2/cmake/Modules/FindGSSFramework.cmake +0 -28
  316. data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +0 -38
  317. data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +0 -37
  318. data/vendor/libgit2/cmake/Modules/FindmbedTLS.cmake +0 -93
  319. data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +0 -110
  320. data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +0 -53
  321. data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +0 -124
  322. data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +0 -66
  323. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +0 -21
  324. data/vendor/libgit2/deps/ntlmclient/compat.h +0 -33
  325. data/vendor/libgit2/deps/ntlmclient/crypt.h +0 -64
  326. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +0 -120
  327. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +0 -18
  328. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +0 -145
  329. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +0 -18
  330. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +0 -130
  331. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +0 -21
  332. data/vendor/libgit2/deps/ntlmclient/ntlm.c +0 -1420
  333. data/vendor/libgit2/deps/ntlmclient/ntlm.h +0 -174
  334. data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +0 -320
  335. data/vendor/libgit2/deps/ntlmclient/unicode.h +0 -36
  336. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +0 -445
  337. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +0 -201
  338. data/vendor/libgit2/deps/ntlmclient/utf8.h +0 -1257
  339. data/vendor/libgit2/deps/ntlmclient/util.c +0 -21
  340. data/vendor/libgit2/deps/ntlmclient/util.h +0 -14
  341. data/vendor/libgit2/deps/pcre/CMakeLists.txt +0 -140
  342. data/vendor/libgit2/deps/pcre/COPYING +0 -5
  343. data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +0 -22
  344. data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +0 -17
  345. data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +0 -58
  346. data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +0 -29
  347. data/vendor/libgit2/deps/pcre/config.h.in +0 -57
  348. data/vendor/libgit2/deps/pcre/pcre.h +0 -641
  349. data/vendor/libgit2/deps/pcre/pcre_byte_order.c +0 -319
  350. data/vendor/libgit2/deps/pcre/pcre_chartables.c +0 -198
  351. data/vendor/libgit2/deps/pcre/pcre_compile.c +0 -9800
  352. data/vendor/libgit2/deps/pcre/pcre_config.c +0 -190
  353. data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +0 -3676
  354. data/vendor/libgit2/deps/pcre/pcre_exec.c +0 -7173
  355. data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +0 -245
  356. data/vendor/libgit2/deps/pcre/pcre_get.c +0 -669
  357. data/vendor/libgit2/deps/pcre/pcre_globals.c +0 -86
  358. data/vendor/libgit2/deps/pcre/pcre_internal.h +0 -2787
  359. data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +0 -11913
  360. data/vendor/libgit2/deps/pcre/pcre_maketables.c +0 -156
  361. data/vendor/libgit2/deps/pcre/pcre_newline.c +0 -210
  362. data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +0 -94
  363. data/vendor/libgit2/deps/pcre/pcre_printint.c +0 -834
  364. data/vendor/libgit2/deps/pcre/pcre_refcount.c +0 -92
  365. data/vendor/libgit2/deps/pcre/pcre_string_utils.c +0 -211
  366. data/vendor/libgit2/deps/pcre/pcre_study.c +0 -1686
  367. data/vendor/libgit2/deps/pcre/pcre_tables.c +0 -727
  368. data/vendor/libgit2/deps/pcre/pcre_ucd.c +0 -3644
  369. data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +0 -301
  370. data/vendor/libgit2/deps/pcre/pcre_version.c +0 -98
  371. data/vendor/libgit2/deps/pcre/pcre_xclass.c +0 -268
  372. data/vendor/libgit2/deps/pcre/pcreposix.c +0 -421
  373. data/vendor/libgit2/deps/pcre/pcreposix.h +0 -117
  374. data/vendor/libgit2/deps/pcre/ucp.h +0 -224
  375. data/vendor/libgit2/deps/winhttp/COPYING.GPL +0 -993
  376. data/vendor/libgit2/deps/winhttp/COPYING.LGPL +0 -502
  377. data/vendor/libgit2/deps/zlib/COPYING +0 -27
  378. data/vendor/libgit2/include/git2/apply.h +0 -149
  379. data/vendor/libgit2/include/git2/cert.h +0 -135
  380. data/vendor/libgit2/include/git2/cred.h +0 -308
  381. data/vendor/libgit2/include/git2/deprecated.h +0 -493
  382. data/vendor/libgit2/include/git2/mailmap.h +0 -115
  383. data/vendor/libgit2/include/git2/sys/alloc.h +0 -101
  384. data/vendor/libgit2/include/git2/sys/cred.h +0 -90
  385. data/vendor/libgit2/include/git2/sys/path.h +0 -64
  386. data/vendor/libgit2/src/alloc.c +0 -43
  387. data/vendor/libgit2/src/alloc.h +0 -40
  388. data/vendor/libgit2/src/allocators/stdalloc.c +0 -119
  389. data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
  390. data/vendor/libgit2/src/config_backend.h +0 -96
  391. data/vendor/libgit2/src/config_entries.c +0 -229
  392. data/vendor/libgit2/src/config_entries.h +0 -24
  393. data/vendor/libgit2/src/config_mem.c +0 -220
  394. data/vendor/libgit2/src/config_snapshot.c +0 -206
  395. data/vendor/libgit2/src/errors.h +0 -81
  396. data/vendor/libgit2/src/hash/sha1.h +0 -38
  397. data/vendor/libgit2/src/hash/sha1/collisiondetect.c +0 -48
  398. data/vendor/libgit2/src/hash/sha1/collisiondetect.h +0 -19
  399. data/vendor/libgit2/src/hash/sha1/common_crypto.h +0 -19
  400. data/vendor/libgit2/src/hash/sha1/mbedtls.c +0 -46
  401. data/vendor/libgit2/src/hash/sha1/mbedtls.h +0 -19
  402. data/vendor/libgit2/src/hash/sha1/openssl.c +0 -59
  403. data/vendor/libgit2/src/hash/sha1/openssl.h +0 -19
  404. data/vendor/libgit2/src/mailmap.c +0 -485
  405. data/vendor/libgit2/src/mailmap.h +0 -35
  406. data/vendor/libgit2/src/net.c +0 -184
  407. data/vendor/libgit2/src/net.h +0 -36
  408. data/vendor/libgit2/src/reader.c +0 -265
  409. data/vendor/libgit2/src/reader.h +0 -107
  410. data/vendor/libgit2/src/regexp.c +0 -221
  411. data/vendor/libgit2/src/regexp.h +0 -97
  412. data/vendor/libgit2/src/streams/mbedtls.c +0 -483
  413. data/vendor/libgit2/src/streams/mbedtls.h +0 -23
  414. data/vendor/libgit2/src/streams/registry.c +0 -118
  415. data/vendor/libgit2/src/streams/registry.h +0 -19
  416. data/vendor/libgit2/src/transports/auth_ntlm.c +0 -223
  417. data/vendor/libgit2/src/transports/auth_ntlm.h +0 -35
  418. data/vendor/libgit2/src/wildmatch.c +0 -320
  419. data/vendor/libgit2/src/wildmatch.h +0 -23
  420. data/vendor/libgit2/src/win32/w32_common.h +0 -39
@@ -57,8 +57,7 @@ extern int git_diff_delta__format_file_header(
57
57
  const git_diff_delta *delta,
58
58
  const char *oldpfx,
59
59
  const char *newpfx,
60
- int oid_strlen,
61
- bool print_index);
60
+ int oid_strlen);
62
61
 
63
62
  extern int git_diff_delta__cmp(const void *a, const void *b);
64
63
  extern int git_diff_delta__casecmp(const void *a, const void *b);
@@ -9,13 +9,11 @@
9
9
 
10
10
  #include "git2/attr.h"
11
11
 
12
- #include "common.h"
13
12
  #include "diff.h"
14
13
  #include "strmap.h"
15
14
  #include "map.h"
16
15
  #include "buf_text.h"
17
16
  #include "config.h"
18
- #include "regexp.h"
19
17
  #include "repository.h"
20
18
 
21
19
  typedef enum {
@@ -26,7 +24,7 @@ typedef enum {
26
24
  } git_diff_driver_t;
27
25
 
28
26
  typedef struct {
29
- git_regexp re;
27
+ regex_t re;
30
28
  int flags;
31
29
  } git_diff_driver_pattern;
32
30
 
@@ -40,7 +38,7 @@ struct git_diff_driver {
40
38
  uint32_t binary_flags;
41
39
  uint32_t other_flags;
42
40
  git_array_t(git_diff_driver_pattern) fn_patterns;
43
- git_regexp word_pattern;
41
+ regex_t word_pattern;
44
42
  char name[GIT_FLEX_ARRAY];
45
43
  };
46
44
 
@@ -65,7 +63,7 @@ git_diff_driver_registry *git_diff_driver_registry_new(void)
65
63
  if (!reg)
66
64
  return NULL;
67
65
 
68
- if (git_strmap_new(&reg->drivers) < 0) {
66
+ if (git_strmap_alloc(&reg->drivers) < 0) {
69
67
  git_diff_driver_registry_free(reg);
70
68
  return NULL;
71
69
  }
@@ -114,7 +112,7 @@ static int diff_driver_add_patterns(
114
112
  if (error < 0)
115
113
  break;
116
114
 
117
- if ((error = git_regexp_compile(&pat->re, buf.ptr, regex_flags)) != 0) {
115
+ if ((error = p_regcomp(&pat->re, buf.ptr, regex_flags)) != 0) {
118
116
  /*
119
117
  * TODO: issue a warning
120
118
  */
@@ -123,7 +121,7 @@ static int diff_driver_add_patterns(
123
121
 
124
122
  if (error && pat != NULL)
125
123
  (void)git_array_pop(drv->fn_patterns); /* release last item */
126
- git_buf_dispose(&buf);
124
+ git_buf_free(&buf);
127
125
 
128
126
  /* We want to ignore bad patterns, so return success regardless */
129
127
  return 0;
@@ -131,7 +129,7 @@ static int diff_driver_add_patterns(
131
129
 
132
130
  static int diff_driver_xfuncname(const git_config_entry *entry, void *payload)
133
131
  {
134
- return diff_driver_add_patterns(payload, entry->value, 0);
132
+ return diff_driver_add_patterns(payload, entry->value, REG_EXTENDED);
135
133
  }
136
134
 
137
135
  static int diff_driver_funcname(const git_config_entry *entry, void *payload)
@@ -151,7 +149,7 @@ static git_diff_driver_registry *git_repository_driver_registry(
151
149
  }
152
150
 
153
151
  if (!repo->diff_drivers)
154
- git_error_set(GIT_ERROR_REPOSITORY, "unable to create diff driver registry");
152
+ giterr_set(GITERR_REPOSITORY, "unable to create diff driver registry");
155
153
 
156
154
  return repo->diff_drivers;
157
155
  }
@@ -164,11 +162,11 @@ static int diff_driver_alloc(
164
162
  namelen = strlen(name),
165
163
  alloclen;
166
164
 
167
- GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, driverlen, namelen);
168
- GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
165
+ GITERR_CHECK_ALLOC_ADD(&alloclen, driverlen, namelen);
166
+ GITERR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
169
167
 
170
168
  driver = git__calloc(1, alloclen);
171
- GIT_ERROR_CHECK_ALLOC(driver);
169
+ GITERR_CHECK_ALLOC(driver);
172
170
 
173
171
  memcpy(driver->name, name, namelen);
174
172
 
@@ -185,9 +183,9 @@ static int git_diff_driver_builtin(
185
183
  git_diff_driver_registry *reg,
186
184
  const char *driver_name)
187
185
  {
186
+ int error = 0;
188
187
  git_diff_driver_definition *ddef = NULL;
189
188
  git_diff_driver *drv = NULL;
190
- int error = 0;
191
189
  size_t idx;
192
190
 
193
191
  for (idx = 0; idx < ARRAY_SIZE(builtin_defs); ++idx) {
@@ -206,15 +204,20 @@ static int git_diff_driver_builtin(
206
204
 
207
205
  if (ddef->fns &&
208
206
  (error = diff_driver_add_patterns(
209
- drv, ddef->fns, ddef->flags)) < 0)
207
+ drv, ddef->fns, ddef->flags | REG_EXTENDED)) < 0)
210
208
  goto done;
211
209
 
212
210
  if (ddef->words &&
213
- (error = git_regexp_compile(&drv->word_pattern, ddef->words, ddef->flags)) < 0)
211
+ (error = p_regcomp(
212
+ &drv->word_pattern, ddef->words, ddef->flags | REG_EXTENDED)))
213
+ {
214
+ error = giterr_set_regex(&drv->word_pattern, error);
214
215
  goto done;
216
+ }
215
217
 
216
- if ((error = git_strmap_set(reg->drivers, drv->name, drv)) < 0)
217
- goto done;
218
+ git_strmap_insert(reg->drivers, drv->name, drv, &error);
219
+ if (error > 0)
220
+ error = 0;
218
221
 
219
222
  done:
220
223
  if (error && drv)
@@ -230,8 +233,9 @@ static int git_diff_driver_load(
230
233
  {
231
234
  int error = 0;
232
235
  git_diff_driver_registry *reg;
233
- git_diff_driver *drv;
236
+ git_diff_driver *drv = NULL;
234
237
  size_t namelen;
238
+ khiter_t pos;
235
239
  git_config *cfg = NULL;
236
240
  git_buf name = GIT_BUF_INIT;
237
241
  git_config_entry *ce = NULL;
@@ -240,8 +244,9 @@ static int git_diff_driver_load(
240
244
  if ((reg = git_repository_driver_registry(repo)) == NULL)
241
245
  return -1;
242
246
 
243
- if ((drv = git_strmap_get(reg->drivers, driver_name)) != NULL) {
244
- *out = drv;
247
+ pos = git_strmap_lookup_index(reg->drivers, driver_name);
248
+ if (git_strmap_valid_index(reg->drivers, pos)) {
249
+ *out = git_strmap_value_at(reg->drivers, pos);
245
250
  return 0;
246
251
  }
247
252
 
@@ -252,7 +257,7 @@ static int git_diff_driver_load(
252
257
 
253
258
  /* if you can't read config for repo, just use default driver */
254
259
  if (git_repository_config_snapshot(&cfg, repo) < 0) {
255
- git_error_clear();
260
+ giterr_clear();
256
261
  goto done;
257
262
  }
258
263
 
@@ -278,25 +283,21 @@ static int git_diff_driver_load(
278
283
  /* TODO: warn if diff.<name>.command or diff.<name>.textconv are set */
279
284
 
280
285
  git_buf_truncate(&name, namelen + strlen("diff.."));
281
- if ((error = git_buf_PUTS(&name, "xfuncname")) < 0)
282
- goto done;
283
-
286
+ git_buf_put(&name, "xfuncname", strlen("xfuncname"));
284
287
  if ((error = git_config_get_multivar_foreach(
285
288
  cfg, name.ptr, NULL, diff_driver_xfuncname, drv)) < 0) {
286
289
  if (error != GIT_ENOTFOUND)
287
290
  goto done;
288
- git_error_clear(); /* no diff.<driver>.xfuncname, so just continue */
291
+ giterr_clear(); /* no diff.<driver>.xfuncname, so just continue */
289
292
  }
290
293
 
291
294
  git_buf_truncate(&name, namelen + strlen("diff.."));
292
- if ((error = git_buf_PUTS(&name, "funcname")) < 0)
293
- goto done;
294
-
295
+ git_buf_put(&name, "funcname", strlen("funcname"));
295
296
  if ((error = git_config_get_multivar_foreach(
296
297
  cfg, name.ptr, NULL, diff_driver_funcname, drv)) < 0) {
297
298
  if (error != GIT_ENOTFOUND)
298
299
  goto done;
299
- git_error_clear(); /* no diff.<driver>.funcname, so just continue */
300
+ giterr_clear(); /* no diff.<driver>.funcname, so just continue */
300
301
  }
301
302
 
302
303
  /* if we found any patterns, set driver type to use correct callback */
@@ -306,17 +307,16 @@ static int git_diff_driver_load(
306
307
  }
307
308
 
308
309
  git_buf_truncate(&name, namelen + strlen("diff.."));
309
- if ((error = git_buf_PUTS(&name, "wordregex")) < 0)
310
- goto done;
311
-
310
+ git_buf_put(&name, "wordregex", strlen("wordregex"));
312
311
  if ((error = git_config__lookup_entry(&ce, cfg, name.ptr, false)) < 0)
313
312
  goto done;
314
313
  if (!ce || !ce->value)
315
314
  /* no diff.<driver>.wordregex, so just continue */;
316
- else if (!(error = git_regexp_compile(&drv->word_pattern, ce->value, 0)))
315
+ else if (!(error = p_regcomp(&drv->word_pattern, ce->value, REG_EXTENDED)))
317
316
  found_driver = true;
318
317
  else {
319
318
  /* TODO: warn about bad regex instead of failure */
319
+ error = giterr_set_regex(&drv->word_pattern, error);
320
320
  goto done;
321
321
  }
322
322
 
@@ -329,14 +329,16 @@ static int git_diff_driver_load(
329
329
  goto done;
330
330
 
331
331
  /* store driver in registry */
332
- if ((error = git_strmap_set(reg->drivers, drv->name, drv)) < 0)
332
+ git_strmap_insert(reg->drivers, drv->name, drv, &error);
333
+ if (error < 0)
333
334
  goto done;
335
+ error = 0;
334
336
 
335
337
  *out = drv;
336
338
 
337
339
  done:
338
340
  git_config_entry_free(ce);
339
- git_buf_dispose(&name);
341
+ git_buf_free(&name);
340
342
  git_config_free(cfg);
341
343
 
342
344
  if (!*out) {
@@ -367,18 +369,18 @@ int git_diff_driver_lookup(
367
369
  attrsession, 0, path, 1, attrs)) < 0)
368
370
  /* return error below */;
369
371
 
370
- else if (GIT_ATTR_IS_UNSPECIFIED(values[0]))
372
+ else if (GIT_ATTR_UNSPECIFIED(values[0]))
371
373
  /* just use the auto value */;
372
- else if (GIT_ATTR_IS_FALSE(values[0]))
374
+ else if (GIT_ATTR_FALSE(values[0]))
373
375
  *out = &global_drivers[DIFF_DRIVER_BINARY];
374
- else if (GIT_ATTR_IS_TRUE(values[0]))
376
+ else if (GIT_ATTR_TRUE(values[0]))
375
377
  *out = &global_drivers[DIFF_DRIVER_TEXT];
376
378
 
377
379
  /* otherwise look for driver information in config and build driver */
378
380
  else if ((error = git_diff_driver_load(out, repo, values[0])) < 0) {
379
381
  if (error == GIT_ENOTFOUND) {
380
382
  error = 0;
381
- git_error_clear();
383
+ giterr_clear();
382
384
  }
383
385
  }
384
386
 
@@ -396,10 +398,10 @@ void git_diff_driver_free(git_diff_driver *driver)
396
398
  return;
397
399
 
398
400
  for (i = 0; i < git_array_size(driver->fn_patterns); ++i)
399
- git_regexp_dispose(& git_array_get(driver->fn_patterns, i)->re);
401
+ regfree(& git_array_get(driver->fn_patterns, i)->re);
400
402
  git_array_clear(driver->fn_patterns);
401
403
 
402
- git_regexp_dispose(&driver->word_pattern);
404
+ regfree(&driver->word_pattern);
403
405
 
404
406
  git__free(driver);
405
407
  }
@@ -447,19 +449,19 @@ static int diff_context_line__pattern_match(
447
449
  git_diff_driver *driver, git_buf *line)
448
450
  {
449
451
  size_t i, maxi = git_array_size(driver->fn_patterns);
450
- git_regmatch pmatch[2];
452
+ regmatch_t pmatch[2];
451
453
 
452
454
  for (i = 0; i < maxi; ++i) {
453
455
  git_diff_driver_pattern *pat = git_array_get(driver->fn_patterns, i);
454
456
 
455
- if (!git_regexp_search(&pat->re, line->ptr, 2, pmatch)) {
457
+ if (!regexec(&pat->re, line->ptr, 2, pmatch, 0)) {
456
458
  if (pat->flags & REG_NEGATE)
457
459
  return false;
458
460
 
459
461
  /* use pmatch data to trim line data */
460
- i = (pmatch[1].start >= 0) ? 1 : 0;
461
- git_buf_consume(line, git_buf_cstr(line) + pmatch[i].start);
462
- git_buf_truncate(line, pmatch[i].end - pmatch[i].start);
462
+ i = (pmatch[1].rm_so >= 0) ? 1 : 0;
463
+ git_buf_consume(line, git_buf_cstr(line) + pmatch[i].rm_so);
464
+ git_buf_truncate(line, pmatch[i].rm_eo - pmatch[i].rm_so);
463
465
  git_buf_rtrim(line);
464
466
 
465
467
  return true;
@@ -514,7 +516,7 @@ void git_diff_find_context_init(
514
516
  void git_diff_find_context_clear(git_diff_find_context_payload *payload)
515
517
  {
516
518
  if (payload) {
517
- git_buf_dispose(&payload->line);
519
+ git_buf_free(&payload->line);
518
520
  payload->driver = NULL;
519
521
  }
520
522
  }
@@ -12,7 +12,7 @@
12
12
  #include "diff.h"
13
13
  #include "diff_generate.h"
14
14
  #include "odb.h"
15
- #include "futils.h"
15
+ #include "fileops.h"
16
16
  #include "filter.h"
17
17
 
18
18
  #define DIFF_MAX_FILESIZE 0x20000000
@@ -62,7 +62,7 @@ static int diff_file_content_init_common(
62
62
  git_diff_driver_update_options(&fc->opts_flags, fc->driver);
63
63
 
64
64
  /* make sure file is conceivable mmap-able */
65
- if ((size_t)fc->file->size != fc->file->size)
65
+ if ((git_off_t)((size_t)fc->file->size) != fc->file->size)
66
66
  fc->file->flags |= GIT_DIFF_FLAG_BINARY;
67
67
  /* check if user is forcing text diff the file */
68
68
  else if (fc->opts_flags & GIT_DIFF_FORCE_TEXT) {
@@ -161,7 +161,7 @@ int git_diff_file_content__init_from_src(
161
161
  fc->flags |= GIT_DIFF_FLAG__FREE_BLOB;
162
162
  } else {
163
163
  fc->file->size = src->buflen;
164
- git_odb_hash(&fc->file->id, src->buf, src->buflen, GIT_OBJECT_BLOB);
164
+ git_odb_hash(&fc->file->id, src->buf, src->buflen, GIT_OBJ_BLOB);
165
165
  fc->file->id_abbrev = GIT_OID_HEXSZ;
166
166
 
167
167
  fc->map.len = src->buflen;
@@ -188,7 +188,7 @@ static int diff_file_content_commit_to_str(
188
188
  if ((error = git_submodule_lookup(&sm, fc->repo, fc->file->path)) < 0) {
189
189
  /* GIT_EEXISTS means a "submodule" that has not been git added */
190
190
  if (error == GIT_EEXISTS) {
191
- git_error_clear();
191
+ giterr_clear();
192
192
  error = 0;
193
193
  }
194
194
  return error;
@@ -232,7 +232,7 @@ static int diff_file_content_load_blob(
232
232
  int error = 0;
233
233
  git_odb_object *odb_obj = NULL;
234
234
 
235
- if (git_oid_is_zero(&fc->file->id))
235
+ if (git_oid_iszero(&fc->file->id))
236
236
  return 0;
237
237
 
238
238
  if (fc->file->mode == GIT_FILEMODE_COMMIT)
@@ -251,7 +251,7 @@ static int diff_file_content_load_blob(
251
251
 
252
252
  if (odb_obj != NULL) {
253
253
  error = git_object__from_odb_object(
254
- (git_object **)&fc->blob, fc->repo, odb_obj, GIT_OBJECT_BLOB);
254
+ (git_object **)&fc->blob, fc->repo, odb_obj, GIT_OBJ_BLOB);
255
255
  git_odb_object_free(odb_obj);
256
256
  } else {
257
257
  error = git_blob_lookup(
@@ -280,7 +280,7 @@ static int diff_file_content_load_workdir_symlink_fake(
280
280
  fc->map.data = git_buf_detach(&target);
281
281
  fc->flags |= GIT_DIFF_FLAG__FREE_DATA;
282
282
 
283
- git_buf_dispose(&target);
283
+ git_buf_free(&target);
284
284
  return error;
285
285
  }
286
286
 
@@ -290,8 +290,8 @@ static int diff_file_content_load_workdir_symlink(
290
290
  ssize_t alloc_len, read_len;
291
291
  int symlink_supported, error;
292
292
 
293
- if ((error = git_repository__configmap_lookup(
294
- &symlink_supported, fc->repo, GIT_CONFIGMAP_SYMLINKS)) < 0)
293
+ if ((error = git_repository__cvar(
294
+ &symlink_supported, fc->repo, GIT_CVAR_SYMLINKS)) < 0)
295
295
  return -1;
296
296
 
297
297
  if (!symlink_supported)
@@ -303,13 +303,13 @@ static int diff_file_content_load_workdir_symlink(
303
303
  alloc_len = (ssize_t)(fc->file->size * 2) + 1;
304
304
 
305
305
  fc->map.data = git__calloc(alloc_len, sizeof(char));
306
- GIT_ERROR_CHECK_ALLOC(fc->map.data);
306
+ GITERR_CHECK_ALLOC(fc->map.data);
307
307
 
308
308
  fc->flags |= GIT_DIFF_FLAG__FREE_DATA;
309
309
 
310
310
  read_len = p_readlink(git_buf_cstr(path), fc->map.data, alloc_len);
311
311
  if (read_len < 0) {
312
- git_error_set(GIT_ERROR_OS, "failed to read symlink '%s'", fc->file->path);
312
+ giterr_set(GITERR_OS, "failed to read symlink '%s'", fc->file->path);
313
313
  return -1;
314
314
  }
315
315
 
@@ -330,10 +330,8 @@ static int diff_file_content_load_workdir_file(
330
330
  if (fd < 0)
331
331
  return fd;
332
332
 
333
- if (!fc->file->size)
334
- error = git_futils_filesize(&fc->file->size, fd);
335
-
336
- if (error < 0 || !fc->file->size)
333
+ if (!fc->file->size &&
334
+ !(fc->file->size = git_futils_filesize(fd)))
337
335
  goto cleanup;
338
336
 
339
337
  if ((diff_opts->flags & GIT_DIFF_SHOW_BINARY) == 0 &&
@@ -354,7 +352,7 @@ static int diff_file_content_load_workdir_file(
354
352
  }
355
353
 
356
354
  /* if mmap failed, fall through to try readbuffer below */
357
- git_error_clear();
355
+ giterr_clear();
358
356
  }
359
357
 
360
358
  if (!(error = git_futils_readbuffer_fd(&raw, fd, (size_t)fc->file->size))) {
@@ -363,7 +361,7 @@ static int diff_file_content_load_workdir_file(
363
361
  error = git_filter_list_apply_to_data(&out, fl, &raw);
364
362
 
365
363
  if (out.ptr != raw.ptr)
366
- git_buf_dispose(&raw);
364
+ git_buf_free(&raw);
367
365
 
368
366
  if (!error) {
369
367
  fc->map.len = out.size;
@@ -404,11 +402,11 @@ static int diff_file_content_load_workdir(
404
402
  /* once data is loaded, update OID if we didn't have it previously */
405
403
  if (!error && (fc->file->flags & GIT_DIFF_FLAG_VALID_ID) == 0) {
406
404
  error = git_odb_hash(
407
- &fc->file->id, fc->map.data, fc->map.len, GIT_OBJECT_BLOB);
405
+ &fc->file->id, fc->map.data, fc->map.len, GIT_OBJ_BLOB);
408
406
  fc->file->flags |= GIT_DIFF_FLAG_VALID_ID;
409
407
  }
410
408
 
411
- git_buf_dispose(&path);
409
+ git_buf_free(&path);
412
410
  return error;
413
411
  }
414
412
 
@@ -20,7 +20,7 @@ typedef struct {
20
20
  git_diff_driver *driver;
21
21
  uint32_t flags;
22
22
  uint32_t opts_flags;
23
- git_object_size_t opts_max_size;
23
+ git_off_t opts_max_size;
24
24
  git_iterator_type_t src;
25
25
  const git_blob *blob;
26
26
  git_map map;
@@ -9,7 +9,7 @@
9
9
 
10
10
  #include "diff.h"
11
11
  #include "patch_generate.h"
12
- #include "futils.h"
12
+ #include "fileops.h"
13
13
  #include "config.h"
14
14
  #include "attr_file.h"
15
15
  #include "filter.h"
@@ -81,7 +81,7 @@ static int diff_insert_delta(
81
81
  if (error > 0) /* positive value means to skip this delta */
82
82
  return 0;
83
83
  else /* negative value means to cancel diff */
84
- return git_error_set_after_callback_function(error, "git_diff");
84
+ return giterr_set_after_callback_function(error, "git_diff");
85
85
  }
86
86
  }
87
87
 
@@ -138,7 +138,7 @@ static int diff_delta__from_one(
138
138
  if (DIFF_FLAG_IS_SET(diff, GIT_DIFF_REVERSE))
139
139
  has_old = !has_old;
140
140
 
141
- if ((entry->flags & GIT_INDEX_ENTRY_VALID) != 0)
141
+ if ((entry->flags & GIT_IDXENTRY_VALID) != 0)
142
142
  return 0;
143
143
 
144
144
  if (status == GIT_DELTA_IGNORED &&
@@ -157,7 +157,7 @@ static int diff_delta__from_one(
157
157
  return 0;
158
158
 
159
159
  delta = diff_delta__alloc(diff, status, entry->path);
160
- GIT_ERROR_CHECK_ALLOC(delta);
160
+ GITERR_CHECK_ALLOC(delta);
161
161
 
162
162
  /* This fn is just for single-sided diffs */
163
163
  assert(status != GIT_DELTA_MODIFIED);
@@ -179,7 +179,7 @@ static int diff_delta__from_one(
179
179
 
180
180
  delta->old_file.flags |= GIT_DIFF_FLAG_VALID_ID;
181
181
 
182
- if (has_old || !git_oid_is_zero(&delta->new_file.id))
182
+ if (has_old || !git_oid_iszero(&delta->new_file.id))
183
183
  delta->new_file.flags |= GIT_DIFF_FLAG_VALID_ID;
184
184
 
185
185
  return diff_insert_delta(diff, delta, matched_pathspec);
@@ -220,7 +220,7 @@ static int diff_delta__from_two(
220
220
  }
221
221
 
222
222
  delta = diff_delta__alloc(diff, status, canonical_path);
223
- GIT_ERROR_CHECK_ALLOC(delta);
223
+ GITERR_CHECK_ALLOC(delta);
224
224
  delta->nfiles = 2;
225
225
 
226
226
  if (!git_index_entry_is_conflict(old_entry)) {
@@ -240,7 +240,7 @@ static int diff_delta__from_two(
240
240
  delta->old_file.flags |= GIT_DIFF_FLAG_EXISTS;
241
241
  delta->new_file.flags |= GIT_DIFF_FLAG_EXISTS;
242
242
 
243
- if (!git_oid_is_zero(&new_entry->id))
243
+ if (!git_oid_iszero(&new_entry->id))
244
244
  delta->new_file.flags |= GIT_DIFF_FLAG_VALID_ID;
245
245
  }
246
246
 
@@ -273,8 +273,7 @@ static git_diff_delta *diff_delta__last_for_item(
273
273
  break;
274
274
  case GIT_DELTA_MODIFIED:
275
275
  if (git_oid__cmp(&delta->old_file.id, &item->id) == 0 ||
276
- (delta->new_file.mode == item->mode &&
277
- git_oid__cmp(&delta->new_file.id, &item->id) == 0))
276
+ git_oid__cmp(&delta->new_file.id, &item->id) == 0)
278
277
  return delta;
279
278
  break;
280
279
  default:
@@ -472,17 +471,17 @@ static int diff_generated_apply_options(
472
471
  if ((val = git_repository_config_snapshot(&cfg, repo)) < 0)
473
472
  return val;
474
473
 
475
- if (!git_config__configmap_lookup(&val, cfg, GIT_CONFIGMAP_SYMLINKS) && val)
474
+ if (!git_config__cvar(&val, cfg, GIT_CVAR_SYMLINKS) && val)
476
475
  diff->diffcaps |= GIT_DIFFCAPS_HAS_SYMLINKS;
477
476
 
478
- if (!git_config__configmap_lookup(&val, cfg, GIT_CONFIGMAP_IGNORESTAT) && val)
477
+ if (!git_config__cvar(&val, cfg, GIT_CVAR_IGNORESTAT) && val)
479
478
  diff->diffcaps |= GIT_DIFFCAPS_IGNORE_STAT;
480
479
 
481
480
  if ((diff->base.opts.flags & GIT_DIFF_IGNORE_FILEMODE) == 0 &&
482
- !git_config__configmap_lookup(&val, cfg, GIT_CONFIGMAP_FILEMODE) && val)
481
+ !git_config__cvar(&val, cfg, GIT_CVAR_FILEMODE) && val)
483
482
  diff->diffcaps |= GIT_DIFFCAPS_TRUST_MODE_BITS;
484
483
 
485
- if (!git_config__configmap_lookup(&val, cfg, GIT_CONFIGMAP_TRUSTCTIME) && val)
484
+ if (!git_config__cvar(&val, cfg, GIT_CVAR_TRUSTCTIME) && val)
486
485
  diff->diffcaps |= GIT_DIFFCAPS_TRUST_CTIME;
487
486
 
488
487
  /* Don't set GIT_DIFFCAPS_USE_DEV - compile time option in core git */
@@ -517,7 +516,7 @@ static int diff_generated_apply_options(
517
516
 
518
517
  if (entry && git_submodule_parse_ignore(
519
518
  &diff->base.opts.ignore_submodules, entry->value) < 0)
520
- git_error_clear();
519
+ giterr_clear();
521
520
  git_config_entry_free(entry);
522
521
  }
523
522
 
@@ -560,18 +559,13 @@ int git_diff__oid_for_file(
560
559
  git_diff *diff,
561
560
  const char *path,
562
561
  uint16_t mode,
563
- git_object_size_t size)
562
+ git_off_t size)
564
563
  {
565
564
  git_index_entry entry;
566
565
 
567
- if (size > UINT32_MAX) {
568
- git_error_set(GIT_ERROR_NOMEMORY, "file size overflow (for 32-bits) on '%s'", path);
569
- return -1;
570
- }
571
-
572
566
  memset(&entry, 0, sizeof(entry));
573
567
  entry.mode = mode;
574
- entry.file_size = (uint32_t)size;
568
+ entry.file_size = size;
575
569
  entry.path = (char *)path;
576
570
 
577
571
  return git_diff__oid_for_entry(out, diff, &entry, mode, NULL);
@@ -606,7 +600,7 @@ int git_diff__oid_for_entry(
606
600
 
607
601
  if (p_stat(full_path.ptr, &st) < 0) {
608
602
  error = git_path_set_error(errno, entry.path, "stat");
609
- git_buf_dispose(&full_path);
603
+ git_buf_free(&full_path);
610
604
  return error;
611
605
  }
612
606
 
@@ -627,13 +621,13 @@ int git_diff__oid_for_entry(
627
621
  /* if submodule lookup failed probably just in an intermediate
628
622
  * state where some init hasn't happened, so ignore the error
629
623
  */
630
- git_error_clear();
624
+ giterr_clear();
631
625
  }
632
626
  } else if (S_ISLNK(mode)) {
633
627
  error = git_odb__hashlink(out, full_path.ptr);
634
628
  diff->base.perf.oid_calculations++;
635
629
  } else if (!git__is_sizet(entry.file_size)) {
636
- git_error_set(GIT_ERROR_NOMEMORY, "file size overflow (for 32-bits) on '%s'",
630
+ giterr_set(GITERR_OS, "file size overflow (for 32-bits) on '%s'",
637
631
  entry.path);
638
632
  error = -1;
639
633
  } else if (!(error = git_filter_list_load(&fl,
@@ -645,7 +639,7 @@ int git_diff__oid_for_entry(
645
639
  error = fd;
646
640
  else {
647
641
  error = git_odb__hashfd_filtered(
648
- out, fd, (size_t)entry.file_size, GIT_OBJECT_BLOB, fl);
642
+ out, fd, (size_t)entry.file_size, GIT_OBJ_BLOB, fl);
649
643
  p_close(fd);
650
644
  diff->base.perf.oid_calculations++;
651
645
  }
@@ -669,7 +663,7 @@ int git_diff__oid_for_entry(
669
663
  }
670
664
  }
671
665
 
672
- git_buf_dispose(&full_path);
666
+ git_buf_free(&full_path);
673
667
  return error;
674
668
  }
675
669
 
@@ -705,7 +699,7 @@ static int maybe_modified_submodule(
705
699
 
706
700
  /* GIT_EEXISTS means dir with .git in it was found - ignore it */
707
701
  if (error == GIT_EEXISTS) {
708
- git_error_clear();
702
+ giterr_clear();
709
703
  error = 0;
710
704
  }
711
705
  return error;
@@ -769,11 +763,11 @@ static int maybe_modified(
769
763
  status = GIT_DELTA_CONFLICTED;
770
764
 
771
765
  /* support "assume unchanged" (poorly, b/c we still stat everything) */
772
- } else if ((oitem->flags & GIT_INDEX_ENTRY_VALID) != 0) {
766
+ } else if ((oitem->flags & GIT_IDXENTRY_VALID) != 0) {
773
767
  status = GIT_DELTA_UNMODIFIED;
774
768
 
775
769
  /* support "skip worktree" index bit */
776
- } else if ((oitem->flags_extended & GIT_INDEX_ENTRY_SKIP_WORKTREE) != 0) {
770
+ } else if ((oitem->flags_extended & GIT_IDXENTRY_SKIP_WORKTREE) != 0) {
777
771
  status = GIT_DELTA_UNMODIFIED;
778
772
 
779
773
  /* if basic type of file changed, then split into delete and add */
@@ -797,13 +791,13 @@ static int maybe_modified(
797
791
  /* if oids and modes match (and are valid), then file is unmodified */
798
792
  } else if (git_oid_equal(&oitem->id, &nitem->id) &&
799
793
  omode == nmode &&
800
- !git_oid_is_zero(&oitem->id)) {
794
+ !git_oid_iszero(&oitem->id)) {
801
795
  status = GIT_DELTA_UNMODIFIED;
802
796
 
803
797
  /* if we have an unknown OID and a workdir iterator, then check some
804
798
  * circumstances that can accelerate things or need special handling
805
799
  */
806
- } else if (git_oid_is_zero(&nitem->id) && new_is_workdir) {
800
+ } else if (git_oid_iszero(&nitem->id) && new_is_workdir) {
807
801
  bool use_ctime =
808
802
  ((diff->diffcaps & GIT_DIFFCAPS_TRUST_CTIME) != 0);
809
803
  git_index *index = git_iterator_index(info->new_iter);
@@ -843,7 +837,7 @@ static int maybe_modified(
843
837
  /* if we got here and decided that the files are modified, but we
844
838
  * haven't calculated the OID of the new item, then calculate it now
845
839
  */
846
- if (modified_uncertain && git_oid_is_zero(&nitem->id)) {
840
+ if (modified_uncertain && git_oid_iszero(&nitem->id)) {
847
841
  const git_oid *update_check =
848
842
  DIFF_FLAG_IS_SET(diff, GIT_DIFF_UPDATE_INDEX) && omode == nmode ?
849
843
  &oitem->id : NULL;
@@ -877,7 +871,7 @@ static int maybe_modified(
877
871
 
878
872
  return diff_delta__from_two(
879
873
  diff, status, oitem, omode, nitem, nmode,
880
- git_oid_is_zero(&noid) ? NULL : &noid, matched_pathspec);
874
+ git_oid_iszero(&noid) ? NULL : &noid, matched_pathspec);
881
875
  }
882
876
 
883
877
  static bool entry_is_prefixed(
@@ -1065,7 +1059,7 @@ static int handle_unmatched_new_item(
1065
1059
 
1066
1060
  /* if directory is empty, can't advance into it, so skip it */
1067
1061
  if (error == GIT_ENOTFOUND) {
1068
- git_error_clear();
1062
+ giterr_clear();
1069
1063
  error = iterator_advance(&info->nitem, info->new_iter);
1070
1064
  }
1071
1065
 
@@ -1087,7 +1081,7 @@ static int handle_unmatched_new_item(
1087
1081
  else if (nitem->mode == GIT_FILEMODE_COMMIT) {
1088
1082
  /* ignore things that are not actual submodules */
1089
1083
  if (git_submodule_lookup(NULL, info->repo, nitem->path) != 0) {
1090
- git_error_clear();
1084
+ giterr_clear();
1091
1085
  delta_type = GIT_DELTA_IGNORED;
1092
1086
 
1093
1087
  /* if this contains a tracked item, treat as normal TREE */
@@ -1096,7 +1090,7 @@ static int handle_unmatched_new_item(
1096
1090
  if (error != GIT_ENOTFOUND)
1097
1091
  return error;
1098
1092
 
1099
- git_error_clear();
1093
+ giterr_clear();
1100
1094
  return iterator_advance(&info->nitem, info->new_iter);
1101
1095
  }
1102
1096
  }
@@ -1197,7 +1191,7 @@ int git_diff__from_iterators(
1197
1191
  *out = NULL;
1198
1192
 
1199
1193
  diff = diff_generated_alloc(repo, old_iter, new_iter);
1200
- GIT_ERROR_CHECK_ALLOC(diff);
1194
+ GITERR_CHECK_ALLOC(diff);
1201
1195
 
1202
1196
  info.repo = repo;
1203
1197
  info.old_iter = old_iter;
@@ -1262,31 +1256,29 @@ cleanup:
1262
1256
  return error;
1263
1257
  }
1264
1258
 
1265
- static int diff_prepare_iterator_opts(char **prefix, git_iterator_options *a, int aflags,
1266
- git_iterator_options *b, int bflags,
1267
- const git_diff_options *opts)
1268
- {
1269
- GIT_ERROR_CHECK_VERSION(opts, GIT_DIFF_OPTIONS_VERSION, "git_diff_options");
1270
-
1271
- *prefix = NULL;
1272
-
1273
- if (opts && (opts->flags & GIT_DIFF_DISABLE_PATHSPEC_MATCH)) {
1274
- a->pathlist.strings = opts->pathspec.strings;
1275
- a->pathlist.count = opts->pathspec.count;
1276
- b->pathlist.strings = opts->pathspec.strings;
1277
- b->pathlist.count = opts->pathspec.count;
1278
- } else if (opts) {
1279
- *prefix = git_pathspec_prefix(&opts->pathspec);
1280
- GIT_ERROR_CHECK_ALLOC(prefix);
1281
- }
1282
-
1283
- a->flags = aflags;
1284
- b->flags = bflags;
1285
- a->start = b->start = *prefix;
1286
- a->end = b->end = *prefix;
1287
-
1288
- return 0;
1289
- }
1259
+ #define DIFF_FROM_ITERATORS(MAKE_FIRST, FLAGS_FIRST, MAKE_SECOND, FLAGS_SECOND) do { \
1260
+ git_iterator *a = NULL, *b = NULL; \
1261
+ char *pfx = (opts && !(opts->flags & GIT_DIFF_DISABLE_PATHSPEC_MATCH)) ? \
1262
+ git_pathspec_prefix(&opts->pathspec) : NULL; \
1263
+ git_iterator_options a_opts = GIT_ITERATOR_OPTIONS_INIT, \
1264
+ b_opts = GIT_ITERATOR_OPTIONS_INIT; \
1265
+ a_opts.flags = FLAGS_FIRST; \
1266
+ a_opts.start = pfx; \
1267
+ a_opts.end = pfx; \
1268
+ b_opts.flags = FLAGS_SECOND; \
1269
+ b_opts.start = pfx; \
1270
+ b_opts.end = pfx; \
1271
+ GITERR_CHECK_VERSION(opts, GIT_DIFF_OPTIONS_VERSION, "git_diff_options"); \
1272
+ if (opts && (opts->flags & GIT_DIFF_DISABLE_PATHSPEC_MATCH)) { \
1273
+ a_opts.pathlist.strings = opts->pathspec.strings; \
1274
+ a_opts.pathlist.count = opts->pathspec.count; \
1275
+ b_opts.pathlist.strings = opts->pathspec.strings; \
1276
+ b_opts.pathlist.count = opts->pathspec.count; \
1277
+ } \
1278
+ if (!error && !(error = MAKE_FIRST) && !(error = MAKE_SECOND)) \
1279
+ error = git_diff__from_iterators(&diff, repo, a, b, opts); \
1280
+ git__free(pfx); git_iterator_free(a); git_iterator_free(b); \
1281
+ } while (0)
1290
1282
 
1291
1283
  int git_diff_tree_to_tree(
1292
1284
  git_diff **out,
@@ -1295,12 +1287,8 @@ int git_diff_tree_to_tree(
1295
1287
  git_tree *new_tree,
1296
1288
  const git_diff_options *opts)
1297
1289
  {
1298
- git_iterator_flag_t iflag = GIT_ITERATOR_DONT_IGNORE_CASE;
1299
- git_iterator_options a_opts = GIT_ITERATOR_OPTIONS_INIT,
1300
- b_opts = GIT_ITERATOR_OPTIONS_INIT;
1301
- git_iterator *a = NULL, *b = NULL;
1302
1290
  git_diff *diff = NULL;
1303
- char *prefix = NULL;
1291
+ git_iterator_flag_t iflag = GIT_ITERATOR_DONT_IGNORE_CASE;
1304
1292
  int error = 0;
1305
1293
 
1306
1294
  assert(out && repo);
@@ -1314,19 +1302,13 @@ int git_diff_tree_to_tree(
1314
1302
  if (opts && (opts->flags & GIT_DIFF_IGNORE_CASE) != 0)
1315
1303
  iflag = GIT_ITERATOR_IGNORE_CASE;
1316
1304
 
1317
- if ((error = diff_prepare_iterator_opts(&prefix, &a_opts, iflag, &b_opts, iflag, opts)) < 0 ||
1318
- (error = git_iterator_for_tree(&a, old_tree, &a_opts)) < 0 ||
1319
- (error = git_iterator_for_tree(&b, new_tree, &b_opts)) < 0 ||
1320
- (error = git_diff__from_iterators(&diff, repo, a, b, opts)) < 0)
1321
- goto out;
1305
+ DIFF_FROM_ITERATORS(
1306
+ git_iterator_for_tree(&a, old_tree, &a_opts), iflag,
1307
+ git_iterator_for_tree(&b, new_tree, &b_opts), iflag
1308
+ );
1322
1309
 
1323
- *out = diff;
1324
- diff = NULL;
1325
- out:
1326
- git_iterator_free(a);
1327
- git_iterator_free(b);
1328
- git_diff_free(diff);
1329
- git__free(prefix);
1310
+ if (!error)
1311
+ *out = diff;
1330
1312
 
1331
1313
  return error;
1332
1314
  }
@@ -1337,7 +1319,7 @@ static int diff_load_index(git_index **index, git_repository *repo)
1337
1319
 
1338
1320
  /* reload the repository index when user did not pass one in */
1339
1321
  if (!error && git_index_read(*index, false) < 0)
1340
- git_error_clear();
1322
+ giterr_clear();
1341
1323
 
1342
1324
  return error;
1343
1325
  }
@@ -1349,13 +1331,9 @@ int git_diff_tree_to_index(
1349
1331
  git_index *index,
1350
1332
  const git_diff_options *opts)
1351
1333
  {
1334
+ git_diff *diff = NULL;
1352
1335
  git_iterator_flag_t iflag = GIT_ITERATOR_DONT_IGNORE_CASE |
1353
1336
  GIT_ITERATOR_INCLUDE_CONFLICTS;
1354
- git_iterator_options a_opts = GIT_ITERATOR_OPTIONS_INIT,
1355
- b_opts = GIT_ITERATOR_OPTIONS_INIT;
1356
- git_iterator *a = NULL, *b = NULL;
1357
- git_diff *diff = NULL;
1358
- char *prefix = NULL;
1359
1337
  bool index_ignore_case = false;
1360
1338
  int error = 0;
1361
1339
 
@@ -1368,23 +1346,17 @@ int git_diff_tree_to_index(
1368
1346
 
1369
1347
  index_ignore_case = index->ignore_case;
1370
1348
 
1371
- if ((error = diff_prepare_iterator_opts(&prefix, &a_opts, iflag, &b_opts, iflag, opts)) < 0 ||
1372
- (error = git_iterator_for_tree(&a, old_tree, &a_opts)) < 0 ||
1373
- (error = git_iterator_for_index(&b, repo, index, &b_opts)) < 0 ||
1374
- (error = git_diff__from_iterators(&diff, repo, a, b, opts)) < 0)
1375
- goto out;
1349
+ DIFF_FROM_ITERATORS(
1350
+ git_iterator_for_tree(&a, old_tree, &a_opts), iflag,
1351
+ git_iterator_for_index(&b, repo, index, &b_opts), iflag
1352
+ );
1376
1353
 
1377
1354
  /* if index is in case-insensitive order, re-sort deltas to match */
1378
- if (index_ignore_case)
1355
+ if (!error && index_ignore_case)
1379
1356
  git_diff__set_ignore_case(diff, true);
1380
1357
 
1381
- *out = diff;
1382
- diff = NULL;
1383
- out:
1384
- git_iterator_free(a);
1385
- git_iterator_free(b);
1386
- git_diff_free(diff);
1387
- git__free(prefix);
1358
+ if (!error)
1359
+ *out = diff;
1388
1360
 
1389
1361
  return error;
1390
1362
  }
@@ -1395,11 +1367,7 @@ int git_diff_index_to_workdir(
1395
1367
  git_index *index,
1396
1368
  const git_diff_options *opts)
1397
1369
  {
1398
- git_iterator_options a_opts = GIT_ITERATOR_OPTIONS_INIT,
1399
- b_opts = GIT_ITERATOR_OPTIONS_INIT;
1400
- git_iterator *a = NULL, *b = NULL;
1401
1370
  git_diff *diff = NULL;
1402
- char *prefix = NULL;
1403
1371
  int error = 0;
1404
1372
 
1405
1373
  assert(out && repo);
@@ -1409,24 +1377,20 @@ int git_diff_index_to_workdir(
1409
1377
  if (!index && (error = diff_load_index(&index, repo)) < 0)
1410
1378
  return error;
1411
1379
 
1412
- if ((error = diff_prepare_iterator_opts(&prefix, &a_opts, GIT_ITERATOR_INCLUDE_CONFLICTS,
1413
- &b_opts, GIT_ITERATOR_DONT_AUTOEXPAND, opts)) < 0 ||
1414
- (error = git_iterator_for_index(&a, repo, index, &a_opts)) < 0 ||
1415
- (error = git_iterator_for_workdir(&b, repo, index, NULL, &b_opts)) < 0 ||
1416
- (error = git_diff__from_iterators(&diff, repo, a, b, opts)) < 0)
1417
- goto out;
1418
-
1419
- if ((diff->opts.flags & GIT_DIFF_UPDATE_INDEX) && ((git_diff_generated *)diff)->index_updated)
1420
- if ((error = git_index_write(index)) < 0)
1421
- goto out;
1422
-
1423
- *out = diff;
1424
- diff = NULL;
1425
- out:
1426
- git_iterator_free(a);
1427
- git_iterator_free(b);
1428
- git_diff_free(diff);
1429
- git__free(prefix);
1380
+ DIFF_FROM_ITERATORS(
1381
+ git_iterator_for_index(&a, repo, index, &a_opts),
1382
+ GIT_ITERATOR_INCLUDE_CONFLICTS,
1383
+
1384
+ git_iterator_for_workdir(&b, repo, index, NULL, &b_opts),
1385
+ GIT_ITERATOR_DONT_AUTOEXPAND
1386
+ );
1387
+
1388
+ if (!error && (diff->opts.flags & GIT_DIFF_UPDATE_INDEX) != 0 &&
1389
+ ((git_diff_generated *)diff)->index_updated)
1390
+ error = git_index_write(index);
1391
+
1392
+ if (!error)
1393
+ *out = diff;
1430
1394
 
1431
1395
  return error;
1432
1396
  }
@@ -1437,33 +1401,24 @@ int git_diff_tree_to_workdir(
1437
1401
  git_tree *old_tree,
1438
1402
  const git_diff_options *opts)
1439
1403
  {
1440
- git_iterator_options a_opts = GIT_ITERATOR_OPTIONS_INIT,
1441
- b_opts = GIT_ITERATOR_OPTIONS_INIT;
1442
- git_iterator *a = NULL, *b = NULL;
1443
1404
  git_diff *diff = NULL;
1444
- char *prefix = NULL;
1445
1405
  git_index *index;
1446
- int error;
1406
+ int error = 0;
1447
1407
 
1448
1408
  assert(out && repo);
1449
1409
 
1450
1410
  *out = NULL;
1451
1411
 
1452
- if ((error = diff_prepare_iterator_opts(&prefix, &a_opts, 0,
1453
- &b_opts, GIT_ITERATOR_DONT_AUTOEXPAND, opts) < 0) ||
1454
- (error = git_repository_index__weakptr(&index, repo)) < 0 ||
1455
- (error = git_iterator_for_tree(&a, old_tree, &a_opts)) < 0 ||
1456
- (error = git_iterator_for_workdir(&b, repo, index, old_tree, &b_opts)) < 0 ||
1457
- (error = git_diff__from_iterators(&diff, repo, a, b, opts)) < 0)
1458
- goto out;
1459
-
1460
- *out = diff;
1461
- diff = NULL;
1462
- out:
1463
- git_iterator_free(a);
1464
- git_iterator_free(b);
1465
- git_diff_free(diff);
1466
- git__free(prefix);
1412
+ if ((error = git_repository_index__weakptr(&index, repo)))
1413
+ return error;
1414
+
1415
+ DIFF_FROM_ITERATORS(
1416
+ git_iterator_for_tree(&a, old_tree, &a_opts), 0,
1417
+ git_iterator_for_workdir(&b, repo, index, old_tree, &b_opts), GIT_ITERATOR_DONT_AUTOEXPAND
1418
+ );
1419
+
1420
+ if (!error)
1421
+ *out = diff;
1467
1422
 
1468
1423
  return error;
1469
1424
  }
@@ -1507,35 +1462,24 @@ int git_diff_index_to_index(
1507
1462
  git_index *new_index,
1508
1463
  const git_diff_options *opts)
1509
1464
  {
1510
- git_iterator_options a_opts = GIT_ITERATOR_OPTIONS_INIT,
1511
- b_opts = GIT_ITERATOR_OPTIONS_INIT;
1512
- git_iterator *a = NULL, *b = NULL;
1513
- git_diff *diff = NULL;
1514
- char *prefix = NULL;
1515
- int error;
1465
+ git_diff *diff;
1466
+ int error = 0;
1516
1467
 
1517
1468
  assert(out && old_index && new_index);
1518
1469
 
1519
1470
  *out = NULL;
1520
1471
 
1521
- if ((error = diff_prepare_iterator_opts(&prefix, &a_opts, GIT_ITERATOR_DONT_IGNORE_CASE,
1522
- &b_opts, GIT_ITERATOR_DONT_IGNORE_CASE, opts) < 0) ||
1523
- (error = git_iterator_for_index(&a, repo, old_index, &a_opts)) < 0 ||
1524
- (error = git_iterator_for_index(&b, repo, new_index, &b_opts)) < 0 ||
1525
- (error = git_diff__from_iterators(&diff, repo, a, b, opts)) < 0)
1526
- goto out;
1472
+ DIFF_FROM_ITERATORS(
1473
+ git_iterator_for_index(&a, repo, old_index, &a_opts), GIT_ITERATOR_DONT_IGNORE_CASE,
1474
+ git_iterator_for_index(&b, repo, new_index, &b_opts), GIT_ITERATOR_DONT_IGNORE_CASE
1475
+ );
1527
1476
 
1528
1477
  /* if index is in case-insensitive order, re-sort deltas to match */
1529
- if (old_index->ignore_case || new_index->ignore_case)
1478
+ if (!error && (old_index->ignore_case || new_index->ignore_case))
1530
1479
  git_diff__set_ignore_case(diff, true);
1531
1480
 
1532
- *out = diff;
1533
- diff = NULL;
1534
- out:
1535
- git_iterator_free(a);
1536
- git_iterator_free(b);
1537
- git_diff_free(diff);
1538
- git__free(prefix);
1481
+ if (!error)
1482
+ *out = diff;
1539
1483
 
1540
1484
  return error;
1541
1485
  }
@@ -1607,7 +1551,7 @@ int git_diff__paired_foreach(
1607
1551
  }
1608
1552
 
1609
1553
  if ((error = cb(h2i, i2w, payload)) != 0) {
1610
- git_error_set_after_callback(error);
1554
+ giterr_set_after_callback(error);
1611
1555
  break;
1612
1556
  }
1613
1557
  }
@@ -1646,7 +1590,7 @@ int git_diff__commit(
1646
1590
  char commit_oidstr[GIT_OID_HEXSZ + 1];
1647
1591
 
1648
1592
  error = -1;
1649
- git_error_set(GIT_ERROR_INVALID, "commit %s is a merge commit",
1593
+ giterr_set(GITERR_INVALID, "commit %s is a merge commit",
1650
1594
  git_oid_tostr(commit_oidstr, GIT_OID_HEXSZ + 1, git_commit_id(commit)));
1651
1595
  goto on_error;
1652
1596
  }