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,22 +11,15 @@
11
11
  # include <openssl/err.h>
12
12
  #endif
13
13
 
14
- #ifdef GIT_MBEDTLS
15
- # include <mbedtls/error.h>
16
- #endif
17
-
18
14
  #include <git2.h>
19
- #include "alloc.h"
20
15
  #include "sysdir.h"
21
16
  #include "cache.h"
22
17
  #include "global.h"
23
18
  #include "object.h"
24
19
  #include "odb.h"
25
20
  #include "refs.h"
26
- #include "index.h"
27
21
  #include "transports/smart.h"
28
22
  #include "streams/openssl.h"
29
- #include "streams/mbedtls.h"
30
23
 
31
24
  void git_libgit2_version(int *major, int *minor, int *rev)
32
25
  {
@@ -56,8 +49,6 @@ int git_libgit2_features(void)
56
49
  /* Declarations for tuneable settings */
57
50
  extern size_t git_mwindow__window_size;
58
51
  extern size_t git_mwindow__mapped_limit;
59
- extern size_t git_indexer__max_objects;
60
- extern bool git_disable_pack_keep_file_checks;
61
52
 
62
53
  static int config_level_to_sysdir(int config_level)
63
54
  {
@@ -77,8 +68,8 @@ static int config_level_to_sysdir(int config_level)
77
68
  val = GIT_SYSDIR_PROGRAMDATA;
78
69
  break;
79
70
  default:
80
- git_error_set(
81
- GIT_ERROR_INVALID, "invalid config path selector %d", config_level);
71
+ giterr_set(
72
+ GITERR_INVALID, "invalid config path selector %d", config_level);
82
73
  }
83
74
 
84
75
  return val;
@@ -141,7 +132,7 @@ int git_libgit2_opts(int key, ...)
141
132
 
142
133
  case GIT_OPT_SET_CACHE_OBJECT_LIMIT:
143
134
  {
144
- git_object_t type = (git_object_t)va_arg(ap, int);
135
+ git_otype type = (git_otype)va_arg(ap, int);
145
136
  size_t size = va_arg(ap, size_t);
146
137
  error = git_cache_set_max_object_size(type, size);
147
138
  break;
@@ -184,17 +175,8 @@ int git_libgit2_opts(int key, ...)
184
175
  const char *path = va_arg(ap, const char *);
185
176
  error = git_openssl__set_cert_location(file, path);
186
177
  }
187
- #elif defined(GIT_MBEDTLS)
188
- {
189
- const char *file = va_arg(ap, const char *);
190
- const char *path = va_arg(ap, const char *);
191
- if (file)
192
- error = git_mbedtls__set_cert_location(file, 0);
193
- if (error && path)
194
- error = git_mbedtls__set_cert_location(path, 1);
195
- }
196
178
  #else
197
- git_error_set(GIT_ERROR_SSL, "TLS backend doesn't support certificate locations");
179
+ giterr_set(GITERR_SSL, "TLS backend doesn't support certificate locations");
198
180
  error = -1;
199
181
  #endif
200
182
  break;
@@ -202,7 +184,7 @@ int git_libgit2_opts(int key, ...)
202
184
  git__free(git__user_agent);
203
185
  git__user_agent = git__strdup(va_arg(ap, const char *));
204
186
  if (!git__user_agent) {
205
- git_error_set_oom();
187
+ giterr_set_oom();
206
188
  error = -1;
207
189
  }
208
190
 
@@ -217,17 +199,17 @@ int git_libgit2_opts(int key, ...)
217
199
  break;
218
200
 
219
201
  case GIT_OPT_SET_SSL_CIPHERS:
220
- #if (GIT_OPENSSL || GIT_MBEDTLS)
202
+ #ifdef GIT_OPENSSL
221
203
  {
222
204
  git__free(git__ssl_ciphers);
223
205
  git__ssl_ciphers = git__strdup(va_arg(ap, const char *));
224
206
  if (!git__ssl_ciphers) {
225
- git_error_set_oom();
207
+ giterr_set_oom();
226
208
  error = -1;
227
209
  }
228
210
  }
229
211
  #else
230
- git_error_set(GIT_ERROR_SSL, "TLS backend doesn't support custom ciphers");
212
+ giterr_set(GITERR_SSL, "TLS backend doesn't support custom ciphers");
231
213
  error = -1;
232
214
  #endif
233
215
  break;
@@ -264,28 +246,8 @@ int git_libgit2_opts(int key, ...)
264
246
  git_odb__strict_hash_verification = (va_arg(ap, int) != 0);
265
247
  break;
266
248
 
267
- case GIT_OPT_SET_ALLOCATOR:
268
- error = git_allocator_setup(va_arg(ap, git_allocator *));
269
- break;
270
-
271
- case GIT_OPT_ENABLE_UNSAVED_INDEX_SAFETY:
272
- git_index__enforce_unsaved_safety = (va_arg(ap, int) != 0);
273
- break;
274
-
275
- case GIT_OPT_SET_PACK_MAX_OBJECTS:
276
- git_indexer__max_objects = va_arg(ap, size_t);
277
- break;
278
-
279
- case GIT_OPT_GET_PACK_MAX_OBJECTS:
280
- *(va_arg(ap, size_t *)) = git_indexer__max_objects;
281
- break;
282
-
283
- case GIT_OPT_DISABLE_PACK_KEEP_FILE_CHECKS:
284
- git_disable_pack_keep_file_checks = (va_arg(ap, int) != 0);
285
- break;
286
-
287
249
  default:
288
- git_error_set(GIT_ERROR_INVALID, "invalid option key");
250
+ giterr_set(GITERR_INVALID, "invalid option key");
289
251
  error = -1;
290
252
  }
291
253
 
@@ -293,3 +255,4 @@ int git_libgit2_opts(int key, ...)
293
255
 
294
256
  return error;
295
257
  }
258
+
@@ -25,7 +25,7 @@ void git_signature_free(git_signature *sig)
25
25
 
26
26
  static int signature_error(const char *msg)
27
27
  {
28
- git_error_set(GIT_ERROR_INVALID, "failed to parse signature - %s", msg);
28
+ giterr_set(GITERR_INVALID, "failed to parse signature - %s", msg);
29
29
  return -1;
30
30
  }
31
31
 
@@ -76,12 +76,12 @@ int git_signature_new(git_signature **sig_out, const char *name, const char *ema
76
76
  }
77
77
 
78
78
  p = git__calloc(1, sizeof(git_signature));
79
- GIT_ERROR_CHECK_ALLOC(p);
79
+ GITERR_CHECK_ALLOC(p);
80
80
 
81
81
  p->name = extract_trimmed(name, strlen(name));
82
- GIT_ERROR_CHECK_ALLOC(p->name);
82
+ GITERR_CHECK_ALLOC(p->name);
83
83
  p->email = extract_trimmed(email, strlen(email));
84
- GIT_ERROR_CHECK_ALLOC(p->email);
84
+ GITERR_CHECK_ALLOC(p->email);
85
85
 
86
86
  if (p->name[0] == '\0' || p->email[0] == '\0') {
87
87
  git_signature_free(p);
@@ -104,13 +104,13 @@ int git_signature_dup(git_signature **dest, const git_signature *source)
104
104
  return 0;
105
105
 
106
106
  signature = git__calloc(1, sizeof(git_signature));
107
- GIT_ERROR_CHECK_ALLOC(signature);
107
+ GITERR_CHECK_ALLOC(signature);
108
108
 
109
109
  signature->name = git__strdup(source->name);
110
- GIT_ERROR_CHECK_ALLOC(signature->name);
110
+ GITERR_CHECK_ALLOC(signature->name);
111
111
 
112
112
  signature->email = git__strdup(source->email);
113
- GIT_ERROR_CHECK_ALLOC(signature->email);
113
+ GITERR_CHECK_ALLOC(signature->email);
114
114
 
115
115
  signature->when.time = source->when.time;
116
116
  signature->when.offset = source->when.offset;
@@ -129,13 +129,13 @@ int git_signature__pdup(git_signature **dest, const git_signature *source, git_p
129
129
  return 0;
130
130
 
131
131
  signature = git_pool_mallocz(pool, sizeof(git_signature));
132
- GIT_ERROR_CHECK_ALLOC(signature);
132
+ GITERR_CHECK_ALLOC(signature);
133
133
 
134
134
  signature->name = git_pool_strdup(pool, source->name);
135
- GIT_ERROR_CHECK_ALLOC(signature->name);
135
+ GITERR_CHECK_ALLOC(signature->name);
136
136
 
137
137
  signature->email = git_pool_strdup(pool, source->email);
138
- GIT_ERROR_CHECK_ALLOC(signature->email);
138
+ GITERR_CHECK_ALLOC(signature->email);
139
139
 
140
140
  signature->when.time = source->when.time;
141
141
  signature->when.offset = source->when.offset;
@@ -284,7 +284,7 @@ int git_signature_from_buffer(git_signature **out, const char *buf)
284
284
  *out = NULL;
285
285
 
286
286
  sig = git__calloc(1, sizeof(git_signature));
287
- GIT_ERROR_CHECK_ALLOC(sig);
287
+ GITERR_CHECK_ALLOC(sig);
288
288
 
289
289
  buf_end = buf + strlen(buf);
290
290
  error = git_signature__parse(sig, &buf, buf_end, NULL, '\0');
@@ -20,19 +20,19 @@ int git_sortedcache_new(
20
20
 
21
21
  pathlen = path ? strlen(path) : 0;
22
22
 
23
- GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, sizeof(git_sortedcache), pathlen);
24
- GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
23
+ GITERR_CHECK_ALLOC_ADD(&alloclen, sizeof(git_sortedcache), pathlen);
24
+ GITERR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
25
25
  sc = git__calloc(1, alloclen);
26
- GIT_ERROR_CHECK_ALLOC(sc);
26
+ GITERR_CHECK_ALLOC(sc);
27
27
 
28
28
  git_pool_init(&sc->pool, 1);
29
29
 
30
30
  if (git_vector_init(&sc->items, 4, item_cmp) < 0 ||
31
- git_strmap_new(&sc->map) < 0)
31
+ git_strmap_alloc(&sc->map) < 0)
32
32
  goto fail;
33
33
 
34
34
  if (git_rwlock_init(&sc->lock)) {
35
- git_error_set(GIT_ERROR_OS, "failed to initialize lock");
35
+ giterr_set(GITERR_OS, "failed to initialize lock");
36
36
  goto fail;
37
37
  }
38
38
 
@@ -167,7 +167,7 @@ int git_sortedcache_wlock(git_sortedcache *sc)
167
167
  GIT_UNUSED(sc); /* prevent warning when compiled w/o threads */
168
168
 
169
169
  if (git_rwlock_wrlock(&sc->lock) < 0) {
170
- git_error_set(GIT_ERROR_OS, "unable to acquire write lock on cache");
170
+ giterr_set(GITERR_OS, "unable to acquire write lock on cache");
171
171
  return -1;
172
172
  }
173
173
  return 0;
@@ -186,7 +186,7 @@ int git_sortedcache_rlock(git_sortedcache *sc)
186
186
  GIT_UNUSED(sc); /* prevent warning when compiled w/o threads */
187
187
 
188
188
  if (git_rwlock_rdlock(&sc->lock) < 0) {
189
- git_error_set(GIT_ERROR_OS, "unable to acquire read lock on cache");
189
+ giterr_set(GITERR_OS, "unable to acquire read lock on cache");
190
190
  return -1;
191
191
  }
192
192
  return 0;
@@ -219,14 +219,14 @@ int git_sortedcache_lockandload(git_sortedcache *sc, git_buf *buf)
219
219
  }
220
220
 
221
221
  if (p_fstat(fd, &st) < 0) {
222
- git_error_set(GIT_ERROR_OS, "failed to stat file");
222
+ giterr_set(GITERR_OS, "failed to stat file");
223
223
  error = -1;
224
224
  (void)p_close(fd);
225
225
  goto unlock;
226
226
  }
227
227
 
228
228
  if (!git__is_sizet(st.st_size)) {
229
- git_error_set(GIT_ERROR_INVALID, "unable to load file larger than size_t");
229
+ giterr_set(GITERR_INVALID, "unable to load file larger than size_t");
230
230
  error = -1;
231
231
  (void)p_close(fd);
232
232
  goto unlock;
@@ -270,20 +270,24 @@ int git_sortedcache_clear(git_sortedcache *sc, bool wlock)
270
270
  /* find and/or insert item, returning pointer to item data */
271
271
  int git_sortedcache_upsert(void **out, git_sortedcache *sc, const char *key)
272
272
  {
273
- size_t keylen, itemlen;
274
273
  int error = 0;
275
- char *item_key;
274
+ khiter_t pos;
276
275
  void *item;
276
+ size_t keylen, itemlen;
277
+ char *item_key;
277
278
 
278
- if ((item = git_strmap_get(sc->map, key)) != NULL)
279
+ pos = git_strmap_lookup_index(sc->map, key);
280
+ if (git_strmap_valid_index(sc->map, pos)) {
281
+ item = git_strmap_value_at(sc->map, pos);
279
282
  goto done;
283
+ }
280
284
 
281
285
  keylen = strlen(key);
282
286
  itemlen = sc->item_path_offset + keylen + 1;
283
287
  itemlen = (itemlen + 7) & ~7;
284
288
 
285
- if ((item = git_pool_mallocz(&sc->pool, itemlen)) == NULL) {
286
- /* don't use GIT_ERROR_CHECK_ALLOC b/c of lock */
289
+ if ((item = git_pool_mallocz(&sc->pool, (uint32_t)itemlen)) == NULL) {
290
+ /* don't use GITERR_CHECK_ALLOC b/c of lock */
287
291
  error = -1;
288
292
  goto done;
289
293
  }
@@ -295,11 +299,17 @@ int git_sortedcache_upsert(void **out, git_sortedcache *sc, const char *key)
295
299
  item_key = ((char *)item) + sc->item_path_offset;
296
300
  memcpy(item_key, key, keylen);
297
301
 
298
- if ((error = git_strmap_set(sc->map, item_key, item)) < 0)
302
+ pos = git_strmap_put(sc->map, item_key, &error);
303
+ if (error < 0)
299
304
  goto done;
300
305
 
301
- if ((error = git_vector_insert(&sc->items, item)) < 0)
302
- git_strmap_delete(sc->map, item_key);
306
+ if (!error)
307
+ git_strmap_set_key_at(sc->map, pos, item_key);
308
+ git_strmap_set_value_at(sc->map, pos, item);
309
+
310
+ error = git_vector_insert(&sc->items, item);
311
+ if (error < 0)
312
+ git_strmap_delete_at(sc->map, pos);
303
313
 
304
314
  done:
305
315
  if (out)
@@ -310,7 +320,10 @@ done:
310
320
  /* lookup item by key */
311
321
  void *git_sortedcache_lookup(const git_sortedcache *sc, const char *key)
312
322
  {
313
- return git_strmap_get(sc->map, key);
323
+ khiter_t pos = git_strmap_lookup_index(sc->map, key);
324
+ if (git_strmap_valid_index(sc->map, pos))
325
+ return git_strmap_value_at(sc->map, pos);
326
+ return NULL;
314
327
  }
315
328
 
316
329
  /* find out how many items are in the cache */
@@ -358,20 +371,21 @@ int git_sortedcache_lookup_index(
358
371
  int git_sortedcache_remove(git_sortedcache *sc, size_t pos)
359
372
  {
360
373
  char *item;
374
+ khiter_t mappos;
361
375
 
362
- /*
363
- * Because of pool allocation, this can't actually remove the item,
376
+ /* because of pool allocation, this can't actually remove the item,
364
377
  * but we can remove it from the items vector and the hash table.
365
378
  */
366
379
 
367
380
  if ((item = git_vector_get(&sc->items, pos)) == NULL) {
368
- git_error_set(GIT_ERROR_INVALID, "removing item out of range");
381
+ giterr_set(GITERR_INVALID, "removing item out of range");
369
382
  return GIT_ENOTFOUND;
370
383
  }
371
384
 
372
385
  (void)git_vector_remove(&sc->items, pos);
373
386
 
374
- git_strmap_delete(sc->map, item + sc->item_path_offset);
387
+ mappos = git_strmap_lookup_index(sc->map, item + sc->item_path_offset);
388
+ git_strmap_delete_at(sc->map, mappos);
375
389
 
376
390
  if (sc->free_item)
377
391
  sc->free_item(sc->free_item_payload, item);
@@ -10,7 +10,7 @@
10
10
  #include "common.h"
11
11
 
12
12
  #include "util.h"
13
- #include "futils.h"
13
+ #include "fileops.h"
14
14
  #include "vector.h"
15
15
  #include "thread-utils.h"
16
16
  #include "pool.h"
@@ -12,7 +12,6 @@
12
12
  #include "message.h"
13
13
  #include "tree.h"
14
14
  #include "reflog.h"
15
- #include "blob.h"
16
15
  #include "git2/diff.h"
17
16
  #include "git2/stash.h"
18
17
  #include "git2/status.h"
@@ -29,7 +28,7 @@
29
28
 
30
29
  static int create_error(int error, const char *msg)
31
30
  {
32
- git_error_set(GIT_ERROR_STASH, "cannot stash changes - %s", msg);
31
+ giterr_set(GITERR_STASH, "cannot stash changes - %s", msg);
33
32
  return error;
34
33
  }
35
34
 
@@ -48,7 +47,7 @@ static int append_abbreviated_oid(git_buf *out, const git_oid *b_commit)
48
47
  char *formatted_oid;
49
48
 
50
49
  formatted_oid = git_oid_allocfmt(b_commit);
51
- GIT_ERROR_CHECK_ALLOC(formatted_oid);
50
+ GITERR_CHECK_ALLOC(formatted_oid);
52
51
 
53
52
  git_buf_put(out, formatted_oid, 7);
54
53
  git__free(formatted_oid);
@@ -59,7 +58,7 @@ static int append_abbreviated_oid(git_buf *out, const git_oid *b_commit)
59
58
  static int append_commit_description(git_buf *out, git_commit* commit)
60
59
  {
61
60
  const char *summary = git_commit_summary(commit);
62
- GIT_ERROR_CHECK_ALLOC(summary);
61
+ GITERR_CHECK_ALLOC(summary);
63
62
 
64
63
  if (append_abbreviated_oid(out, git_commit_id(commit)) < 0)
65
64
  return -1;
@@ -104,23 +103,19 @@ cleanup:
104
103
  return error;
105
104
  }
106
105
 
107
- static int build_tree_from_index(
108
- git_tree **out,
109
- git_repository *repo,
110
- git_index *index)
106
+ static int build_tree_from_index(git_tree **out, git_index *index)
111
107
  {
112
108
  int error;
113
109
  git_oid i_tree_oid;
114
110
 
115
- if ((error = git_index_write_tree_to(&i_tree_oid, index, repo)) < 0)
111
+ if ((error = git_index_write_tree(&i_tree_oid, index)) < 0)
116
112
  return error;
117
113
 
118
- return git_tree_lookup(out, repo, &i_tree_oid);
114
+ return git_tree_lookup(out, git_index_owner(index), &i_tree_oid);
119
115
  }
120
116
 
121
117
  static int commit_index(
122
118
  git_commit **i_commit,
123
- git_repository *repo,
124
119
  git_index *index,
125
120
  const git_signature *stasher,
126
121
  const char *message,
@@ -131,7 +126,7 @@ static int commit_index(
131
126
  git_buf msg = GIT_BUF_INIT;
132
127
  int error;
133
128
 
134
- if ((error = build_tree_from_index(&i_tree, repo, index)) < 0)
129
+ if ((error = build_tree_from_index(&i_tree, index)) < 0)
135
130
  goto cleanup;
136
131
 
137
132
  if ((error = git_buf_printf(&msg, "index on %s\n", message)) < 0)
@@ -154,7 +149,7 @@ static int commit_index(
154
149
 
155
150
  cleanup:
156
151
  git_tree_free(i_tree);
157
- git_buf_dispose(&msg);
152
+ git_buf_free(&msg);
158
153
  return error;
159
154
  }
160
155
 
@@ -164,38 +159,7 @@ struct stash_update_rules {
164
159
  bool include_ignored;
165
160
  };
166
161
 
167
- /*
168
- * Similar to git_index_add_bypath but able to operate on any
169
- * index without making assumptions about the repository's index
170
- */
171
- static int stash_to_index(
172
- git_repository *repo,
173
- git_index *index,
174
- const char *path)
175
- {
176
- git_index *repo_index;
177
- git_index_entry entry = {{0}};
178
- struct stat st;
179
- int error;
180
-
181
- if (!git_repository_is_bare(repo) &&
182
- (error = git_repository_index__weakptr(&repo_index, repo)) < 0)
183
- return error;
184
-
185
- if ((error = git_blob__create_from_paths(
186
- &entry.id, &st, repo, NULL, path, 0, true)) < 0)
187
- return error;
188
-
189
- git_index_entry__init_from_stat(&entry, &st,
190
- (repo_index != NULL || !repo_index->distrust_filemode));
191
-
192
- entry.path = path;
193
-
194
- return git_index_add(index, &entry);
195
- }
196
-
197
162
  static int stash_update_index_from_diff(
198
- git_repository *repo,
199
163
  git_index *index,
200
164
  const git_diff *diff,
201
165
  struct stash_update_rules *data)
@@ -233,15 +197,15 @@ static int stash_update_index_from_diff(
233
197
 
234
198
  default:
235
199
  /* Unimplemented */
236
- git_error_set(
237
- GIT_ERROR_INVALID,
200
+ giterr_set(
201
+ GITERR_INVALID,
238
202
  "cannot update index. Unimplemented status (%d)",
239
203
  delta->status);
240
204
  return -1;
241
205
  }
242
206
 
243
207
  if (add_path != NULL)
244
- error = stash_to_index(repo, index, add_path);
208
+ error = git_index_add_bypath(index, add_path);
245
209
  }
246
210
 
247
211
  return error;
@@ -249,19 +213,17 @@ static int stash_update_index_from_diff(
249
213
 
250
214
  static int build_untracked_tree(
251
215
  git_tree **tree_out,
252
- git_repository *repo,
216
+ git_index *index,
253
217
  git_commit *i_commit,
254
218
  uint32_t flags)
255
219
  {
256
- git_index *i_index = NULL;
257
220
  git_tree *i_tree = NULL;
258
221
  git_diff *diff = NULL;
259
222
  git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
260
223
  struct stash_update_rules data = {0};
261
224
  int error;
262
225
 
263
- if ((error = git_index_new(&i_index)) < 0)
264
- goto cleanup;
226
+ git_index_clear(index);
265
227
 
266
228
  if (flags & GIT_STASH_INCLUDE_UNTRACKED) {
267
229
  opts.flags |= GIT_DIFF_INCLUDE_UNTRACKED |
@@ -278,24 +240,24 @@ static int build_untracked_tree(
278
240
  if ((error = git_commit_tree(&i_tree, i_commit)) < 0)
279
241
  goto cleanup;
280
242
 
281
- if ((error = git_diff_tree_to_workdir(&diff, repo, i_tree, &opts)) < 0)
243
+ if ((error = git_diff_tree_to_workdir(
244
+ &diff, git_index_owner(index), i_tree, &opts)) < 0)
282
245
  goto cleanup;
283
246
 
284
- if ((error = stash_update_index_from_diff(repo, i_index, diff, &data)) < 0)
247
+ if ((error = stash_update_index_from_diff(index, diff, &data)) < 0)
285
248
  goto cleanup;
286
249
 
287
- error = build_tree_from_index(tree_out, repo, i_index);
250
+ error = build_tree_from_index(tree_out, index);
288
251
 
289
252
  cleanup:
290
253
  git_diff_free(diff);
291
254
  git_tree_free(i_tree);
292
- git_index_free(i_index);
293
255
  return error;
294
256
  }
295
257
 
296
258
  static int commit_untracked(
297
259
  git_commit **u_commit,
298
- git_repository *repo,
260
+ git_index *index,
299
261
  const git_signature *stasher,
300
262
  const char *message,
301
263
  git_commit *i_commit,
@@ -306,7 +268,7 @@ static int commit_untracked(
306
268
  git_buf msg = GIT_BUF_INIT;
307
269
  int error;
308
270
 
309
- if ((error = build_untracked_tree(&u_tree, repo, i_commit, flags)) < 0)
271
+ if ((error = build_untracked_tree(&u_tree, index, i_commit, flags)) < 0)
310
272
  goto cleanup;
311
273
 
312
274
  if ((error = git_buf_printf(&msg, "untracked files on %s\n", message)) < 0)
@@ -314,7 +276,7 @@ static int commit_untracked(
314
276
 
315
277
  if ((error = git_commit_create(
316
278
  &u_commit_oid,
317
- repo,
279
+ git_index_owner(index),
318
280
  NULL,
319
281
  stasher,
320
282
  stasher,
@@ -325,11 +287,11 @@ static int commit_untracked(
325
287
  NULL)) < 0)
326
288
  goto cleanup;
327
289
 
328
- error = git_commit_lookup(u_commit, repo, &u_commit_oid);
290
+ error = git_commit_lookup(u_commit, git_index_owner(index), &u_commit_oid);
329
291
 
330
292
  cleanup:
331
293
  git_tree_free(u_tree);
332
- git_buf_dispose(&msg);
294
+ git_buf_free(&msg);
333
295
  return error;
334
296
  }
335
297
 
@@ -354,10 +316,10 @@ static git_diff_delta *stash_delta_merge(
354
316
 
355
317
  static int build_workdir_tree(
356
318
  git_tree **tree_out,
357
- git_repository *repo,
358
- git_index *i_index,
319
+ git_index *index,
359
320
  git_commit *b_commit)
360
321
  {
322
+ git_repository *repo = git_index_owner(index);
361
323
  git_tree *b_tree = NULL;
362
324
  git_diff *diff = NULL, *idx_to_wd = NULL;
363
325
  git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
@@ -369,17 +331,17 @@ static int build_workdir_tree(
369
331
  if ((error = git_commit_tree(&b_tree, b_commit)) < 0)
370
332
  goto cleanup;
371
333
 
372
- if ((error = git_diff_tree_to_index(&diff, repo, b_tree, i_index, &opts)) < 0 ||
373
- (error = git_diff_index_to_workdir(&idx_to_wd, repo, i_index, &opts)) < 0 ||
334
+ if ((error = git_diff_tree_to_index(&diff, repo, b_tree, index, &opts)) < 0 ||
335
+ (error = git_diff_index_to_workdir(&idx_to_wd, repo, index, &opts)) < 0 ||
374
336
  (error = git_diff__merge(diff, idx_to_wd, stash_delta_merge)) < 0)
375
337
  goto cleanup;
376
338
 
377
339
  data.include_changed = true;
378
340
 
379
- if ((error = stash_update_index_from_diff(repo, i_index, diff, &data)) < 0)
341
+ if ((error = stash_update_index_from_diff(index, diff, &data)) < 0)
380
342
  goto cleanup;
381
343
 
382
- error = build_tree_from_index(tree_out, repo, i_index);
344
+ error = build_tree_from_index(tree_out, index);
383
345
 
384
346
  cleanup:
385
347
  git_diff_free(idx_to_wd);
@@ -391,36 +353,33 @@ cleanup:
391
353
 
392
354
  static int commit_worktree(
393
355
  git_oid *w_commit_oid,
394
- git_repository *repo,
356
+ git_index *index,
395
357
  const git_signature *stasher,
396
358
  const char *message,
397
359
  git_commit *i_commit,
398
360
  git_commit *b_commit,
399
361
  git_commit *u_commit)
400
362
  {
401
- const git_commit *parents[] = { NULL, NULL, NULL };
402
- git_index *i_index = NULL, *r_index = NULL;
403
- git_tree *w_tree = NULL;
404
- int error = 0, ignorecase;
363
+ int error = 0;
364
+ git_tree *w_tree = NULL, *i_tree = NULL;
365
+ const git_commit *parents[] = { NULL, NULL, NULL };
405
366
 
406
367
  parents[0] = b_commit;
407
368
  parents[1] = i_commit;
408
369
  parents[2] = u_commit;
409
370
 
410
- if ((error = git_repository_index(&r_index, repo) < 0) ||
411
- (error = git_index_new(&i_index)) < 0 ||
412
- (error = git_index__fill(i_index, &r_index->entries) < 0) ||
413
- (error = git_repository__configmap_lookup(&ignorecase, repo, GIT_CONFIGMAP_IGNORECASE)) < 0)
371
+ if ((error = git_commit_tree(&i_tree, i_commit)) < 0)
414
372
  goto cleanup;
415
373
 
416
- git_index__set_ignore_case(i_index, ignorecase);
374
+ if ((error = git_index_read_tree(index, i_tree)) < 0)
375
+ goto cleanup;
417
376
 
418
- if ((error = build_workdir_tree(&w_tree, repo, i_index, b_commit)) < 0)
377
+ if ((error = build_workdir_tree(&w_tree, index, b_commit)) < 0)
419
378
  goto cleanup;
420
379
 
421
380
  error = git_commit_create(
422
381
  w_commit_oid,
423
- repo,
382
+ git_index_owner(index),
424
383
  NULL,
425
384
  stasher,
426
385
  stasher,
@@ -431,39 +390,41 @@ static int commit_worktree(
431
390
  parents);
432
391
 
433
392
  cleanup:
393
+ git_tree_free(i_tree);
434
394
  git_tree_free(w_tree);
435
- git_index_free(i_index);
436
- git_index_free(r_index);
437
395
  return error;
438
396
  }
439
397
 
440
- static int prepare_worktree_commit_message(git_buf *out, const char *user_message)
398
+ static int prepare_worktree_commit_message(
399
+ git_buf* msg,
400
+ const char *user_message)
441
401
  {
442
402
  git_buf buf = GIT_BUF_INIT;
443
- int error = 0;
403
+ int error;
444
404
 
445
- if (!user_message) {
446
- git_buf_printf(&buf, "WIP on %s", git_buf_cstr(out));
447
- } else {
405
+ if ((error = git_buf_set(&buf, git_buf_cstr(msg), git_buf_len(msg))) < 0)
406
+ return error;
407
+
408
+ git_buf_clear(msg);
409
+
410
+ if (!user_message)
411
+ git_buf_printf(msg, "WIP on %s", git_buf_cstr(&buf));
412
+ else {
448
413
  const char *colon;
449
414
 
450
- if ((colon = strchr(git_buf_cstr(out), ':')) == NULL)
415
+ if ((colon = strchr(git_buf_cstr(&buf), ':')) == NULL)
451
416
  goto cleanup;
452
417
 
453
- git_buf_puts(&buf, "On ");
454
- git_buf_put(&buf, git_buf_cstr(out), colon - out->ptr);
455
- git_buf_printf(&buf, ": %s\n", user_message);
456
- }
457
-
458
- if (git_buf_oom(&buf)) {
459
- error = -1;
460
- goto cleanup;
418
+ git_buf_puts(msg, "On ");
419
+ git_buf_put(msg, git_buf_cstr(&buf), colon - buf.ptr);
420
+ git_buf_printf(msg, ": %s\n", user_message);
461
421
  }
462
422
 
463
- git_buf_swap(out, &buf);
423
+ error = (git_buf_oom(msg) || git_buf_oom(&buf)) ? -1 : 0;
464
424
 
465
425
  cleanup:
466
- git_buf_dispose(&buf);
426
+ git_buf_free(&buf);
427
+
467
428
  return error;
468
429
  }
469
430
 
@@ -494,7 +455,10 @@ static int is_dirty_cb(const char *path, unsigned int status, void *payload)
494
455
  return GIT_PASSTHROUGH;
495
456
  }
496
457
 
497
- static int ensure_there_are_changes_to_stash(git_repository *repo, uint32_t flags)
458
+ static int ensure_there_are_changes_to_stash(
459
+ git_repository *repo,
460
+ bool include_untracked_files,
461
+ bool include_ignored_files)
498
462
  {
499
463
  int error;
500
464
  git_status_options opts = GIT_STATUS_OPTIONS_INIT;
@@ -502,11 +466,11 @@ static int ensure_there_are_changes_to_stash(git_repository *repo, uint32_t flag
502
466
  opts.show = GIT_STATUS_SHOW_INDEX_AND_WORKDIR;
503
467
  opts.flags = GIT_STATUS_OPT_EXCLUDE_SUBMODULES;
504
468
 
505
- if (flags & GIT_STASH_INCLUDE_UNTRACKED)
469
+ if (include_untracked_files)
506
470
  opts.flags |= GIT_STATUS_OPT_INCLUDE_UNTRACKED |
507
471
  GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS;
508
472
 
509
- if (flags & GIT_STASH_INCLUDE_IGNORED)
473
+ if (include_ignored_files)
510
474
  opts.flags |= GIT_STATUS_OPT_INCLUDE_IGNORED |
511
475
  GIT_STATUS_OPT_RECURSE_IGNORED_DIRS;
512
476
 
@@ -521,14 +485,20 @@ static int ensure_there_are_changes_to_stash(git_repository *repo, uint32_t flag
521
485
  return error;
522
486
  }
523
487
 
524
- static int reset_index_and_workdir(git_repository *repo, git_commit *commit, uint32_t flags)
488
+ static int reset_index_and_workdir(
489
+ git_repository *repo,
490
+ git_commit *commit,
491
+ bool remove_untracked,
492
+ bool remove_ignored)
525
493
  {
526
494
  git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
527
495
 
528
496
  opts.checkout_strategy = GIT_CHECKOUT_FORCE;
529
- if (flags & GIT_STASH_INCLUDE_UNTRACKED)
497
+
498
+ if (remove_untracked)
530
499
  opts.checkout_strategy |= GIT_CHECKOUT_REMOVE_UNTRACKED;
531
- if (flags & GIT_STASH_INCLUDE_IGNORED)
500
+
501
+ if (remove_ignored)
532
502
  opts.checkout_strategy |= GIT_CHECKOUT_REMOVE_IGNORED;
533
503
 
534
504
  return git_checkout_tree(repo, (git_object *)commit, &opts);
@@ -554,26 +524,31 @@ int git_stash_save(
554
524
  if ((error = retrieve_base_commit_and_message(&b_commit, &msg, repo)) < 0)
555
525
  goto cleanup;
556
526
 
557
- if ((error = ensure_there_are_changes_to_stash(repo, flags)) < 0)
527
+ if ((error = ensure_there_are_changes_to_stash(
528
+ repo,
529
+ (flags & GIT_STASH_INCLUDE_UNTRACKED) != 0,
530
+ (flags & GIT_STASH_INCLUDE_IGNORED) != 0)) < 0)
558
531
  goto cleanup;
559
532
 
560
533
  if ((error = git_repository_index(&index, repo)) < 0)
561
534
  goto cleanup;
562
535
 
563
- if ((error = commit_index(&i_commit, repo, index, stasher,
564
- git_buf_cstr(&msg), b_commit)) < 0)
536
+ if ((error = commit_index(
537
+ &i_commit, index, stasher, git_buf_cstr(&msg), b_commit)) < 0)
565
538
  goto cleanup;
566
539
 
567
540
  if ((flags & (GIT_STASH_INCLUDE_UNTRACKED | GIT_STASH_INCLUDE_IGNORED)) &&
568
- (error = commit_untracked(&u_commit, repo, stasher,
569
- git_buf_cstr(&msg), i_commit, flags)) < 0)
541
+ (error = commit_untracked(
542
+ &u_commit, index, stasher, git_buf_cstr(&msg),
543
+ i_commit, flags)) < 0)
570
544
  goto cleanup;
571
545
 
572
546
  if ((error = prepare_worktree_commit_message(&msg, message)) < 0)
573
547
  goto cleanup;
574
548
 
575
- if ((error = commit_worktree(out, repo, stasher, git_buf_cstr(&msg),
576
- i_commit, b_commit, u_commit)) < 0)
549
+ if ((error = commit_worktree(
550
+ out, index, stasher, git_buf_cstr(&msg),
551
+ i_commit, b_commit, u_commit)) < 0)
577
552
  goto cleanup;
578
553
 
579
554
  git_buf_rtrim(&msg);
@@ -581,13 +556,16 @@ int git_stash_save(
581
556
  if ((error = update_reflog(out, repo, git_buf_cstr(&msg))) < 0)
582
557
  goto cleanup;
583
558
 
584
- if ((error = reset_index_and_workdir(repo, (flags & GIT_STASH_KEEP_INDEX) ? i_commit : b_commit,
585
- flags)) < 0)
559
+ if ((error = reset_index_and_workdir(
560
+ repo,
561
+ ((flags & GIT_STASH_KEEP_INDEX) != 0) ? i_commit : b_commit,
562
+ (flags & GIT_STASH_INCLUDE_UNTRACKED) != 0,
563
+ (flags & GIT_STASH_INCLUDE_IGNORED) != 0)) < 0)
586
564
  goto cleanup;
587
565
 
588
566
  cleanup:
589
567
 
590
- git_buf_dispose(&msg);
568
+ git_buf_free(&msg);
591
569
  git_commit_free(i_commit);
592
570
  git_commit_free(b_commit);
593
571
  git_commit_free(u_commit);
@@ -616,7 +594,7 @@ static int retrieve_stash_commit(
616
594
  max = git_reflog_entrycount(reflog);
617
595
  if (!max || index > max - 1) {
618
596
  error = GIT_ENOTFOUND;
619
- git_error_set(GIT_ERROR_STASH, "no stashed state at position %" PRIuZ, index);
597
+ giterr_set(GITERR_STASH, "no stashed state at position %" PRIuZ, index);
620
598
  goto cleanup;
621
599
  }
622
600
 
@@ -760,7 +738,8 @@ static void normalize_apply_options(
760
738
  memcpy(opts, &default_apply_opts, sizeof(git_stash_apply_options));
761
739
  }
762
740
 
763
- opts->checkout_options.checkout_strategy |= GIT_CHECKOUT_NO_REFRESH;
741
+ if ((opts->checkout_options.checkout_strategy & (GIT_CHECKOUT_SAFE | GIT_CHECKOUT_FORCE)) == 0)
742
+ opts->checkout_options.checkout_strategy = GIT_CHECKOUT_SAFE;
764
743
 
765
744
  if (!opts->checkout_options.our_label)
766
745
  opts->checkout_options.our_label = "Updated upstream";
@@ -769,18 +748,13 @@ static void normalize_apply_options(
769
748
  opts->checkout_options.their_label = "Stashed changes";
770
749
  }
771
750
 
772
- int git_stash_apply_options_init(git_stash_apply_options *opts, unsigned int version)
751
+ int git_stash_apply_init_options(git_stash_apply_options *opts, unsigned int version)
773
752
  {
774
753
  GIT_INIT_STRUCTURE_FROM_TEMPLATE(
775
754
  opts, version, git_stash_apply_options, GIT_STASH_APPLY_OPTIONS_INIT);
776
755
  return 0;
777
756
  }
778
757
 
779
- int git_stash_apply_init_options(git_stash_apply_options *opts, unsigned int version)
780
- {
781
- return git_stash_apply_options_init(opts, version);
782
- }
783
-
784
758
  #define NOTIFY_PROGRESS(opts, progress_type) \
785
759
  do { \
786
760
  if ((opts).progress_cb && \
@@ -802,7 +776,7 @@ static int ensure_clean_index(git_repository *repo, git_index *index)
802
776
  goto done;
803
777
 
804
778
  if (git_diff_num_deltas(index_diff) > 0) {
805
- git_error_set(GIT_ERROR_STASH, "%" PRIuZ " uncommitted changes exist in the index",
779
+ giterr_set(GITERR_STASH, "%" PRIuZ " uncommitted changes exist in the index",
806
780
  git_diff_num_deltas(index_diff));
807
781
  error = GIT_EUNCOMMITTED;
808
782
  }
@@ -874,7 +848,7 @@ int git_stash_apply(
874
848
  git_index *untracked_index = NULL;
875
849
  int error;
876
850
 
877
- GIT_ERROR_CHECK_VERSION(given_opts, GIT_STASH_APPLY_OPTIONS_VERSION, "git_stash_apply_options");
851
+ GITERR_CHECK_VERSION(given_opts, GIT_STASH_APPLY_OPTIONS_VERSION, "git_stash_apply_options");
878
852
 
879
853
  normalize_apply_options(&opts, given_opts);
880
854
  checkout_strategy = opts.checkout_options.checkout_strategy;
@@ -1007,7 +981,7 @@ int git_stash_foreach(
1007
981
 
1008
982
  error = git_reference_lookup(&stash, repo, GIT_REFS_STASH_FILE);
1009
983
  if (error == GIT_ENOTFOUND) {
1010
- git_error_clear();
984
+ giterr_clear();
1011
985
  return 0;
1012
986
  }
1013
987
  if (error < 0)
@@ -1026,7 +1000,7 @@ int git_stash_foreach(
1026
1000
  payload);
1027
1001
 
1028
1002
  if (error) {
1029
- git_error_set_after_callback(error);
1003
+ giterr_set_after_callback(error);
1030
1004
  break;
1031
1005
  }
1032
1006
  }
@@ -1063,7 +1037,7 @@ int git_stash_drop(
1063
1037
 
1064
1038
  if (!max || index > max - 1) {
1065
1039
  error = GIT_ENOTFOUND;
1066
- git_error_set(GIT_ERROR_STASH, "no stashed state at position %" PRIuZ, index);
1040
+ giterr_set(GITERR_STASH, "no stashed state at position %" PRIuZ, index);
1067
1041
  goto cleanup;
1068
1042
  }
1069
1043