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
@@ -11,11 +11,6 @@
11
11
 
12
12
  #include "git2/sys/stream.h"
13
13
 
14
- #ifdef GIT_SECURE_TRANSPORT
15
-
16
14
  extern int git_stransport_stream_new(git_stream **out, const char *host, const char *port);
17
- extern int git_stransport_stream_wrap(git_stream **out, git_stream *in, const char *host);
18
-
19
- #endif
20
15
 
21
16
  #endif
@@ -5,69 +5,38 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
+ #include "streams/tls.h"
9
+
8
10
  #include "git2/errors.h"
9
11
 
10
- #include "common.h"
11
- #include "global.h"
12
- #include "streams/registry.h"
13
- #include "streams/tls.h"
14
- #include "streams/mbedtls.h"
15
12
  #include "streams/openssl.h"
16
13
  #include "streams/stransport.h"
17
14
 
18
- int git_tls_stream_new(git_stream **out, const char *host, const char *port)
19
- {
20
- int (*init)(git_stream **, const char *, const char *) = NULL;
21
- git_stream_registration custom = {0};
22
- int error;
23
-
24
- assert(out && host && port);
25
-
26
- if ((error = git_stream_registry_lookup(&custom, GIT_STREAM_TLS)) == 0) {
27
- init = custom.init;
28
- } else if (error == GIT_ENOTFOUND) {
29
- #ifdef GIT_SECURE_TRANSPORT
30
- init = git_stransport_stream_new;
31
- #elif defined(GIT_OPENSSL)
32
- init = git_openssl_stream_new;
33
- #elif defined(GIT_MBEDTLS)
34
- init = git_mbedtls_stream_new;
35
- #endif
36
- } else {
37
- return error;
38
- }
15
+ static git_stream_cb tls_ctor;
39
16
 
40
- if (!init) {
41
- git_error_set(GIT_ERROR_SSL, "there is no TLS stream available");
42
- return -1;
43
- }
17
+ int git_stream_register_tls(git_stream_cb ctor)
18
+ {
19
+ tls_ctor = ctor;
44
20
 
45
- return init(out, host, port);
21
+ return 0;
46
22
  }
47
23
 
48
- int git_tls_stream_wrap(git_stream **out, git_stream *in, const char *host)
24
+ int git_tls_stream_new(git_stream **out, const char *host, const char *port)
49
25
  {
50
- int (*wrap)(git_stream **, git_stream *, const char *) = NULL;
51
- git_stream_registration custom = {0};
52
26
 
53
- assert(out && in);
27
+ if (tls_ctor)
28
+ return tls_ctor(out, host, port);
54
29
 
55
- if (git_stream_registry_lookup(&custom, GIT_STREAM_TLS) == 0) {
56
- wrap = custom.wrap;
57
- } else {
58
30
  #ifdef GIT_SECURE_TRANSPORT
59
- wrap = git_stransport_stream_wrap;
31
+ return git_stransport_stream_new(out, host, port);
60
32
  #elif defined(GIT_OPENSSL)
61
- wrap = git_openssl_stream_wrap;
62
- #elif defined(GIT_MBEDTLS)
63
- wrap = git_mbedtls_stream_wrap;
33
+ return git_openssl_stream_new(out, host, port);
34
+ #else
35
+ GIT_UNUSED(out);
36
+ GIT_UNUSED(host);
37
+ GIT_UNUSED(port);
38
+
39
+ giterr_set(GITERR_SSL, "there is no TLS stream available");
40
+ return -1;
64
41
  #endif
65
- }
66
-
67
- if (!wrap) {
68
- git_error_set(GIT_ERROR_SSL, "there is no TLS stream available");
69
- return -1;
70
- }
71
-
72
- return wrap(out, in, host);
73
42
  }
@@ -13,19 +13,11 @@
13
13
 
14
14
  /**
15
15
  * Create a TLS stream with the most appropriate backend available for
16
- * the current platform, whether that's SecureTransport on macOS,
17
- * OpenSSL or mbedTLS on other Unixes, or something else entirely.
18
- */
19
- extern int git_tls_stream_new(git_stream **out, const char *host, const char *port);
20
-
21
- /**
22
- * Create a TLS stream on top of an existing insecure stream, using
23
- * the most appropriate backend available for the current platform.
16
+ * the current platform.
24
17
  *
25
- * This allows us to create a CONNECT stream on top of a proxy;
26
- * using SecureTransport on macOS, OpenSSL or mbedTLS on other
27
- * Unixes, or something else entirely.
18
+ * This allows us to ask for a SecureTransport or OpenSSL stream
19
+ * according to being on general Unix vs OS X.
28
20
  */
29
- extern int git_tls_stream_wrap(git_stream **out, git_stream *in, const char *host);
21
+ extern int git_tls_stream_new(git_stream **out, const char *host, const char *port);
30
22
 
31
23
  #endif
@@ -7,21 +7,14 @@
7
7
 
8
8
  #include "strmap.h"
9
9
 
10
- #define kmalloc git__malloc
11
- #define kcalloc git__calloc
12
- #define krealloc git__realloc
13
- #define kreallocarray git__reallocarray
14
- #define kfree git__free
15
- #include "khash.h"
16
-
17
- __KHASH_TYPE(str, const char *, void *)
18
-
19
10
  __KHASH_IMPL(str, static kh_inline, const char *, void *, 1, kh_str_hash_func, kh_str_hash_equal)
20
11
 
21
- int git_strmap_new(git_strmap **out)
12
+ int git_strmap_alloc(git_strmap **map)
22
13
  {
23
- *out = kh_init(str);
24
- GIT_ERROR_CHECK_ALLOC(*out);
14
+ if ((*map = kh_init(str)) == NULL) {
15
+ giterr_set_oom();
16
+ return -1;
17
+ }
25
18
 
26
19
  return 0;
27
20
  }
@@ -36,65 +29,99 @@ void git_strmap_clear(git_strmap *map)
36
29
  kh_clear(str, map);
37
30
  }
38
31
 
39
- size_t git_strmap_size(git_strmap *map)
32
+ size_t git_strmap_num_entries(git_strmap *map)
40
33
  {
41
34
  return kh_size(map);
42
35
  }
43
36
 
44
- void *git_strmap_get(git_strmap *map, const char *key)
37
+ size_t git_strmap_lookup_index(git_strmap *map, const char *key)
45
38
  {
46
- size_t idx = kh_get(str, map, key);
47
- if (idx == kh_end(map) || !kh_exist(map, idx))
48
- return NULL;
49
- return kh_val(map, idx);
39
+ return kh_get(str, map, key);
50
40
  }
51
41
 
52
- int git_strmap_set(git_strmap *map, const char *key, void *value)
42
+ int git_strmap_valid_index(git_strmap *map, size_t idx)
53
43
  {
54
- size_t idx;
55
- int rval;
44
+ return idx != kh_end(map);
45
+ }
56
46
 
57
- idx = kh_put(str, map, key, &rval);
58
- if (rval < 0)
59
- return -1;
47
+ int git_strmap_exists(git_strmap *map, const char *key)
48
+ {
49
+ return kh_get(str, map, key) != kh_end(map);
50
+ }
60
51
 
61
- if (rval == 0)
62
- kh_key(map, idx) = key;
52
+ int git_strmap_has_data(git_strmap *map, size_t idx)
53
+ {
54
+ return kh_exist(map, idx);
55
+ }
63
56
 
64
- kh_val(map, idx) = value;
57
+ const char *git_strmap_key(git_strmap *map, size_t idx)
58
+ {
59
+ return kh_key(map, idx);
60
+ }
65
61
 
66
- return 0;
62
+ void git_strmap_set_key_at(git_strmap *map, size_t idx, char *key)
63
+ {
64
+ kh_val(map, idx) = key;
67
65
  }
68
66
 
69
- int git_strmap_delete(git_strmap *map, const char *key)
67
+ void *git_strmap_value_at(git_strmap *map, size_t idx)
68
+ {
69
+ return kh_val(map, idx);
70
+ }
71
+
72
+ void git_strmap_set_value_at(git_strmap *map, size_t idx, void *value)
73
+ {
74
+ kh_val(map, idx) = value;
75
+ }
76
+
77
+ void git_strmap_delete_at(git_strmap *map, size_t idx)
70
78
  {
71
- khiter_t idx = kh_get(str, map, key);
72
- if (idx == kh_end(map))
73
- return GIT_ENOTFOUND;
74
79
  kh_del(str, map, idx);
75
- return 0;
76
80
  }
77
81
 
78
- int git_strmap_exists(git_strmap *map, const char *key)
82
+ int git_strmap_put(git_strmap *map, const char *key, int *err)
79
83
  {
80
- return kh_get(str, map, key) != kh_end(map);
84
+ return kh_put(str, map, key, err);
81
85
  }
82
86
 
83
- int git_strmap_iterate(void **value, git_strmap *map, size_t *iter, const char **key)
87
+ void git_strmap_insert(git_strmap *map, const char *key, void *value, int *rval)
84
88
  {
85
- size_t i = *iter;
89
+ khiter_t idx = kh_put(str, map, key, rval);
86
90
 
87
- while (i < map->n_buckets && !kh_exist(map, i))
88
- i++;
91
+ if ((*rval) >= 0) {
92
+ if ((*rval) == 0)
93
+ kh_key(map, idx) = key;
94
+ kh_val(map, idx) = value;
95
+ }
96
+ }
89
97
 
90
- if (i >= map->n_buckets)
91
- return GIT_ITEROVER;
98
+ void git_strmap_delete(git_strmap *map, const char *key)
99
+ {
100
+ khiter_t idx = git_strmap_lookup_index(map, key);
101
+ if (git_strmap_valid_index(map, idx))
102
+ git_strmap_delete_at(map, idx);
103
+ }
92
104
 
93
- if (key)
94
- *key = kh_key(map, i);
95
- if (value)
96
- *value = kh_val(map, i);
97
- *iter = ++i;
105
+ int git_strmap_next(
106
+ void **data,
107
+ git_strmap_iter* iter,
108
+ git_strmap *map)
109
+ {
110
+ if (!map)
111
+ return GIT_ERROR;
98
112
 
99
- return 0;
113
+ while (*iter != git_strmap_end(map)) {
114
+ if (!(git_strmap_has_data(map, *iter))) {
115
+ ++(*iter);
116
+ continue;
117
+ }
118
+
119
+ *data = git_strmap_value_at(map, *iter);
120
+
121
+ ++(*iter);
122
+
123
+ return GIT_OK;
124
+ }
125
+
126
+ return GIT_ITEROVER;
100
127
  }
@@ -9,123 +9,48 @@
9
9
 
10
10
  #include "common.h"
11
11
 
12
- /** A map with C strings as key. */
13
- typedef struct kh_str_s git_strmap;
14
-
15
- /**
16
- * Allocate a new string map.
17
- *
18
- * @param out Pointer to the map that shall be allocated.
19
- * @return 0 on success, an error code if allocation has failed.
20
- */
21
- int git_strmap_new(git_strmap **out);
22
-
23
- /**
24
- * Free memory associated with the map.
25
- *
26
- * Note that this function will _not_ free keys or values added
27
- * to this map.
28
- *
29
- * @param map Pointer to the map that is to be free'd. May be
30
- * `NULL`.
31
- */
12
+ #define kmalloc git__malloc
13
+ #define kcalloc git__calloc
14
+ #define krealloc git__realloc
15
+ #define kreallocarray git__reallocarray
16
+ #define kfree git__free
17
+ #include "khash.h"
18
+
19
+ __KHASH_TYPE(str, const char *, void *)
20
+ typedef khash_t(str) git_strmap;
21
+ typedef khiter_t git_strmap_iter;
22
+
23
+ int git_strmap_alloc(git_strmap **map);
32
24
  void git_strmap_free(git_strmap *map);
33
-
34
- /**
35
- * Clear all entries from the map.
36
- *
37
- * This function will remove all entries from the associated map.
38
- * Memory associated with it will not be released, though.
39
- *
40
- * @param map Pointer to the map that shall be cleared. May be
41
- * `NULL`.
42
- */
43
25
  void git_strmap_clear(git_strmap *map);
44
26
 
45
- /**
46
- * Return the number of elements in the map.
47
- *
48
- * @parameter map map containing the elements
49
- * @return number of elements in the map
50
- */
51
- size_t git_strmap_size(git_strmap *map);
27
+ size_t git_strmap_num_entries(git_strmap *map);
52
28
 
53
- /**
54
- * Return value associated with the given key.
55
- *
56
- * @param map map to search key in
57
- * @param key key to search for
58
- * @return value associated with the given key or NULL if the key was not found
59
- */
60
- void *git_strmap_get(git_strmap *map, const char *key);
29
+ size_t git_strmap_lookup_index(git_strmap *map, const char *key);
30
+ int git_strmap_valid_index(git_strmap *map, size_t idx);
61
31
 
62
- /**
63
- * Set the entry for key to value.
64
- *
65
- * If the map has no corresponding entry for the given key, a new
66
- * entry will be created with the given value. If an entry exists
67
- * already, its value will be updated to match the given value.
68
- *
69
- * @param map map to create new entry in
70
- * @param key key to set
71
- * @param value value to associate the key with; may be NULL
72
- * @return zero if the key was successfully set, a negative error
73
- * code otherwise
74
- */
75
- int git_strmap_set(git_strmap *map, const char *key, void *value);
32
+ int git_strmap_exists(git_strmap *map, const char *key);
33
+ int git_strmap_has_data(git_strmap *map, size_t idx);
76
34
 
77
- /**
78
- * Delete an entry from the map.
79
- *
80
- * Delete the given key and its value from the map. If no such
81
- * key exists, this will do nothing.
82
- *
83
- * @param map map to delete key in
84
- * @param key key to delete
85
- * @return `0` if the key has been deleted, GIT_ENOTFOUND if no
86
- * such key was found, a negative code in case of an
87
- * error
88
- */
89
- int git_strmap_delete(git_strmap *map, const char *key);
35
+ const char *git_strmap_key(git_strmap *map, size_t idx);
36
+ void git_strmap_set_key_at(git_strmap *map, size_t idx, char *key);
37
+ void *git_strmap_value_at(git_strmap *map, size_t idx);
38
+ void git_strmap_set_value_at(git_strmap *map, size_t idx, void *value);
39
+ void git_strmap_delete_at(git_strmap *map, size_t idx);
90
40
 
91
- /**
92
- * Check whether a key exists in the given map.
93
- *
94
- * @param map map to query for the key
95
- * @param key key to search for
96
- * @return 0 if the key has not been found, 1 otherwise
97
- */
98
- int git_strmap_exists(git_strmap *map, const char *key);
41
+ int git_strmap_put(git_strmap *map, const char *key, int *err);
42
+ void git_strmap_insert(git_strmap *map, const char *key, void *value, int *rval);
43
+ void git_strmap_delete(git_strmap *map, const char *key);
99
44
 
100
- /**
101
- * Iterate over entries of the map.
102
- *
103
- * This functions allows to iterate over all key-value entries of
104
- * the map. The current position is stored in the `iter` variable
105
- * and should be initialized to `0` before the first call to this
106
- * function.
107
- *
108
- * @param map map to iterate over
109
- * @param value pointer to the variable where to store the current
110
- * value. May be NULL.
111
- * @param iter iterator storing the current position. Initialize
112
- * with zero previous to the first call.
113
- * @param key pointer to the variable where to store the current
114
- * key. May be NULL.
115
- * @return `0` if the next entry was correctly retrieved.
116
- * GIT_ITEROVER if no entries are left. A negative error
117
- * code otherwise.
118
- */
119
- int git_strmap_iterate(void **value, git_strmap *map, size_t *iter, const char **key);
45
+ #define git_strmap_foreach kh_foreach
46
+ #define git_strmap_foreach_value kh_foreach_value
120
47
 
121
- #define git_strmap_foreach(h, kvar, vvar, code) { size_t __i = 0; \
122
- while (git_strmap_iterate((void **) &(vvar), h, &__i, &(kvar)) == 0) { \
123
- code; \
124
- } }
48
+ #define git_strmap_begin kh_begin
49
+ #define git_strmap_end kh_end
125
50
 
126
- #define git_strmap_foreach_value(h, vvar, code) { size_t __i = 0; \
127
- while (git_strmap_iterate((void **) &(vvar), h, &__i, NULL) == 0) { \
128
- code; \
129
- } }
51
+ int git_strmap_next(
52
+ void **data,
53
+ git_strmap_iter* iter,
54
+ git_strmap *map);
130
55
 
131
56
  #endif
@@ -15,7 +15,7 @@
15
15
  #include "buf_text.h"
16
16
  #include "vector.h"
17
17
  #include "posix.h"
18
- #include "config_backend.h"
18
+ #include "config_file.h"
19
19
  #include "config.h"
20
20
  #include "repository.h"
21
21
  #include "tree.h"
@@ -23,32 +23,31 @@
23
23
  #include "path.h"
24
24
  #include "index.h"
25
25
  #include "worktree.h"
26
- #include "clone.h"
27
26
 
28
27
  #define GIT_MODULES_FILE ".gitmodules"
29
28
 
30
- static git_configmap _sm_update_map[] = {
31
- {GIT_CONFIGMAP_STRING, "checkout", GIT_SUBMODULE_UPDATE_CHECKOUT},
32
- {GIT_CONFIGMAP_STRING, "rebase", GIT_SUBMODULE_UPDATE_REBASE},
33
- {GIT_CONFIGMAP_STRING, "merge", GIT_SUBMODULE_UPDATE_MERGE},
34
- {GIT_CONFIGMAP_STRING, "none", GIT_SUBMODULE_UPDATE_NONE},
35
- {GIT_CONFIGMAP_FALSE, NULL, GIT_SUBMODULE_UPDATE_NONE},
36
- {GIT_CONFIGMAP_TRUE, NULL, GIT_SUBMODULE_UPDATE_CHECKOUT},
29
+ static git_cvar_map _sm_update_map[] = {
30
+ {GIT_CVAR_STRING, "checkout", GIT_SUBMODULE_UPDATE_CHECKOUT},
31
+ {GIT_CVAR_STRING, "rebase", GIT_SUBMODULE_UPDATE_REBASE},
32
+ {GIT_CVAR_STRING, "merge", GIT_SUBMODULE_UPDATE_MERGE},
33
+ {GIT_CVAR_STRING, "none", GIT_SUBMODULE_UPDATE_NONE},
34
+ {GIT_CVAR_FALSE, NULL, GIT_SUBMODULE_UPDATE_NONE},
35
+ {GIT_CVAR_TRUE, NULL, GIT_SUBMODULE_UPDATE_CHECKOUT},
37
36
  };
38
37
 
39
- static git_configmap _sm_ignore_map[] = {
40
- {GIT_CONFIGMAP_STRING, "none", GIT_SUBMODULE_IGNORE_NONE},
41
- {GIT_CONFIGMAP_STRING, "untracked", GIT_SUBMODULE_IGNORE_UNTRACKED},
42
- {GIT_CONFIGMAP_STRING, "dirty", GIT_SUBMODULE_IGNORE_DIRTY},
43
- {GIT_CONFIGMAP_STRING, "all", GIT_SUBMODULE_IGNORE_ALL},
44
- {GIT_CONFIGMAP_FALSE, NULL, GIT_SUBMODULE_IGNORE_NONE},
45
- {GIT_CONFIGMAP_TRUE, NULL, GIT_SUBMODULE_IGNORE_ALL},
38
+ static git_cvar_map _sm_ignore_map[] = {
39
+ {GIT_CVAR_STRING, "none", GIT_SUBMODULE_IGNORE_NONE},
40
+ {GIT_CVAR_STRING, "untracked", GIT_SUBMODULE_IGNORE_UNTRACKED},
41
+ {GIT_CVAR_STRING, "dirty", GIT_SUBMODULE_IGNORE_DIRTY},
42
+ {GIT_CVAR_STRING, "all", GIT_SUBMODULE_IGNORE_ALL},
43
+ {GIT_CVAR_FALSE, NULL, GIT_SUBMODULE_IGNORE_NONE},
44
+ {GIT_CVAR_TRUE, NULL, GIT_SUBMODULE_IGNORE_ALL},
46
45
  };
47
46
 
48
- static git_configmap _sm_recurse_map[] = {
49
- {GIT_CONFIGMAP_STRING, "on-demand", GIT_SUBMODULE_RECURSE_ONDEMAND},
50
- {GIT_CONFIGMAP_FALSE, NULL, GIT_SUBMODULE_RECURSE_NO},
51
- {GIT_CONFIGMAP_TRUE, NULL, GIT_SUBMODULE_RECURSE_YES},
47
+ static git_cvar_map _sm_recurse_map[] = {
48
+ {GIT_CVAR_STRING, "on-demand", GIT_SUBMODULE_RECURSE_ONDEMAND},
49
+ {GIT_CVAR_FALSE, NULL, GIT_SUBMODULE_RECURSE_NO},
50
+ {GIT_CVAR_TRUE, NULL, GIT_SUBMODULE_RECURSE_YES},
52
51
  };
53
52
 
54
53
  enum {
@@ -61,6 +60,35 @@ enum {
61
60
  GITMODULES_CREATE = 1,
62
61
  };
63
62
 
63
+ static kh_inline khint_t str_hash_no_trailing_slash(const char *s)
64
+ {
65
+ khint_t h;
66
+
67
+ for (h = 0; *s; ++s)
68
+ if (s[1] != '\0' || *s != '/')
69
+ h = (h << 5) - h + *s;
70
+
71
+ return h;
72
+ }
73
+
74
+ static kh_inline int str_equal_no_trailing_slash(const char *a, const char *b)
75
+ {
76
+ size_t alen = a ? strlen(a) : 0;
77
+ size_t blen = b ? strlen(b) : 0;
78
+
79
+ if (alen > 0 && a[alen - 1] == '/')
80
+ alen--;
81
+ if (blen > 0 && b[blen - 1] == '/')
82
+ blen--;
83
+
84
+ return (alen == 0 && blen == 0) ||
85
+ (alen == blen && strncmp(a, b, alen) == 0);
86
+ }
87
+
88
+ __KHASH_IMPL(
89
+ str, static kh_inline, const char *, void *, 1,
90
+ str_hash_no_trailing_slash, str_equal_no_trailing_slash)
91
+
64
92
  static int submodule_alloc(git_submodule **out, git_repository *repo, const char *name);
65
93
  static git_config_backend *open_gitmodules(git_repository *repo, int gitmod);
66
94
  static int gitmodules_snapshot(git_config **snap, git_repository *repo);
@@ -96,7 +124,7 @@ static void submodule_set_lookup_error(int error, const char *name)
96
124
  if (!error)
97
125
  return;
98
126
 
99
- git_error_set(GIT_ERROR_SUBMODULE, (error == GIT_ENOTFOUND) ?
127
+ giterr_set(GITERR_SUBMODULE, (error == GIT_ENOTFOUND) ?
100
128
  "no submodule named '%s'" :
101
129
  "submodule '%s' has not been added yet", name);
102
130
  }
@@ -115,74 +143,24 @@ static int find_by_path(const git_config_entry *entry, void *payload)
115
143
  fdot = strchr(entry->name, '.');
116
144
  ldot = strrchr(entry->name, '.');
117
145
  data->name = git__strndup(fdot + 1, ldot - fdot - 1);
118
- GIT_ERROR_CHECK_ALLOC(data->name);
146
+ GITERR_CHECK_ALLOC(data->name);
119
147
  }
120
148
 
121
149
  return 0;
122
150
  }
123
151
 
124
- /*
125
- * Checks to see if the submodule shares its name with a file or directory that
126
- * already exists on the index. If so, the submodule cannot be added.
127
- */
128
- static int is_path_occupied(bool *occupied, git_repository *repo, const char *path)
129
- {
130
- int error = 0;
131
- git_index *index;
132
- git_buf dir = GIT_BUF_INIT;
133
- *occupied = false;
134
-
135
- if ((error = git_repository_index__weakptr(&index, repo)) < 0)
136
- goto out;
137
-
138
- if ((error = git_index_find(NULL, index, path)) != GIT_ENOTFOUND) {
139
- if (!error) {
140
- git_error_set(GIT_ERROR_SUBMODULE,
141
- "File '%s' already exists in the index", path);
142
- *occupied = true;
143
- }
144
- goto out;
145
- }
146
-
147
- if ((error = git_buf_sets(&dir, path)) < 0)
148
- goto out;
149
-
150
- if ((error = git_path_to_dir(&dir)) < 0)
151
- goto out;
152
-
153
- if ((error = git_index_find_prefix(NULL, index, dir.ptr)) != GIT_ENOTFOUND) {
154
- if (!error) {
155
- git_error_set(GIT_ERROR_SUBMODULE,
156
- "Directory '%s' already exists in the index", path);
157
- *occupied = true;
158
- }
159
- goto out;
160
- }
161
-
162
- error = 0;
163
-
164
- out:
165
- git_buf_dispose(&dir);
166
- return error;
167
- }
168
-
169
152
  /**
170
153
  * Release the name map returned by 'load_submodule_names'.
171
154
  */
172
155
  static void free_submodule_names(git_strmap *names)
173
156
  {
174
- const char *key;
175
- char *value;
176
-
157
+ git_buf *name = 0;
177
158
  if (names == NULL)
178
159
  return;
179
-
180
- git_strmap_foreach(names, key, value, {
181
- git__free((char *) key);
182
- git__free(value);
160
+ git_strmap_foreach_value(names, name, {
161
+ git__free(name);
183
162
  });
184
163
  git_strmap_free(names);
185
-
186
164
  return;
187
165
  }
188
166
 
@@ -191,30 +169,25 @@ static void free_submodule_names(git_strmap *names)
191
169
  * TODO: for some use-cases, this might need case-folding on a
192
170
  * case-insensitive filesystem
193
171
  */
194
- static int load_submodule_names(git_strmap **out, git_repository *repo, git_config *cfg)
172
+ static int load_submodule_names(git_strmap *out, git_repository *repo, git_config *cfg)
195
173
  {
196
174
  const char *key = "submodule\\..*\\.path";
197
- git_config_iterator *iter = NULL;
175
+ git_config_iterator *iter;
198
176
  git_config_entry *entry;
199
177
  git_buf buf = GIT_BUF_INIT;
200
- git_strmap *names;
201
- int isvalid, error;
202
-
203
- *out = NULL;
204
-
205
- if ((error = git_strmap_new(&names)) < 0)
206
- goto out;
178
+ int rval, isvalid;
179
+ int error = 0;
207
180
 
208
181
  if ((error = git_config_iterator_glob_new(&iter, cfg, key)) < 0)
209
- goto out;
182
+ return error;
210
183
 
211
184
  while ((error = git_config_next(&entry, iter)) == 0) {
212
185
  const char *fdot, *ldot;
213
186
  fdot = strchr(entry->name, '.');
214
187
  ldot = strrchr(entry->name, '.');
215
188
 
216
- if (git_strmap_exists(names, entry->value)) {
217
- git_error_set(GIT_ERROR_SUBMODULE,
189
+ if (git_strmap_exists(out, entry->value)) {
190
+ giterr_set(GITERR_SUBMODULE,
218
191
  "duplicated submodule path '%s'", entry->value);
219
192
  error = -1;
220
193
  goto out;
@@ -230,21 +203,17 @@ static int load_submodule_names(git_strmap **out, git_repository *repo, git_conf
230
203
  if (!isvalid)
231
204
  continue;
232
205
 
233
- if ((error = git_strmap_set(names, git__strdup(entry->value), git_buf_detach(&buf))) < 0) {
234
- git_error_set(GIT_ERROR_NOMEMORY, "error inserting submodule into hash table");
235
- error = -1;
236
- goto out;
206
+ git_strmap_insert(out, entry->value, git_buf_detach(&buf), &rval);
207
+ if (rval < 0) {
208
+ giterr_set(GITERR_NOMEMORY, "error inserting submodule into hash table");
209
+ return -1;
237
210
  }
238
211
  }
239
212
  if (error == GIT_ITEROVER)
240
213
  error = 0;
241
214
 
242
- *out = names;
243
- names = NULL;
244
-
245
215
  out:
246
- free_submodule_names(names);
247
- git_buf_dispose(&buf);
216
+ git_buf_free(&buf);
248
217
  git_config_iterator_free(iter);
249
218
  return error;
250
219
  }
@@ -261,14 +230,15 @@ int git_submodule_lookup(
261
230
  assert(repo && name);
262
231
 
263
232
  if (repo->is_bare) {
264
- git_error_set(GIT_ERROR_SUBMODULE, "cannot get submodules without a working tree");
233
+ giterr_set(GITERR_SUBMODULE, "cannot get submodules without a working tree");
265
234
  return -1;
266
235
  }
267
236
 
268
237
  if (repo->submodule_cache != NULL) {
269
- if ((sm = git_strmap_get(repo->submodule_cache, name)) != NULL) {
238
+ khiter_t pos = git_strmap_lookup_index(repo->submodule_cache, name);
239
+ if (git_strmap_valid_index(repo->submodule_cache, pos)) {
270
240
  if (out) {
271
- *out = sm;
241
+ *out = git_strmap_value_at(repo->submodule_cache, pos);
272
242
  GIT_REFCOUNT_INC(*out);
273
243
  }
274
244
  return 0;
@@ -304,13 +274,13 @@ int git_submodule_lookup(
304
274
  mods = open_gitmodules(repo, GITMODULES_EXISTING);
305
275
 
306
276
  if (mods)
307
- error = git_config_backend_foreach_match(mods, pattern, find_by_path, &data);
277
+ error = git_config_file_foreach_match(mods, pattern, find_by_path, &data);
308
278
 
309
- git_config_backend_free(mods);
279
+ git_config_file_free(mods);
310
280
 
311
281
  if (error < 0) {
312
282
  git_submodule_free(sm);
313
- git_buf_dispose(&path);
283
+ git_buf_free(&path);
314
284
  return error;
315
285
  }
316
286
 
@@ -326,7 +296,7 @@ int git_submodule_lookup(
326
296
  }
327
297
  }
328
298
 
329
- git_buf_dispose(&path);
299
+ git_buf_free(&path);
330
300
  }
331
301
 
332
302
  if ((error = git_submodule_location(&location, sm)) < 0) {
@@ -349,7 +319,7 @@ int git_submodule_lookup(
349
319
  if (git_path_exists(path.ptr))
350
320
  error = GIT_EEXISTS;
351
321
 
352
- git_buf_dispose(&path);
322
+ git_buf_free(&path);
353
323
  }
354
324
 
355
325
  submodule_set_lookup_error(error, name);
@@ -381,7 +351,7 @@ int git_submodule_name_is_valid(git_repository *repo, const char *name, int flag
381
351
  }
382
352
 
383
353
  isvalid = git_path_isvalid(repo, buf.ptr, 0, flags);
384
- git_buf_dispose(&buf);
354
+ git_buf_free(&buf);
385
355
 
386
356
  return isvalid;
387
357
  }
@@ -393,21 +363,30 @@ static void submodule_free_dup(void *sm)
393
363
 
394
364
  static int submodule_get_or_create(git_submodule **out, git_repository *repo, git_strmap *map, const char *name)
395
365
  {
366
+ int error = 0;
367
+ khiter_t pos;
396
368
  git_submodule *sm = NULL;
397
- int error;
398
369
 
399
- if ((sm = git_strmap_get(map, name)) != NULL)
370
+ pos = git_strmap_lookup_index(map, name);
371
+ if (git_strmap_valid_index(map, pos)) {
372
+ sm = git_strmap_value_at(map, pos);
400
373
  goto done;
374
+ }
401
375
 
402
376
  /* if the submodule doesn't exist yet in the map, create it */
403
377
  if ((error = submodule_alloc(&sm, repo, name)) < 0)
404
378
  return error;
405
379
 
406
- if ((error = git_strmap_set(map, sm->name, sm)) < 0) {
380
+ pos = git_strmap_put(map, sm->name, &error);
381
+ /* nobody can beat us to adding it */
382
+ assert(error != 0);
383
+ if (error < 0) {
407
384
  git_submodule_free(sm);
408
385
  return error;
409
386
  }
410
387
 
388
+ git_strmap_set_value_at(map, pos, sm);
389
+
411
390
  done:
412
391
  GIT_REFCOUNT_INC(sm);
413
392
  *out = sm;
@@ -419,27 +398,36 @@ static int submodules_from_index(git_strmap *map, git_index *idx, git_config *cf
419
398
  int error;
420
399
  git_iterator *i = NULL;
421
400
  const git_index_entry *entry;
422
- git_strmap *names;
401
+ git_strmap *names = 0;
423
402
 
424
- if ((error = load_submodule_names(&names, git_index_owner(idx), cfg)))
403
+ git_strmap_alloc(&names);
404
+ if ((error = load_submodule_names(names, git_index_owner(idx), cfg)))
425
405
  goto done;
426
406
 
427
407
  if ((error = git_iterator_for_index(&i, git_index_owner(idx), idx, NULL)) < 0)
428
408
  goto done;
429
409
 
430
410
  while (!(error = git_iterator_advance(&entry, i))) {
411
+ khiter_t pos = git_strmap_lookup_index(map, entry->path);
431
412
  git_submodule *sm;
432
413
 
433
- if ((sm = git_strmap_get(map, entry->path)) != NULL) {
414
+ if (git_strmap_valid_index(map, pos)) {
415
+ sm = git_strmap_value_at(map, pos);
416
+
434
417
  if (S_ISGITLINK(entry->mode))
435
418
  submodule_update_from_index_entry(sm, entry);
436
419
  else
437
420
  sm->flags |= GIT_SUBMODULE_STATUS__INDEX_NOT_SUBMODULE;
438
421
  } else if (S_ISGITLINK(entry->mode)) {
422
+ khiter_t name_pos;
439
423
  const char *name;
440
424
 
441
- if ((name = git_strmap_get(names, entry->path)) == NULL)
425
+ name_pos = git_strmap_lookup_index(names, entry->path);
426
+ if (git_strmap_valid_index(names, name_pos)) {
427
+ name = git_strmap_value_at(names, name_pos);
428
+ } else {
442
429
  name = entry->path;
430
+ }
443
431
 
444
432
  if (!submodule_get_or_create(&sm, git_index_owner(idx), map, name)) {
445
433
  submodule_update_from_index_entry(sm, entry);
@@ -463,27 +451,35 @@ static int submodules_from_head(git_strmap *map, git_tree *head, git_config *cfg
463
451
  int error;
464
452
  git_iterator *i = NULL;
465
453
  const git_index_entry *entry;
466
- git_strmap *names;
467
-
468
- if ((error = load_submodule_names(&names, git_tree_owner(head), cfg)))
454
+ git_strmap *names = 0;
455
+ git_strmap_alloc(&names);
456
+ if ((error = load_submodule_names(names, git_tree_owner(head), cfg)))
469
457
  goto done;
470
458
 
471
459
  if ((error = git_iterator_for_tree(&i, head, NULL)) < 0)
472
460
  goto done;
473
461
 
474
462
  while (!(error = git_iterator_advance(&entry, i))) {
463
+ khiter_t pos = git_strmap_lookup_index(map, entry->path);
475
464
  git_submodule *sm;
476
465
 
477
- if ((sm = git_strmap_get(map, entry->path)) != NULL) {
466
+ if (git_strmap_valid_index(map, pos)) {
467
+ sm = git_strmap_value_at(map, pos);
468
+
478
469
  if (S_ISGITLINK(entry->mode))
479
470
  submodule_update_from_head_data(sm, entry->mode, &entry->id);
480
471
  else
481
472
  sm->flags |= GIT_SUBMODULE_STATUS__HEAD_NOT_SUBMODULE;
482
473
  } else if (S_ISGITLINK(entry->mode)) {
474
+ khiter_t name_pos;
483
475
  const char *name;
484
476
 
485
- if ((name = git_strmap_get(names, entry->path)) == NULL)
477
+ name_pos = git_strmap_lookup_index(names, entry->path);
478
+ if (git_strmap_valid_index(names, name_pos)) {
479
+ name = git_strmap_value_at(names, name_pos);
480
+ } else {
486
481
  name = entry->path;
482
+ }
487
483
 
488
484
  if (!submodule_get_or_create(&sm, git_tree_owner(head), map, name)) {
489
485
  submodule_update_from_head_data(
@@ -519,19 +515,36 @@ int git_submodule__map(git_repository *repo, git_strmap *map)
519
515
  git_buf path = GIT_BUF_INIT;
520
516
  git_submodule *sm;
521
517
  git_config *mods = NULL;
518
+ uint32_t mask;
522
519
 
523
520
  assert(repo && map);
524
521
 
525
522
  /* get sources that we will need to check */
526
523
  if (git_repository_index(&idx, repo) < 0)
527
- git_error_clear();
524
+ giterr_clear();
528
525
  if (git_repository_head_tree(&head, repo) < 0)
529
- git_error_clear();
526
+ giterr_clear();
530
527
 
531
528
  wd = git_repository_workdir(repo);
532
529
  if (wd && (error = git_buf_joinpath(&path, wd, GIT_MODULES_FILE)) < 0)
533
530
  goto cleanup;
534
531
 
532
+ /* clear submodule flags that are to be refreshed */
533
+ mask = 0;
534
+ mask |= GIT_SUBMODULE_STATUS_IN_INDEX |
535
+ GIT_SUBMODULE_STATUS__INDEX_FLAGS |
536
+ GIT_SUBMODULE_STATUS__INDEX_OID_VALID |
537
+ GIT_SUBMODULE_STATUS__INDEX_MULTIPLE_ENTRIES;
538
+
539
+ mask |= GIT_SUBMODULE_STATUS_IN_HEAD |
540
+ GIT_SUBMODULE_STATUS__HEAD_OID_VALID;
541
+ mask |= GIT_SUBMODULE_STATUS_IN_CONFIG;
542
+ if (mask != 0)
543
+ mask |= GIT_SUBMODULE_STATUS_IN_WD |
544
+ GIT_SUBMODULE_STATUS__WD_SCANNED |
545
+ GIT_SUBMODULE_STATUS__WD_FLAGS |
546
+ GIT_SUBMODULE_STATUS__WD_OID_VALID;
547
+
535
548
  /* add submodule information from .gitmodules */
536
549
  if (wd) {
537
550
  lfc_data data = { 0 };
@@ -560,7 +573,7 @@ int git_submodule__map(git_repository *repo, git_strmap *map)
560
573
  goto cleanup;
561
574
  }
562
575
  /* shallow scan submodules in work tree as needed */
563
- if (wd) {
576
+ if (wd && mask != 0) {
564
577
  git_strmap_foreach_value(map, sm, {
565
578
  submodule_load_from_wd_lite(sm);
566
579
  });
@@ -571,7 +584,7 @@ cleanup:
571
584
  /* TODO: if we got an error, mark submodule config as invalid? */
572
585
  git_index_free(idx);
573
586
  git_tree_free(head);
574
- git_buf_dispose(&path);
587
+ git_buf_free(&path);
575
588
  return error;
576
589
  }
577
590
 
@@ -587,18 +600,18 @@ int git_submodule_foreach(
587
600
  size_t i;
588
601
 
589
602
  if (repo->is_bare) {
590
- git_error_set(GIT_ERROR_SUBMODULE, "cannot get submodules without a working tree");
603
+ giterr_set(GITERR_SUBMODULE, "cannot get submodules without a working tree");
591
604
  return -1;
592
605
  }
593
606
 
594
- if ((error = git_strmap_new(&submodules)) < 0)
607
+ if ((error = git_strmap_alloc(&submodules)) < 0)
595
608
  return error;
596
609
 
597
610
  if ((error = git_submodule__map(repo, submodules)) < 0)
598
611
  goto done;
599
612
 
600
613
  if (!(error = git_vector_init(
601
- &snapshot, git_strmap_size(submodules), submodule_cmp))) {
614
+ &snapshot, git_strmap_num_entries(submodules), submodule_cmp))) {
602
615
 
603
616
  git_strmap_foreach_value(submodules, sm, {
604
617
  if ((error = git_vector_insert(&snapshot, sm)) < 0)
@@ -614,7 +627,7 @@ int git_submodule_foreach(
614
627
 
615
628
  git_vector_foreach(&snapshot, i, sm) {
616
629
  if ((error = callback(sm, sm->name, payload)) != 0) {
617
- git_error_set_after_callback(error);
630
+ giterr_set_after_callback(error);
618
631
  break;
619
632
  }
620
633
  }
@@ -676,8 +689,8 @@ static int submodule_repo_init(
676
689
  error = git_repository_init_ext(&subrepo, workdir.ptr, &initopt);
677
690
 
678
691
  cleanup:
679
- git_buf_dispose(&workdir);
680
- git_buf_dispose(&repodir);
692
+ git_buf_free(&workdir);
693
+ git_buf_free(&repodir);
681
694
 
682
695
  *out = subrepo;
683
696
 
@@ -696,16 +709,15 @@ int git_submodule_add_setup(
696
709
  git_submodule *sm = NULL;
697
710
  git_buf name = GIT_BUF_INIT, real_url = GIT_BUF_INIT;
698
711
  git_repository *subrepo = NULL;
699
- bool path_occupied;
700
712
 
701
713
  assert(repo && url && path);
702
714
 
703
715
  /* see if there is already an entry for this submodule */
704
716
 
705
717
  if (git_submodule_lookup(NULL, repo, path) < 0)
706
- git_error_clear();
718
+ giterr_clear();
707
719
  else {
708
- git_error_set(GIT_ERROR_SUBMODULE,
720
+ giterr_set(GITERR_SUBMODULE,
709
721
  "attempt to add submodule '%s' that already exists", path);
710
722
  return GIT_EEXISTS;
711
723
  }
@@ -716,33 +728,25 @@ int git_submodule_add_setup(
716
728
  path += strlen(git_repository_workdir(repo));
717
729
 
718
730
  if (git_path_root(path) >= 0) {
719
- git_error_set(GIT_ERROR_SUBMODULE, "submodule path must be a relative path");
731
+ giterr_set(GITERR_SUBMODULE, "submodule path must be a relative path");
720
732
  error = -1;
721
733
  goto cleanup;
722
734
  }
723
735
 
724
- if ((error = is_path_occupied(&path_occupied, repo, path)) < 0)
725
- goto cleanup;
726
-
727
- if (path_occupied) {
728
- error = GIT_EEXISTS;
729
- goto cleanup;
730
- }
731
-
732
736
  /* update .gitmodules */
733
737
 
734
738
  if (!(mods = open_gitmodules(repo, GITMODULES_CREATE))) {
735
- git_error_set(GIT_ERROR_SUBMODULE,
739
+ giterr_set(GITERR_SUBMODULE,
736
740
  "adding submodules to a bare repository is not supported");
737
741
  return -1;
738
742
  }
739
743
 
740
744
  if ((error = git_buf_printf(&name, "submodule.%s.path", path)) < 0 ||
741
- (error = git_config_backend_set_string(mods, name.ptr, path)) < 0)
745
+ (error = git_config_file_set_string(mods, name.ptr, path)) < 0)
742
746
  goto cleanup;
743
747
 
744
748
  if ((error = submodule_config_key_trunc_puts(&name, "url")) < 0 ||
745
- (error = git_config_backend_set_string(mods, name.ptr, url)) < 0)
749
+ (error = git_config_file_set_string(mods, name.ptr, url)) < 0)
746
750
  goto cleanup;
747
751
 
748
752
  git_buf_clear(&name);
@@ -780,10 +784,10 @@ cleanup:
780
784
  if (out != NULL)
781
785
  *out = sm;
782
786
 
783
- git_config_backend_free(mods);
787
+ git_config_file_free(mods);
784
788
  git_repository_free(subrepo);
785
- git_buf_dispose(&real_url);
786
- git_buf_dispose(&name);
789
+ git_buf_free(&real_url);
790
+ git_buf_free(&name);
787
791
 
788
792
  return error;
789
793
  }
@@ -812,65 +816,7 @@ int git_submodule_repo_init(
812
816
 
813
817
  done:
814
818
  git_config_free(cfg);
815
- git_buf_dispose(&buf);
816
- return error;
817
- }
818
-
819
- static int clone_return_origin(git_remote **out, git_repository *repo, const char *name, const char *url, void *payload)
820
- {
821
- GIT_UNUSED(url);
822
- GIT_UNUSED(payload);
823
- return git_remote_lookup(out, repo, name);
824
- }
825
-
826
- static int clone_return_repo(git_repository **out, const char *path, int bare, void *payload)
827
- {
828
- git_submodule *sm = payload;
829
-
830
- GIT_UNUSED(path);
831
- GIT_UNUSED(bare);
832
- return git_submodule_open(out, sm);
833
- }
834
-
835
- int git_submodule_clone(git_repository **out, git_submodule *submodule, const git_submodule_update_options *given_opts)
836
- {
837
- int error;
838
- git_repository *clone;
839
- git_buf rel_path = GIT_BUF_INIT;
840
- git_submodule_update_options sub_opts = GIT_SUBMODULE_UPDATE_OPTIONS_INIT;
841
- git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
842
-
843
- assert(submodule);
844
-
845
- if (given_opts)
846
- memcpy(&sub_opts, given_opts, sizeof(sub_opts));
847
-
848
- GIT_ERROR_CHECK_VERSION(&sub_opts, GIT_SUBMODULE_UPDATE_OPTIONS_VERSION, "git_submodule_update_options");
849
-
850
- memcpy(&opts.checkout_opts, &sub_opts.checkout_opts, sizeof(sub_opts.checkout_opts));
851
- memcpy(&opts.fetch_opts, &sub_opts.fetch_opts, sizeof(sub_opts.fetch_opts));
852
- opts.repository_cb = clone_return_repo;
853
- opts.repository_cb_payload = submodule;
854
- opts.remote_cb = clone_return_origin;
855
- opts.remote_cb_payload = submodule;
856
-
857
- git_buf_puts(&rel_path, git_repository_workdir(git_submodule_owner(submodule)));
858
- git_buf_joinpath(&rel_path, git_buf_cstr(&rel_path), git_submodule_path(submodule));
859
-
860
- GIT_ERROR_CHECK_ALLOC_BUF(&rel_path);
861
-
862
- error = git_clone__submodule(&clone, git_submodule_url(submodule), git_buf_cstr(&rel_path), &opts);
863
- if (error < 0)
864
- goto cleanup;
865
-
866
- if (!out)
867
- git_repository_free(clone);
868
- else
869
- *out = clone;
870
-
871
- cleanup:
872
- git_buf_dispose(&rel_path);
873
-
819
+ git_buf_free(&buf);
874
820
  return error;
875
821
  }
876
822
 
@@ -911,7 +857,7 @@ int git_submodule_add_to_index(git_submodule *sm, int write_index)
911
857
 
912
858
  /* read stat information for submodule working directory */
913
859
  if (p_stat(path.ptr, &st) < 0) {
914
- git_error_set(GIT_ERROR_SUBMODULE,
860
+ giterr_set(GITERR_SUBMODULE,
915
861
  "cannot add submodule without working directory");
916
862
  error = -1;
917
863
  goto cleanup;
@@ -920,11 +866,11 @@ int git_submodule_add_to_index(git_submodule *sm, int write_index)
920
866
  memset(&entry, 0, sizeof(entry));
921
867
  entry.path = sm->path;
922
868
  git_index_entry__init_from_stat(
923
- &entry, &st, !(git_index_caps(index) & GIT_INDEX_CAPABILITY_NO_FILEMODE));
869
+ &entry, &st, !(git_index_caps(index) & GIT_INDEXCAP_NO_FILEMODE));
924
870
 
925
871
  /* calling git_submodule_open will have set sm->wd_oid if possible */
926
872
  if ((sm->flags & GIT_SUBMODULE_STATUS__WD_OID_VALID) == 0) {
927
- git_error_set(GIT_ERROR_SUBMODULE,
873
+ giterr_set(GITERR_SUBMODULE,
928
874
  "cannot add submodule without HEAD to index");
929
875
  error = -1;
930
876
  goto cleanup;
@@ -954,7 +900,7 @@ int git_submodule_add_to_index(git_submodule *sm, int write_index)
954
900
 
955
901
  cleanup:
956
902
  git_repository_free(sm_repo);
957
- git_buf_dispose(&path);
903
+ git_buf_free(&path);
958
904
  return error;
959
905
  }
960
906
 
@@ -1015,11 +961,11 @@ int git_submodule_resolve_url(git_buf *out, git_repository *repo, const char *ur
1015
961
  } else if (strchr(url, ':') != NULL || url[0] == '/') {
1016
962
  error = git_buf_sets(out, url);
1017
963
  } else {
1018
- git_error_set(GIT_ERROR_SUBMODULE, "invalid format for submodule URL");
964
+ giterr_set(GITERR_SUBMODULE, "invalid format for submodule URL");
1019
965
  error = -1;
1020
966
  }
1021
967
 
1022
- git_buf_dispose(&normalized);
968
+ git_buf_free(&normalized);
1023
969
  return error;
1024
970
  }
1025
971
 
@@ -1037,28 +983,28 @@ static int write_var(git_repository *repo, const char *name, const char *var, co
1037
983
  goto cleanup;
1038
984
 
1039
985
  if (val)
1040
- error = git_config_backend_set_string(mods, key.ptr, val);
986
+ error = git_config_file_set_string(mods, key.ptr, val);
1041
987
  else
1042
- error = git_config_backend_delete(mods, key.ptr);
988
+ error = git_config_file_delete(mods, key.ptr);
1043
989
 
1044
- git_buf_dispose(&key);
990
+ git_buf_free(&key);
1045
991
 
1046
992
  cleanup:
1047
- git_config_backend_free(mods);
993
+ git_config_file_free(mods);
1048
994
  return error;
1049
995
  }
1050
996
 
1051
- static int write_mapped_var(git_repository *repo, const char *name, git_configmap *maps, size_t nmaps, const char *var, int ival)
997
+ static int write_mapped_var(git_repository *repo, const char *name, git_cvar_map *maps, size_t nmaps, const char *var, int ival)
1052
998
  {
1053
- git_configmap_t type;
999
+ git_cvar_t type;
1054
1000
  const char *val;
1055
1001
 
1056
1002
  if (git_config_lookup_map_enum(&type, &val, maps, nmaps, ival) < 0) {
1057
- git_error_set(GIT_ERROR_SUBMODULE, "invalid value for %s", var);
1003
+ giterr_set(GITERR_SUBMODULE, "invalid value for %s", var);
1058
1004
  return -1;
1059
1005
  }
1060
1006
 
1061
- if (type == GIT_CONFIGMAP_TRUE)
1007
+ if (type == GIT_CVAR_TRUE)
1062
1008
  val = "true";
1063
1009
 
1064
1010
  return write_var(repo, name, var, val);
@@ -1117,7 +1063,7 @@ const git_oid *git_submodule_wd_id(git_submodule *submodule)
1117
1063
  if (!git_submodule_open_bare(&subrepo, submodule))
1118
1064
  git_repository_free(subrepo);
1119
1065
  else
1120
- git_error_clear();
1066
+ giterr_clear();
1121
1067
  }
1122
1068
 
1123
1069
  if (submodule->flags & GIT_SUBMODULE_STATUS__WD_OID_VALID)
@@ -1206,8 +1152,8 @@ static int submodule_repo_create(
1206
1152
  error = git_repository_init_ext(&subrepo, repodir.ptr, &initopt);
1207
1153
 
1208
1154
  cleanup:
1209
- git_buf_dispose(&workdir);
1210
- git_buf_dispose(&repodir);
1155
+ git_buf_free(&workdir);
1156
+ git_buf_free(&repodir);
1211
1157
 
1212
1158
  *out = subrepo;
1213
1159
 
@@ -1233,18 +1179,13 @@ static int git_submodule_update_repo_init_cb(
1233
1179
  return submodule_repo_create(out, sm->repo, path);
1234
1180
  }
1235
1181
 
1236
- int git_submodule_update_options_init(git_submodule_update_options *opts, unsigned int version)
1182
+ int git_submodule_update_init_options(git_submodule_update_options *opts, unsigned int version)
1237
1183
  {
1238
1184
  GIT_INIT_STRUCTURE_FROM_TEMPLATE(
1239
1185
  opts, version, git_submodule_update_options, GIT_SUBMODULE_UPDATE_OPTIONS_INIT);
1240
1186
  return 0;
1241
1187
  }
1242
1188
 
1243
- int git_submodule_update_init_options(git_submodule_update_options *opts, unsigned int version)
1244
- {
1245
- return git_submodule_update_options_init(opts, version);
1246
- }
1247
-
1248
1189
  int git_submodule_update(git_submodule *sm, int init, git_submodule_update_options *_update_options)
1249
1190
  {
1250
1191
  int error;
@@ -1263,7 +1204,7 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
1263
1204
  if (_update_options)
1264
1205
  memcpy(&update_options, _update_options, sizeof(git_submodule_update_options));
1265
1206
 
1266
- GIT_ERROR_CHECK_VERSION(&update_options, GIT_SUBMODULE_UPDATE_OPTIONS_VERSION, "git_submodule_update_options");
1207
+ GITERR_CHECK_VERSION(&update_options, GIT_SUBMODULE_UPDATE_OPTIONS_VERSION, "git_submodule_update_options");
1267
1208
 
1268
1209
  /* Copy over the remote callbacks */
1269
1210
  memcpy(&clone_options.fetch_opts, &update_options.fetch_opts, sizeof(git_fetch_options));
@@ -1294,7 +1235,7 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
1294
1235
  goto done;
1295
1236
 
1296
1237
  if (!init) {
1297
- git_error_set(GIT_ERROR_SUBMODULE, "submodule is not initialized");
1238
+ giterr_set(GITERR_SUBMODULE, "submodule is not initialized");
1298
1239
  error = GIT_ERROR;
1299
1240
  goto done;
1300
1241
  }
@@ -1338,18 +1279,18 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
1338
1279
  goto done;
1339
1280
 
1340
1281
  if ((oid = git_submodule_index_id(sm)) == NULL) {
1341
- git_error_set(GIT_ERROR_SUBMODULE, "could not get ID of submodule in index");
1282
+ giterr_set(GITERR_SUBMODULE, "could not get ID of submodule in index");
1342
1283
  error = -1;
1343
1284
  goto done;
1344
1285
  }
1345
1286
 
1346
1287
  /* Look up the target commit in the submodule. */
1347
- if ((error = git_object_lookup(&target_commit, sub_repo, oid, GIT_OBJECT_COMMIT)) < 0) {
1288
+ if ((error = git_object_lookup(&target_commit, sub_repo, oid, GIT_OBJ_COMMIT)) < 0) {
1348
1289
  /* If it isn't found then fetch and try again. */
1349
1290
  if (error != GIT_ENOTFOUND || !update_options.allow_fetch ||
1350
1291
  (error = lookup_default_remote(&remote, sub_repo)) < 0 ||
1351
1292
  (error = git_remote_fetch(remote, NULL, &update_options.fetch_opts, NULL)) < 0 ||
1352
- (error = git_object_lookup(&target_commit, sub_repo, git_submodule_index_id(sm), GIT_OBJECT_COMMIT)) < 0)
1293
+ (error = git_object_lookup(&target_commit, sub_repo, git_submodule_index_id(sm), GIT_OBJ_COMMIT)) < 0)
1353
1294
  goto done;
1354
1295
  }
1355
1296
 
@@ -1365,7 +1306,7 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
1365
1306
  }
1366
1307
 
1367
1308
  done:
1368
- git_buf_dispose(&buf);
1309
+ git_buf_free(&buf);
1369
1310
  git_config_free(config);
1370
1311
  git_object_free(target_commit);
1371
1312
  git_remote_free(remote);
@@ -1382,7 +1323,7 @@ int git_submodule_init(git_submodule *sm, int overwrite)
1382
1323
  git_config *cfg = NULL;
1383
1324
 
1384
1325
  if (!sm->url) {
1385
- git_error_set(GIT_ERROR_SUBMODULE,
1326
+ giterr_set(GITERR_SUBMODULE,
1386
1327
  "no URL configured for submodule '%s'", sm->name);
1387
1328
  return -1;
1388
1329
  }
@@ -1412,8 +1353,8 @@ int git_submodule_init(git_submodule *sm, int overwrite)
1412
1353
 
1413
1354
  cleanup:
1414
1355
  git_config_free(cfg);
1415
- git_buf_dispose(&key);
1416
- git_buf_dispose(&effective_submodule_url);
1356
+ git_buf_free(&key);
1357
+ git_buf_free(&effective_submodule_url);
1417
1358
 
1418
1359
  return error;
1419
1360
  }
@@ -1426,7 +1367,7 @@ int git_submodule_sync(git_submodule *sm)
1426
1367
  git_repository *smrepo = NULL;
1427
1368
 
1428
1369
  if (!sm->url) {
1429
- git_error_set(GIT_ERROR_SUBMODULE,
1370
+ giterr_set(GITERR_SUBMODULE,
1430
1371
  "no URL configured for submodule '%s'", sm->name);
1431
1372
  return -1;
1432
1373
  }
@@ -1448,12 +1389,12 @@ int git_submodule_sync(git_submodule *sm)
1448
1389
  if ((error = git_repository_config__weakptr(&cfg, smrepo)) < 0)
1449
1390
  /* return error from reading submodule config */;
1450
1391
  else if ((error = lookup_head_remote_key(&remote_name, smrepo)) < 0) {
1451
- git_error_clear();
1392
+ giterr_clear();
1452
1393
  error = git_buf_sets(&key, "remote.origin.url");
1453
1394
  } else {
1454
1395
  error = git_buf_join3(
1455
1396
  &key, '.', "remote", remote_name.ptr, "url");
1456
- git_buf_dispose(&remote_name);
1397
+ git_buf_free(&remote_name);
1457
1398
  }
1458
1399
 
1459
1400
  if (!error)
@@ -1462,7 +1403,7 @@ int git_submodule_sync(git_submodule *sm)
1462
1403
  git_repository_free(smrepo);
1463
1404
  }
1464
1405
 
1465
- git_buf_dispose(&key);
1406
+ git_buf_free(&key);
1466
1407
 
1467
1408
  return error;
1468
1409
  }
@@ -1505,7 +1446,7 @@ static int git_submodule__open(
1505
1446
  if (!git_reference_name_to_id(&sm->wd_oid, *subrepo, GIT_HEAD_FILE))
1506
1447
  sm->flags |= GIT_SUBMODULE_STATUS__WD_OID_VALID;
1507
1448
  else
1508
- git_error_clear();
1449
+ giterr_clear();
1509
1450
  } else if (git_path_exists(path.ptr)) {
1510
1451
  sm->flags |= GIT_SUBMODULE_STATUS__WD_SCANNED |
1511
1452
  GIT_SUBMODULE_STATUS_IN_WD;
@@ -1516,7 +1457,7 @@ static int git_submodule__open(
1516
1457
  sm->flags |= GIT_SUBMODULE_STATUS__WD_SCANNED;
1517
1458
  }
1518
1459
 
1519
- git_buf_dispose(&path);
1460
+ git_buf_free(&path);
1520
1461
 
1521
1462
  return error;
1522
1463
  }
@@ -1595,7 +1536,7 @@ static int submodule_update_head(git_submodule *submodule)
1595
1536
  /* if we can't look up file in current head, then done */
1596
1537
  if (git_repository_head_tree(&head, submodule->repo) < 0 ||
1597
1538
  git_tree_entry_bypath(&te, head, submodule->path) < 0)
1598
- git_error_clear();
1539
+ giterr_clear();
1599
1540
  else
1600
1541
  submodule_update_from_head_data(submodule, te->attr, git_tree_entry_id(te));
1601
1542
 
@@ -1698,12 +1639,12 @@ int git_submodule__status(
1698
1639
  if (ign == GIT_SUBMODULE_IGNORE_DIRTY) {
1699
1640
  /* git_submodule_open_bare will load WD OID data */
1700
1641
  if (git_submodule_open_bare(&smrepo, sm) < 0)
1701
- git_error_clear();
1642
+ giterr_clear();
1702
1643
  else
1703
1644
  git_repository_free(smrepo);
1704
1645
  smrepo = NULL;
1705
1646
  } else if (git_submodule_open(&smrepo, sm) < 0) {
1706
- git_error_clear();
1647
+ giterr_clear();
1707
1648
  smrepo = NULL;
1708
1649
  }
1709
1650
 
@@ -1761,12 +1702,12 @@ static int submodule_alloc(
1761
1702
  git_submodule *sm;
1762
1703
 
1763
1704
  if (!name || !(namelen = strlen(name))) {
1764
- git_error_set(GIT_ERROR_SUBMODULE, "invalid submodule name");
1705
+ giterr_set(GITERR_SUBMODULE, "invalid submodule name");
1765
1706
  return -1;
1766
1707
  }
1767
1708
 
1768
1709
  sm = git__calloc(1, sizeof(git_submodule));
1769
- GIT_ERROR_CHECK_ALLOC(sm);
1710
+ GITERR_CHECK_ALLOC(sm);
1770
1711
 
1771
1712
  sm->name = sm->path = git__strdup(name);
1772
1713
  if (!sm->name) {
@@ -1812,7 +1753,7 @@ void git_submodule_free(git_submodule *sm)
1812
1753
 
1813
1754
  static int submodule_config_error(const char *property, const char *value)
1814
1755
  {
1815
- git_error_set(GIT_ERROR_INVALID,
1756
+ giterr_set(GITERR_INVALID,
1816
1757
  "invalid value for submodule '%s' property: '%s'", property, value);
1817
1758
  return -1;
1818
1759
  }
@@ -1903,7 +1844,7 @@ static int submodule_read_config(git_submodule *sm, git_config *cfg)
1903
1844
  if (sm->path != sm->name)
1904
1845
  git__free(sm->path);
1905
1846
  sm->path = git__strdup(value);
1906
- GIT_ERROR_CHECK_ALLOC(sm->path);
1847
+ GITERR_CHECK_ALLOC(sm->path);
1907
1848
  }
1908
1849
 
1909
1850
  }
@@ -1916,7 +1857,7 @@ static int submodule_read_config(git_submodule *sm, git_config *cfg)
1916
1857
  if (!looks_like_command_line_option(value)) {
1917
1858
  in_config = 1;
1918
1859
  sm->url = git__strdup(value);
1919
- GIT_ERROR_CHECK_ALLOC(sm->url);
1860
+ GITERR_CHECK_ALLOC(sm->url);
1920
1861
  }
1921
1862
  } else if (error != GIT_ENOTFOUND) {
1922
1863
  goto cleanup;
@@ -1925,7 +1866,7 @@ static int submodule_read_config(git_submodule *sm, git_config *cfg)
1925
1866
  if ((error = get_value(&value, cfg, &key, sm->name, "branch")) == 0) {
1926
1867
  in_config = 1;
1927
1868
  sm->branch = git__strdup(value);
1928
- GIT_ERROR_CHECK_ALLOC(sm->branch);
1869
+ GITERR_CHECK_ALLOC(sm->branch);
1929
1870
  } else if (error != GIT_ENOTFOUND) {
1930
1871
  goto cleanup;
1931
1872
  }
@@ -1963,7 +1904,7 @@ static int submodule_read_config(git_submodule *sm, git_config *cfg)
1963
1904
  error = 0;
1964
1905
 
1965
1906
  cleanup:
1966
- git_buf_dispose(&key);
1907
+ git_buf_free(&key);
1967
1908
  return error;
1968
1909
  }
1969
1910
 
@@ -1971,6 +1912,7 @@ static int submodule_load_each(const git_config_entry *entry, void *payload)
1971
1912
  {
1972
1913
  lfc_data *data = payload;
1973
1914
  const char *namestart, *property;
1915
+ git_strmap_iter pos;
1974
1916
  git_strmap *map = data->map;
1975
1917
  git_buf name = GIT_BUF_INIT;
1976
1918
  git_submodule *sm;
@@ -2002,7 +1944,8 @@ static int submodule_load_each(const git_config_entry *entry, void *payload)
2002
1944
  * a new submodule, load the config and insert it. If it's
2003
1945
  * already inserted, we've already loaded it, so we skip.
2004
1946
  */
2005
- if (git_strmap_exists(map, name.ptr)) {
1947
+ pos = git_strmap_lookup_index(map, name.ptr);
1948
+ if (git_strmap_valid_index(map, pos)) {
2006
1949
  error = 0;
2007
1950
  goto done;
2008
1951
  }
@@ -2015,13 +1958,15 @@ static int submodule_load_each(const git_config_entry *entry, void *payload)
2015
1958
  goto done;
2016
1959
  }
2017
1960
 
2018
- if ((error = git_strmap_set(map, sm->name, sm)) < 0)
1961
+ git_strmap_insert(map, sm->name, sm, &error);
1962
+ assert(error != 0);
1963
+ if (error < 0)
2019
1964
  goto done;
2020
1965
 
2021
1966
  error = 0;
2022
1967
 
2023
1968
  done:
2024
- git_buf_dispose(&name);
1969
+ git_buf_free(&name);
2025
1970
  return error;
2026
1971
  }
2027
1972
 
@@ -2038,7 +1983,7 @@ static int submodule_load_from_wd_lite(git_submodule *sm)
2038
1983
  if (git_path_contains(&path, DOT_GIT))
2039
1984
  sm->flags |= GIT_SUBMODULE_STATUS_IN_WD;
2040
1985
 
2041
- git_buf_dispose(&path);
1986
+ git_buf_free(&path);
2042
1987
  return 0;
2043
1988
  }
2044
1989
 
@@ -2062,7 +2007,6 @@ static int gitmodules_snapshot(git_config **snap, git_repository *repo)
2062
2007
 
2063
2008
  if ((error = git_config_open_ondisk(&mods, path.ptr)) < 0)
2064
2009
  goto cleanup;
2065
- git_buf_dispose(&path);
2066
2010
 
2067
2011
  if ((error = git_config_snapshot(snap, mods)) < 0)
2068
2012
  goto cleanup;
@@ -2072,7 +2016,7 @@ static int gitmodules_snapshot(git_config **snap, git_repository *repo)
2072
2016
  cleanup:
2073
2017
  if (mods)
2074
2018
  git_config_free(mods);
2075
- git_buf_dispose(&path);
2019
+ git_buf_free(&path);
2076
2020
 
2077
2021
  return error;
2078
2022
  }
@@ -2090,18 +2034,18 @@ static git_config_backend *open_gitmodules(
2090
2034
  return NULL;
2091
2035
 
2092
2036
  if (okay_to_create || git_path_isfile(path.ptr)) {
2093
- /* git_config_backend_from_file should only fail if OOM */
2094
- if (git_config_backend_from_file(&mods, path.ptr) < 0)
2037
+ /* git_config_file__ondisk should only fail if OOM */
2038
+ if (git_config_file__ondisk(&mods, path.ptr) < 0)
2095
2039
  mods = NULL;
2096
2040
  /* open should only fail here if the file is malformed */
2097
- else if (git_config_backend_open(mods, GIT_CONFIG_LEVEL_LOCAL, repo) < 0) {
2098
- git_config_backend_free(mods);
2041
+ else if (git_config_file_open(mods, GIT_CONFIG_LEVEL_LOCAL, repo) < 0) {
2042
+ git_config_file_free(mods);
2099
2043
  mods = NULL;
2100
2044
  }
2101
2045
  }
2102
2046
  }
2103
2047
 
2104
- git_buf_dispose(&path);
2048
+ git_buf_free(&path);
2105
2049
 
2106
2050
  return mods;
2107
2051
  }
@@ -2123,7 +2067,7 @@ static int lookup_head_remote_key(git_buf *remote_name, git_repository *repo)
2123
2067
  * a remote key for the local tracking branch HEAD points to.
2124
2068
  **/
2125
2069
  if (!git_reference_is_branch(head)) {
2126
- git_error_set(GIT_ERROR_INVALID,
2070
+ giterr_set(GITERR_INVALID,
2127
2071
  "HEAD does not refer to a branch.");
2128
2072
  error = GIT_ENOTFOUND;
2129
2073
  goto done;
@@ -2141,7 +2085,7 @@ static int lookup_head_remote_key(git_buf *remote_name, git_repository *repo)
2141
2085
  goto done;
2142
2086
 
2143
2087
  done:
2144
- git_buf_dispose(&upstream_name);
2088
+ git_buf_free(&upstream_name);
2145
2089
  git_reference_free(head);
2146
2090
 
2147
2091
  return error;
@@ -2157,7 +2101,7 @@ static int lookup_head_remote(git_remote **remote, git_repository *repo)
2157
2101
  if (!(error = lookup_head_remote_key(&remote_name, repo)))
2158
2102
  error = git_remote_lookup(remote, repo, remote_name.ptr);
2159
2103
 
2160
- git_buf_dispose(&remote_name);
2104
+ git_buf_free(&remote_name);
2161
2105
 
2162
2106
  return error;
2163
2107
  }
@@ -2172,8 +2116,8 @@ static int lookup_default_remote(git_remote **remote, git_repository *repo)
2172
2116
  error = git_remote_lookup(remote, repo, "origin");
2173
2117
 
2174
2118
  if (error == GIT_ENOTFOUND)
2175
- git_error_set(
2176
- GIT_ERROR_SUBMODULE,
2119
+ giterr_set(
2120
+ GITERR_SUBMODULE,
2177
2121
  "cannot get default remote for submodule - no local tracking "
2178
2122
  "branch for HEAD and origin does not exist");
2179
2123
 
@@ -2192,7 +2136,7 @@ static int get_url_base(git_buf *url, git_repository *repo)
2192
2136
  } else if (error != GIT_ENOTFOUND)
2193
2137
  goto out;
2194
2138
  else
2195
- git_error_clear();
2139
+ giterr_clear();
2196
2140
 
2197
2141
  /* if repository does not have a default remote, use workdir instead */
2198
2142
  if (git_repository_is_worktree(repo)) {
@@ -2273,11 +2217,11 @@ static void submodule_get_wd_status(
2273
2217
 
2274
2218
  /* if we don't have an unborn head, check diff with index */
2275
2219
  if (git_repository_head_tree(&sm_head, sm_repo) < 0)
2276
- git_error_clear();
2220
+ giterr_clear();
2277
2221
  else {
2278
2222
  /* perform head to index diff on submodule */
2279
2223
  if (git_diff_tree_to_index(&diff, sm_repo, sm_head, index, &opt) < 0)
2280
- git_error_clear();
2224
+ giterr_clear();
2281
2225
  else {
2282
2226
  if (git_diff_num_deltas(diff) > 0)
2283
2227
  *status |= GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED;
@@ -2290,7 +2234,7 @@ static void submodule_get_wd_status(
2290
2234
 
2291
2235
  /* perform index-to-workdir diff on submodule */
2292
2236
  if (git_diff_index_to_workdir(&diff, sm_repo, index, &opt) < 0)
2293
- git_error_clear();
2237
+ giterr_clear();
2294
2238
  else {
2295
2239
  size_t untracked =
2296
2240
  git_diff_num_deltas_of_type(diff, GIT_DELTA_UNTRACKED);