rugged 0.28.4 → 0.28.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (350) 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 +16 -36
  5. data/vendor/libgit2/COPYING +0 -28
  6. data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +1 -5
  7. data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +2 -2
  8. data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +1 -1
  9. data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
  10. data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +0 -6
  11. data/vendor/libgit2/deps/http-parser/http_parser.c +6 -11
  12. data/vendor/libgit2/deps/regex/CMakeLists.txt +2 -0
  13. data/vendor/libgit2/deps/regex/COPYING +502 -0
  14. data/vendor/libgit2/deps/regex/config.h +7 -0
  15. data/vendor/libgit2/deps/regex/regcomp.c +3857 -0
  16. data/vendor/libgit2/deps/regex/regex.c +92 -0
  17. data/vendor/libgit2/deps/regex/regex.h +582 -0
  18. data/vendor/libgit2/deps/regex/regex_internal.c +1744 -0
  19. data/vendor/libgit2/deps/regex/regex_internal.h +819 -0
  20. data/vendor/libgit2/deps/regex/regexec.c +4369 -0
  21. data/vendor/libgit2/deps/zlib/adler32.c +7 -0
  22. data/vendor/libgit2/deps/zlib/crc32.c +7 -0
  23. data/vendor/libgit2/include/git2.h +0 -2
  24. data/vendor/libgit2/include/git2/apply.h +2 -22
  25. data/vendor/libgit2/include/git2/attr.h +12 -19
  26. data/vendor/libgit2/include/git2/blame.h +2 -2
  27. data/vendor/libgit2/include/git2/blob.h +12 -44
  28. data/vendor/libgit2/include/git2/buffer.h +14 -20
  29. data/vendor/libgit2/include/git2/checkout.h +14 -46
  30. data/vendor/libgit2/include/git2/cherrypick.h +3 -3
  31. data/vendor/libgit2/include/git2/clone.h +2 -2
  32. data/vendor/libgit2/include/git2/commit.h +1 -23
  33. data/vendor/libgit2/include/git2/common.h +5 -7
  34. data/vendor/libgit2/include/git2/config.h +12 -12
  35. data/vendor/libgit2/include/git2/deprecated.h +3 -243
  36. data/vendor/libgit2/include/git2/describe.h +4 -4
  37. data/vendor/libgit2/include/git2/diff.h +14 -16
  38. data/vendor/libgit2/include/git2/filter.h +0 -8
  39. data/vendor/libgit2/include/git2/index.h +1 -2
  40. data/vendor/libgit2/include/git2/indexer.h +4 -48
  41. data/vendor/libgit2/include/git2/inttypes.h +309 -0
  42. data/vendor/libgit2/include/git2/merge.h +10 -6
  43. data/vendor/libgit2/include/git2/net.h +5 -0
  44. data/vendor/libgit2/include/git2/object.h +14 -2
  45. data/vendor/libgit2/include/git2/odb.h +2 -3
  46. data/vendor/libgit2/include/git2/odb_backend.h +4 -5
  47. data/vendor/libgit2/include/git2/oid.h +1 -1
  48. data/vendor/libgit2/include/git2/pack.h +1 -12
  49. data/vendor/libgit2/include/git2/proxy.h +3 -5
  50. data/vendor/libgit2/include/git2/rebase.h +2 -46
  51. data/vendor/libgit2/include/git2/refs.h +0 -19
  52. data/vendor/libgit2/include/git2/remote.h +12 -35
  53. data/vendor/libgit2/include/git2/repository.h +2 -24
  54. data/vendor/libgit2/include/git2/revert.h +1 -1
  55. data/vendor/libgit2/include/git2/stash.h +3 -3
  56. data/vendor/libgit2/include/git2/status.h +16 -25
  57. data/vendor/libgit2/include/git2/submodule.h +3 -20
  58. data/vendor/libgit2/include/git2/sys/alloc.h +9 -9
  59. data/vendor/libgit2/include/git2/sys/odb_backend.h +4 -48
  60. data/vendor/libgit2/include/git2/sys/refdb_backend.h +21 -57
  61. data/vendor/libgit2/include/git2/sys/repository.h +1 -5
  62. data/vendor/libgit2/include/git2/sys/time.h +31 -0
  63. data/vendor/libgit2/include/git2/sys/transport.h +2 -2
  64. data/vendor/libgit2/include/git2/tag.h +2 -11
  65. data/vendor/libgit2/include/git2/trace.h +2 -2
  66. data/vendor/libgit2/include/git2/transport.h +340 -11
  67. data/vendor/libgit2/include/git2/tree.h +1 -1
  68. data/vendor/libgit2/include/git2/types.h +89 -4
  69. data/vendor/libgit2/include/git2/version.h +2 -2
  70. data/vendor/libgit2/include/git2/worktree.h +5 -5
  71. data/vendor/libgit2/libgit2.pc.in +13 -0
  72. data/vendor/libgit2/src/CMakeLists.txt +222 -88
  73. data/vendor/libgit2/src/alloc.c +14 -2
  74. data/vendor/libgit2/src/apply.c +30 -60
  75. data/vendor/libgit2/src/attr.c +64 -70
  76. data/vendor/libgit2/src/attr_file.c +96 -189
  77. data/vendor/libgit2/src/attr_file.h +9 -9
  78. data/vendor/libgit2/src/attrcache.c +46 -44
  79. data/vendor/libgit2/src/attrcache.h +1 -2
  80. data/vendor/libgit2/src/blame.c +5 -17
  81. data/vendor/libgit2/src/blame.h +1 -1
  82. data/vendor/libgit2/src/blame_git.c +7 -21
  83. data/vendor/libgit2/src/blob.c +17 -81
  84. data/vendor/libgit2/src/blob.h +2 -2
  85. data/vendor/libgit2/src/branch.c +5 -29
  86. data/vendor/libgit2/src/buffer.c +7 -14
  87. data/vendor/libgit2/src/cache.c +33 -26
  88. data/vendor/libgit2/src/cache.h +1 -1
  89. data/vendor/libgit2/src/cc-compat.h +0 -5
  90. data/vendor/libgit2/src/checkout.c +16 -26
  91. data/vendor/libgit2/src/cherrypick.c +3 -9
  92. data/vendor/libgit2/src/clone.c +7 -29
  93. data/vendor/libgit2/src/clone.h +0 -4
  94. data/vendor/libgit2/src/commit.c +21 -69
  95. data/vendor/libgit2/src/commit.h +0 -6
  96. data/vendor/libgit2/src/commit_list.c +76 -28
  97. data/vendor/libgit2/src/commit_list.h +2 -2
  98. data/vendor/libgit2/src/common.h +75 -3
  99. data/vendor/libgit2/src/config.c +40 -31
  100. data/vendor/libgit2/src/config.h +6 -7
  101. data/vendor/libgit2/src/config_backend.h +0 -12
  102. data/vendor/libgit2/src/config_cache.c +39 -39
  103. data/vendor/libgit2/src/config_entries.c +99 -69
  104. data/vendor/libgit2/src/config_entries.h +0 -1
  105. data/vendor/libgit2/src/config_file.c +380 -337
  106. data/vendor/libgit2/src/config_mem.c +16 -12
  107. data/vendor/libgit2/src/config_parse.c +29 -49
  108. data/vendor/libgit2/src/config_parse.h +12 -13
  109. data/vendor/libgit2/src/crlf.c +14 -14
  110. data/vendor/libgit2/src/describe.c +20 -21
  111. data/vendor/libgit2/src/diff.c +58 -43
  112. data/vendor/libgit2/src/diff.h +1 -2
  113. data/vendor/libgit2/src/diff_driver.c +38 -37
  114. data/vendor/libgit2/src/diff_file.c +7 -9
  115. data/vendor/libgit2/src/diff_file.h +1 -1
  116. data/vendor/libgit2/src/diff_generate.c +85 -135
  117. data/vendor/libgit2/src/diff_generate.h +2 -2
  118. data/vendor/libgit2/src/diff_parse.c +1 -1
  119. data/vendor/libgit2/src/diff_print.c +13 -25
  120. data/vendor/libgit2/src/diff_stats.c +1 -1
  121. data/vendor/libgit2/src/diff_tform.c +4 -4
  122. data/vendor/libgit2/src/errors.c +22 -12
  123. data/vendor/libgit2/src/features.h.in +2 -9
  124. data/vendor/libgit2/src/fetch.c +2 -7
  125. data/vendor/libgit2/src/fetchhead.c +1 -1
  126. data/vendor/libgit2/src/filebuf.c +10 -6
  127. data/vendor/libgit2/src/filebuf.h +2 -2
  128. data/vendor/libgit2/src/{futils.c → fileops.c} +17 -21
  129. data/vendor/libgit2/src/{futils.h → fileops.h} +5 -5
  130. data/vendor/libgit2/src/filter.c +8 -16
  131. data/vendor/libgit2/src/fnmatch.c +248 -0
  132. data/vendor/libgit2/src/fnmatch.h +48 -0
  133. data/vendor/libgit2/src/global.c +40 -12
  134. data/vendor/libgit2/src/global.h +2 -0
  135. data/vendor/libgit2/src/hash.c +0 -61
  136. data/vendor/libgit2/src/hash.h +21 -19
  137. data/vendor/libgit2/src/hash/{sha1/collisiondetect.c → hash_collisiondetect.h} +17 -14
  138. data/vendor/libgit2/src/hash/{sha1/common_crypto.c → hash_common_crypto.h} +19 -15
  139. data/vendor/libgit2/src/hash/{sha1/generic.c → hash_generic.c} +10 -22
  140. data/vendor/libgit2/src/hash/{sha1/generic.h → hash_generic.h} +14 -4
  141. data/vendor/libgit2/src/hash/{sha1/mbedtls.c → hash_mbedtls.c} +7 -15
  142. data/vendor/libgit2/src/hash/{sha1/mbedtls.h → hash_mbedtls.h} +11 -6
  143. data/vendor/libgit2/src/hash/{sha1/openssl.c → hash_openssl.h} +18 -14
  144. data/vendor/libgit2/src/hash/{sha1/win32.c → hash_win32.c} +24 -34
  145. data/vendor/libgit2/src/hash/{sha1/win32.h → hash_win32.h} +19 -6
  146. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.c +3 -14
  147. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.h +0 -0
  148. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.c +0 -0
  149. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.h +0 -0
  150. data/vendor/libgit2/src/hashsig.c +1 -1
  151. data/vendor/libgit2/src/idxmap.c +65 -91
  152. data/vendor/libgit2/src/idxmap.h +15 -151
  153. data/vendor/libgit2/src/ignore.c +38 -32
  154. data/vendor/libgit2/src/index.c +43 -66
  155. data/vendor/libgit2/src/index.h +1 -1
  156. data/vendor/libgit2/src/indexer.c +70 -69
  157. data/vendor/libgit2/src/integer.h +4 -39
  158. data/vendor/libgit2/src/iterator.c +22 -27
  159. data/vendor/libgit2/src/map.h +1 -1
  160. data/vendor/libgit2/src/merge.c +44 -58
  161. data/vendor/libgit2/src/merge_driver.c +4 -4
  162. data/vendor/libgit2/src/merge_file.c +1 -1
  163. data/vendor/libgit2/src/mwindow.c +23 -18
  164. data/vendor/libgit2/src/mwindow.h +4 -4
  165. data/vendor/libgit2/src/netops.c +165 -55
  166. data/vendor/libgit2/src/netops.h +25 -3
  167. data/vendor/libgit2/src/notes.c +2 -2
  168. data/vendor/libgit2/src/object.c +2 -2
  169. data/vendor/libgit2/src/object.h +0 -2
  170. data/vendor/libgit2/src/odb.c +23 -41
  171. data/vendor/libgit2/src/odb.h +2 -3
  172. data/vendor/libgit2/src/odb_loose.c +10 -17
  173. data/vendor/libgit2/src/odb_mempack.c +23 -10
  174. data/vendor/libgit2/src/odb_pack.c +4 -4
  175. data/vendor/libgit2/src/offmap.c +55 -43
  176. data/vendor/libgit2/src/offmap.h +24 -102
  177. data/vendor/libgit2/src/oid.c +1 -6
  178. data/vendor/libgit2/src/oidmap.c +57 -39
  179. data/vendor/libgit2/src/oidmap.h +19 -99
  180. data/vendor/libgit2/src/pack-objects.c +32 -25
  181. data/vendor/libgit2/src/pack-objects.h +1 -1
  182. data/vendor/libgit2/src/pack.c +47 -45
  183. data/vendor/libgit2/src/pack.h +14 -12
  184. data/vendor/libgit2/src/parse.c +0 -10
  185. data/vendor/libgit2/src/parse.h +3 -3
  186. data/vendor/libgit2/src/patch.c +1 -1
  187. data/vendor/libgit2/src/patch_generate.c +2 -2
  188. data/vendor/libgit2/src/patch_parse.c +31 -124
  189. data/vendor/libgit2/src/path.c +6 -43
  190. data/vendor/libgit2/src/path.h +0 -2
  191. data/vendor/libgit2/src/pathspec.c +13 -13
  192. data/vendor/libgit2/src/pool.c +22 -26
  193. data/vendor/libgit2/src/pool.h +7 -7
  194. data/vendor/libgit2/src/posix.c +7 -7
  195. data/vendor/libgit2/src/posix.h +1 -12
  196. data/vendor/libgit2/src/proxy.c +2 -7
  197. data/vendor/libgit2/src/push.c +5 -10
  198. data/vendor/libgit2/src/reader.c +2 -2
  199. data/vendor/libgit2/src/rebase.c +7 -66
  200. data/vendor/libgit2/src/refdb.c +0 -12
  201. data/vendor/libgit2/src/refdb_fs.c +165 -214
  202. data/vendor/libgit2/src/reflog.c +13 -11
  203. data/vendor/libgit2/src/refs.c +18 -24
  204. data/vendor/libgit2/src/refspec.c +16 -9
  205. data/vendor/libgit2/src/remote.c +52 -50
  206. data/vendor/libgit2/src/remote.h +2 -2
  207. data/vendor/libgit2/src/repository.c +100 -115
  208. data/vendor/libgit2/src/repository.h +40 -49
  209. data/vendor/libgit2/src/revert.c +3 -8
  210. data/vendor/libgit2/src/revparse.c +19 -18
  211. data/vendor/libgit2/src/revwalk.c +30 -63
  212. data/vendor/libgit2/src/revwalk.h +0 -20
  213. data/vendor/libgit2/src/settings.c +0 -5
  214. data/vendor/libgit2/src/sortedcache.c +26 -12
  215. data/vendor/libgit2/src/sortedcache.h +1 -1
  216. data/vendor/libgit2/src/stash.c +65 -45
  217. data/vendor/libgit2/src/status.c +9 -15
  218. data/vendor/libgit2/src/{allocators/stdalloc.c → stdalloc.c} +4 -3
  219. data/vendor/libgit2/src/{allocators/stdalloc.h → stdalloc.h} +4 -4
  220. data/vendor/libgit2/src/streams/openssl.c +0 -20
  221. data/vendor/libgit2/src/streams/socket.c +2 -2
  222. data/vendor/libgit2/src/strmap.c +84 -37
  223. data/vendor/libgit2/src/strmap.h +33 -105
  224. data/vendor/libgit2/src/submodule.c +70 -102
  225. data/vendor/libgit2/src/submodule.h +1 -1
  226. data/vendor/libgit2/src/sysdir.c +1 -11
  227. data/vendor/libgit2/src/tag.c +2 -10
  228. data/vendor/libgit2/src/trace.c +1 -1
  229. data/vendor/libgit2/src/trace.h +2 -2
  230. data/vendor/libgit2/src/trailer.c +32 -46
  231. data/vendor/libgit2/src/transaction.c +9 -10
  232. data/vendor/libgit2/src/transports/auth.c +9 -10
  233. data/vendor/libgit2/src/transports/auth.h +4 -11
  234. data/vendor/libgit2/src/transports/auth_negotiate.c +9 -23
  235. data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
  236. data/vendor/libgit2/src/transports/cred.c +6 -6
  237. data/vendor/libgit2/src/{allocators/win32_crtdbg.h → transports/cred.h} +4 -5
  238. data/vendor/libgit2/src/transports/git.c +16 -11
  239. data/vendor/libgit2/src/transports/http.c +276 -419
  240. data/vendor/libgit2/src/transports/http.h +1 -1
  241. data/vendor/libgit2/src/transports/local.c +9 -9
  242. data/vendor/libgit2/src/transports/smart.c +17 -17
  243. data/vendor/libgit2/src/transports/smart.h +2 -2
  244. data/vendor/libgit2/src/transports/smart_protocol.c +60 -36
  245. data/vendor/libgit2/src/transports/ssh.c +36 -46
  246. data/vendor/libgit2/src/transports/winhttp.c +207 -231
  247. data/vendor/libgit2/src/tree-cache.c +7 -14
  248. data/vendor/libgit2/src/tree.c +24 -10
  249. data/vendor/libgit2/src/unix/map.c +1 -1
  250. data/vendor/libgit2/src/unix/posix.h +11 -1
  251. data/vendor/libgit2/src/userdiff.h +1 -3
  252. data/vendor/libgit2/src/util.c +53 -51
  253. data/vendor/libgit2/src/util.h +21 -16
  254. data/vendor/libgit2/src/win32/map.c +5 -3
  255. data/vendor/libgit2/src/win32/path_w32.c +2 -12
  256. data/vendor/libgit2/src/win32/path_w32.h +29 -0
  257. data/vendor/libgit2/src/win32/posix.h +4 -1
  258. data/vendor/libgit2/src/win32/posix_w32.c +5 -40
  259. data/vendor/libgit2/src/win32/precompiled.h +2 -0
  260. data/vendor/libgit2/src/win32/thread.c +10 -5
  261. data/vendor/libgit2/src/win32/w32_buffer.c +3 -7
  262. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +93 -0
  263. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +2 -0
  264. data/vendor/libgit2/src/win32/w32_stack.c +9 -4
  265. data/vendor/libgit2/src/win32/w32_stack.h +3 -3
  266. data/vendor/libgit2/src/win32/w32_util.c +0 -31
  267. data/vendor/libgit2/src/win32/w32_util.h +32 -6
  268. data/vendor/libgit2/src/worktree.c +22 -36
  269. data/vendor/libgit2/src/xdiff/xdiffi.c +1 -1
  270. data/vendor/libgit2/src/xdiff/xmerge.c +0 -12
  271. data/vendor/libgit2/src/xdiff/xpatience.c +0 -3
  272. metadata +34 -98
  273. data/vendor/libgit2/cmake/Modules/FindGSSFramework.cmake +0 -28
  274. data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +0 -38
  275. data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +0 -37
  276. data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +0 -110
  277. data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +0 -53
  278. data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +0 -124
  279. data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +0 -66
  280. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +0 -21
  281. data/vendor/libgit2/deps/ntlmclient/compat.h +0 -33
  282. data/vendor/libgit2/deps/ntlmclient/crypt.h +0 -64
  283. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +0 -120
  284. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +0 -18
  285. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +0 -145
  286. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +0 -18
  287. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +0 -130
  288. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +0 -21
  289. data/vendor/libgit2/deps/ntlmclient/ntlm.c +0 -1420
  290. data/vendor/libgit2/deps/ntlmclient/ntlm.h +0 -174
  291. data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +0 -320
  292. data/vendor/libgit2/deps/ntlmclient/unicode.h +0 -36
  293. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +0 -445
  294. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +0 -201
  295. data/vendor/libgit2/deps/ntlmclient/utf8.h +0 -1257
  296. data/vendor/libgit2/deps/ntlmclient/util.c +0 -21
  297. data/vendor/libgit2/deps/ntlmclient/util.h +0 -14
  298. data/vendor/libgit2/deps/pcre/CMakeLists.txt +0 -140
  299. data/vendor/libgit2/deps/pcre/COPYING +0 -5
  300. data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +0 -22
  301. data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +0 -17
  302. data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +0 -58
  303. data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +0 -29
  304. data/vendor/libgit2/deps/pcre/config.h.in +0 -57
  305. data/vendor/libgit2/deps/pcre/pcre.h +0 -641
  306. data/vendor/libgit2/deps/pcre/pcre_byte_order.c +0 -319
  307. data/vendor/libgit2/deps/pcre/pcre_chartables.c +0 -198
  308. data/vendor/libgit2/deps/pcre/pcre_compile.c +0 -9800
  309. data/vendor/libgit2/deps/pcre/pcre_config.c +0 -190
  310. data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +0 -3676
  311. data/vendor/libgit2/deps/pcre/pcre_exec.c +0 -7173
  312. data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +0 -245
  313. data/vendor/libgit2/deps/pcre/pcre_get.c +0 -669
  314. data/vendor/libgit2/deps/pcre/pcre_globals.c +0 -86
  315. data/vendor/libgit2/deps/pcre/pcre_internal.h +0 -2787
  316. data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +0 -11913
  317. data/vendor/libgit2/deps/pcre/pcre_maketables.c +0 -156
  318. data/vendor/libgit2/deps/pcre/pcre_newline.c +0 -210
  319. data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +0 -94
  320. data/vendor/libgit2/deps/pcre/pcre_printint.c +0 -834
  321. data/vendor/libgit2/deps/pcre/pcre_refcount.c +0 -92
  322. data/vendor/libgit2/deps/pcre/pcre_string_utils.c +0 -211
  323. data/vendor/libgit2/deps/pcre/pcre_study.c +0 -1686
  324. data/vendor/libgit2/deps/pcre/pcre_tables.c +0 -727
  325. data/vendor/libgit2/deps/pcre/pcre_ucd.c +0 -3644
  326. data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +0 -301
  327. data/vendor/libgit2/deps/pcre/pcre_version.c +0 -98
  328. data/vendor/libgit2/deps/pcre/pcre_xclass.c +0 -268
  329. data/vendor/libgit2/deps/pcre/pcreposix.c +0 -421
  330. data/vendor/libgit2/deps/pcre/pcreposix.h +0 -117
  331. data/vendor/libgit2/deps/pcre/ucp.h +0 -224
  332. data/vendor/libgit2/include/git2/cert.h +0 -135
  333. data/vendor/libgit2/include/git2/cred.h +0 -308
  334. data/vendor/libgit2/include/git2/sys/cred.h +0 -90
  335. data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
  336. data/vendor/libgit2/src/config_snapshot.c +0 -206
  337. data/vendor/libgit2/src/errors.h +0 -81
  338. data/vendor/libgit2/src/hash/sha1.h +0 -38
  339. data/vendor/libgit2/src/hash/sha1/collisiondetect.h +0 -19
  340. data/vendor/libgit2/src/hash/sha1/common_crypto.h +0 -19
  341. data/vendor/libgit2/src/hash/sha1/openssl.h +0 -19
  342. data/vendor/libgit2/src/net.c +0 -184
  343. data/vendor/libgit2/src/net.h +0 -36
  344. data/vendor/libgit2/src/regexp.c +0 -221
  345. data/vendor/libgit2/src/regexp.h +0 -97
  346. data/vendor/libgit2/src/transports/auth_ntlm.c +0 -223
  347. data/vendor/libgit2/src/transports/auth_ntlm.h +0 -35
  348. data/vendor/libgit2/src/wildmatch.c +0 -320
  349. data/vendor/libgit2/src/wildmatch.h +0 -23
  350. data/vendor/libgit2/src/win32/w32_common.h +0 -39
@@ -74,8 +74,9 @@ int git_reflog_write(git_reflog *reflog)
74
74
 
75
75
  int git_reflog_append(git_reflog *reflog, const git_oid *new_oid, const git_signature *committer, const char *msg)
76
76
  {
77
- const git_reflog_entry *previous;
78
77
  git_reflog_entry *entry;
78
+ const git_reflog_entry *previous;
79
+ const char *newline;
79
80
 
80
81
  assert(reflog && new_oid && committer);
81
82
 
@@ -86,18 +87,19 @@ int git_reflog_append(git_reflog *reflog, const git_oid *new_oid, const git_sign
86
87
  goto cleanup;
87
88
 
88
89
  if (msg != NULL) {
89
- size_t i, msglen = strlen(msg);
90
-
91
- if ((entry->msg = git__strndup(msg, msglen)) == NULL)
90
+ if ((entry->msg = git__strdup(msg)) == NULL)
92
91
  goto cleanup;
93
92
 
94
- /*
95
- * Replace all newlines with spaces, except for
96
- * the final trailing newline.
97
- */
98
- for (i = 0; i < msglen; i++)
99
- if (entry->msg[i] == '\n')
100
- entry->msg[i] = ' ';
93
+ newline = strchr(msg, '\n');
94
+
95
+ if (newline) {
96
+ if (newline[1] != '\0') {
97
+ git_error_set(GIT_ERROR_INVALID, "reflog message cannot contain newline");
98
+ goto cleanup;
99
+ }
100
+
101
+ entry->msg[newline - msg] = '\0';
102
+ }
101
103
  }
102
104
 
103
105
  previous = git_reflog_entry_byindex(reflog, 0);
@@ -9,7 +9,7 @@
9
9
 
10
10
  #include "hash.h"
11
11
  #include "repository.h"
12
- #include "futils.h"
12
+ #include "fileops.h"
13
13
  #include "filebuf.h"
14
14
  #include "pack.h"
15
15
  #include "reflog.h"
@@ -188,7 +188,7 @@ static int reference_normalize_for_repo(
188
188
  int precompose;
189
189
  unsigned int flags = GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL;
190
190
 
191
- if (!git_repository__configmap_lookup(&precompose, repo, GIT_CONFIGMAP_PRECOMPOSE) &&
191
+ if (!git_repository__cvar(&precompose, repo, GIT_CVAR_PRECOMPOSE) &&
192
192
  precompose)
193
193
  flags |= GIT_REFERENCE_FORMAT__PRECOMPOSE_UNICODE;
194
194
 
@@ -386,7 +386,7 @@ const git_oid *git_reference_target_peel(const git_reference *ref)
386
386
  {
387
387
  assert(ref);
388
388
 
389
- if (ref->type != GIT_REFERENCE_DIRECT || git_oid_is_zero(&ref->peel))
389
+ if (ref->type != GIT_REFERENCE_DIRECT || git_oid_iszero(&ref->peel))
390
390
  return NULL;
391
391
 
392
392
  return &ref->peel;
@@ -692,7 +692,7 @@ static int reference__rename(git_reference **out, git_reference *ref, const char
692
692
  payload.old_name = ref->name;
693
693
  memcpy(&payload.new_name, &normalized, sizeof(normalized));
694
694
 
695
- error = git_repository_foreach_head(repo, update_wt_heads, 0, &payload);
695
+ error = git_repository_foreach_head(repo, update_wt_heads, &payload);
696
696
  }
697
697
 
698
698
  return error;
@@ -897,13 +897,14 @@ static int is_valid_ref_char(char ch)
897
897
  case '\\':
898
898
  case '?':
899
899
  case '[':
900
+ case '*':
900
901
  return 0;
901
902
  default:
902
903
  return 1;
903
904
  }
904
905
  }
905
906
 
906
- static int ensure_segment_validity(const char *name, char may_contain_glob)
907
+ static int ensure_segment_validity(const char *name)
907
908
  {
908
909
  const char *current = name;
909
910
  char prev = '\0';
@@ -926,12 +927,6 @@ static int ensure_segment_validity(const char *name, char may_contain_glob)
926
927
  if (prev == '@' && *current == '{')
927
928
  return -1; /* Refname contains "@{" */
928
929
 
929
- if (*current == '*') {
930
- if (!may_contain_glob)
931
- return -1;
932
- may_contain_glob = 0;
933
- }
934
-
935
930
  prev = *current;
936
931
  }
937
932
 
@@ -1010,20 +1005,19 @@ int git_reference__normalize_name(
1010
1005
  }
1011
1006
 
1012
1007
  while (true) {
1013
- char may_contain_glob = process_flags & GIT_REFERENCE_FORMAT_REFSPEC_PATTERN;
1014
-
1015
- segment_len = ensure_segment_validity(current, may_contain_glob);
1016
- if (segment_len < 0)
1017
- goto cleanup;
1018
-
1019
- if (segment_len > 0) {
1020
- /*
1021
- * There may only be one glob in a pattern, thus we reset
1022
- * the pattern-flag in case the current segment has one.
1023
- */
1024
- if (memchr(current, '*', segment_len))
1008
+ segment_len = ensure_segment_validity(current);
1009
+ if (segment_len < 0) {
1010
+ if ((process_flags & GIT_REFERENCE_FORMAT_REFSPEC_PATTERN) &&
1011
+ current[0] == '*' &&
1012
+ (current[1] == '\0' || current[1] == '/')) {
1013
+ /* Accept one wildcard as a full refname component. */
1025
1014
  process_flags &= ~GIT_REFERENCE_FORMAT_REFSPEC_PATTERN;
1015
+ segment_len = 1;
1016
+ } else
1017
+ goto cleanup;
1018
+ }
1026
1019
 
1020
+ if (segment_len > 0) {
1027
1021
  if (normalize) {
1028
1022
  size_t cur_len = git_buf_len(buf);
1029
1023
 
@@ -1380,7 +1374,7 @@ int git_reference_peel(
1380
1374
  * to a commit. So we only want to use the peeled value
1381
1375
  * if it is not zero and the target is not a tag.
1382
1376
  */
1383
- if (target_type != GIT_OBJECT_TAG && !git_oid_is_zero(&resolved->peel)) {
1377
+ if (target_type != GIT_OBJECT_TAG && !git_oid_iszero(&resolved->peel)) {
1384
1378
  error = git_object_lookup(&target,
1385
1379
  git_reference_owner(ref), &resolved->peel, GIT_OBJECT_ANY);
1386
1380
  } else {
@@ -9,10 +9,10 @@
9
9
 
10
10
  #include "git2/errors.h"
11
11
 
12
- #include "refs.h"
13
12
  #include "util.h"
13
+ #include "posix.h"
14
+ #include "refs.h"
14
15
  #include "vector.h"
15
- #include "wildmatch.h"
16
16
 
17
17
  int git_refspec__parse(git_refspec *refspec, const char *input, bool is_fetch)
18
18
  {
@@ -213,7 +213,7 @@ int git_refspec_src_matches(const git_refspec *refspec, const char *refname)
213
213
  if (refspec == NULL || refspec->src == NULL)
214
214
  return false;
215
215
 
216
- return (wildmatch(refspec->src, refname, 0) == 0);
216
+ return (p_fnmatch(refspec->src, refname, 0) == 0);
217
217
  }
218
218
 
219
219
  int git_refspec_dst_matches(const git_refspec *refspec, const char *refname)
@@ -221,13 +221,14 @@ int git_refspec_dst_matches(const git_refspec *refspec, const char *refname)
221
221
  if (refspec == NULL || refspec->dst == NULL)
222
222
  return false;
223
223
 
224
- return (wildmatch(refspec->dst, refname, 0) == 0);
224
+ return (p_fnmatch(refspec->dst, refname, 0) == 0);
225
225
  }
226
226
 
227
227
  static int refspec_transform(
228
228
  git_buf *out, const char *from, const char *to, const char *name)
229
229
  {
230
230
  const char *from_star, *to_star;
231
+ const char *name_slash, *from_slash;
231
232
  size_t replacement_len, star_offset;
232
233
 
233
234
  git_buf_sanitize(out);
@@ -250,11 +251,17 @@ static int refspec_transform(
250
251
  /* the first half is copied over */
251
252
  git_buf_put(out, to, to_star - to);
252
253
 
253
- /*
254
- * Copy over the name, but exclude the trailing part in "from" starting
255
- * after the glob
256
- */
257
- replacement_len = strlen(name + star_offset) - strlen(from_star + 1);
254
+ /* then we copy over the replacement, from the star's offset to the next slash in 'name' */
255
+ name_slash = strchr(name + star_offset, '/');
256
+ if (!name_slash)
257
+ name_slash = strrchr(name, '\0');
258
+
259
+ /* if there is no slash after the star in 'from', we want to copy everything over */
260
+ from_slash = strchr(from + star_offset, '/');
261
+ if (!from_slash)
262
+ name_slash = strrchr(name, '\0');
263
+
264
+ replacement_len = (name_slash - name) - star_offset;
258
265
  git_buf_put(out, name + star_offset, replacement_len);
259
266
 
260
267
  return git_buf_puts(out, to_star + 1);
@@ -136,6 +136,35 @@ cleanup:
136
136
  return 0;
137
137
  }
138
138
 
139
+ #if 0
140
+ /* We could export this as a helper */
141
+ static int get_check_cert(int *out, git_repository *repo)
142
+ {
143
+ git_config *cfg;
144
+ const char *val;
145
+ int error = 0;
146
+
147
+ assert(out && repo);
148
+
149
+ /* By default, we *DO* want to verify the certificate. */
150
+ *out = 1;
151
+
152
+ /* Go through the possible sources for SSL verification settings, from
153
+ * most specific to least specific. */
154
+
155
+ /* GIT_SSL_NO_VERIFY environment variable */
156
+ if ((val = p_getenv("GIT_SSL_NO_VERIFY")) != NULL)
157
+ return git_config_parse_bool(out, val);
158
+
159
+ /* http.sslVerify config setting */
160
+ if ((error = git_repository_config__weakptr(&cfg, repo)) < 0)
161
+ return error;
162
+
163
+ *out = git_config__get_bool_force(cfg, "http.sslverify", 1);
164
+ return 0;
165
+ }
166
+ #endif
167
+
139
168
  static int canonicalize_url(git_buf *out, const char *in)
140
169
  {
141
170
  if (in == NULL || strlen(in) == 0) {
@@ -188,18 +217,13 @@ static int ensure_remote_doesnot_exist(git_repository *repo, const char *name)
188
217
  return GIT_EEXISTS;
189
218
  }
190
219
 
191
- int git_remote_create_options_init(git_remote_create_options *opts, unsigned int version)
220
+ int git_remote_create_init_options(git_remote_create_options *opts, unsigned int version)
192
221
  {
193
222
  GIT_INIT_STRUCTURE_FROM_TEMPLATE(
194
223
  opts, version, git_remote_create_options, GIT_REMOTE_CREATE_OPTIONS_INIT);
195
224
  return 0;
196
225
  }
197
226
 
198
- int git_remote_create_init_options(git_remote_create_options *opts, unsigned int version)
199
- {
200
- return git_remote_create_options_init(opts, version);
201
- }
202
-
203
227
  int git_remote_create_with_opts(git_remote **out, const char *url, const git_remote_create_options *opts)
204
228
  {
205
229
  git_remote *remote = NULL;
@@ -646,44 +670,21 @@ int git_remote_set_pushurl(git_repository *repo, const char *remote, const char*
646
670
  return set_url(repo, remote, CONFIG_PUSHURL_FMT, url);
647
671
  }
648
672
 
649
- static int resolve_url(git_buf *resolved_url, const char *url, int direction, const git_remote_callbacks *callbacks)
673
+ const char* git_remote__urlfordirection(git_remote *remote, int direction)
650
674
  {
651
- int status;
652
-
653
- if (callbacks && callbacks->resolve_url) {
654
- git_buf_clear(resolved_url);
655
- status = callbacks->resolve_url(resolved_url, url, direction, callbacks->payload);
656
- if (status != GIT_PASSTHROUGH) {
657
- git_error_set_after_callback_function(status, "git_resolve_url_cb");
658
- git_buf_sanitize(resolved_url);
659
- return status;
660
- }
661
- }
662
-
663
- return git_buf_sets(resolved_url, url);
664
- }
665
-
666
- int git_remote__urlfordirection(git_buf *url_out, struct git_remote *remote, int direction, const git_remote_callbacks *callbacks)
667
- {
668
- const char *url = NULL;
669
-
670
675
  assert(remote);
676
+
671
677
  assert(direction == GIT_DIRECTION_FETCH || direction == GIT_DIRECTION_PUSH);
672
678
 
673
679
  if (direction == GIT_DIRECTION_FETCH) {
674
- url = remote->url;
675
- } else if (direction == GIT_DIRECTION_PUSH) {
676
- url = remote->pushurl ? remote->pushurl : remote->url;
680
+ return remote->url;
677
681
  }
678
682
 
679
- if (!url) {
680
- git_error_set(GIT_ERROR_INVALID,
681
- "malformed remote '%s' - missing %s URL",
682
- remote->name ? remote->name : "(anonymous)",
683
- direction == GIT_DIRECTION_FETCH ? "fetch" : "push");
684
- return GIT_EINVALID;
683
+ if (direction == GIT_DIRECTION_PUSH) {
684
+ return remote->pushurl ? remote->pushurl : remote->url;
685
685
  }
686
- return resolve_url(url_out, url, direction, callbacks);
686
+
687
+ return NULL;
687
688
  }
688
689
 
689
690
  int set_transport_callbacks(git_transport *t, const git_remote_callbacks *cbs)
@@ -706,7 +707,7 @@ static int set_transport_custom_headers(git_transport *t, const git_strarray *cu
706
707
  int git_remote__connect(git_remote *remote, git_direction direction, const git_remote_callbacks *callbacks, const git_remote_connection_opts *conn)
707
708
  {
708
709
  git_transport *t;
709
- git_buf url = GIT_BUF_INIT;
710
+ const char *url;
710
711
  int flags = GIT_TRANSPORTFLAGS_NONE;
711
712
  int error;
712
713
  void *payload = NULL;
@@ -727,38 +728,39 @@ int git_remote__connect(git_remote *remote, git_direction direction, const git_r
727
728
 
728
729
  t = remote->transport;
729
730
 
730
- if ((error = git_remote__urlfordirection(&url, remote, direction, callbacks)) < 0)
731
- goto on_error;
731
+ url = git_remote__urlfordirection(remote, direction);
732
+ if (url == NULL) {
733
+ git_error_set(GIT_ERROR_INVALID,
734
+ "Malformed remote '%s' - missing %s URL",
735
+ remote->name ? remote->name : "(anonymous)",
736
+ direction == GIT_DIRECTION_FETCH ? "fetch" : "push");
737
+ return -1;
738
+ }
732
739
 
733
740
  /* If we don't have a transport object yet, and the caller specified a
734
741
  * custom transport factory, use that */
735
742
  if (!t && transport &&
736
743
  (error = transport(&t, remote, payload)) < 0)
737
- goto on_error;
744
+ return error;
738
745
 
739
746
  /* If we still don't have a transport, then use the global
740
747
  * transport registrations which map URI schemes to transport factories */
741
- if (!t && (error = git_transport_new(&t, remote, url.ptr)) < 0)
742
- goto on_error;
748
+ if (!t && (error = git_transport_new(&t, remote, url)) < 0)
749
+ return error;
743
750
 
744
751
  if ((error = set_transport_custom_headers(t, conn->custom_headers)) != 0)
745
752
  goto on_error;
746
753
 
747
754
  if ((error = set_transport_callbacks(t, callbacks)) < 0 ||
748
- (error = t->connect(t, url.ptr, credentials, payload, conn->proxy, direction, flags)) != 0)
755
+ (error = t->connect(t, url, credentials, payload, conn->proxy, direction, flags)) != 0)
749
756
  goto on_error;
750
757
 
751
758
  remote->transport = t;
752
759
 
753
- git_buf_dispose(&url);
754
-
755
760
  return 0;
756
761
 
757
762
  on_error:
758
- if (t)
759
- t->free(t);
760
-
761
- git_buf_dispose(&url);
763
+ t->free(t);
762
764
 
763
765
  if (t == remote->transport)
764
766
  remote->transport = NULL;
@@ -1768,7 +1770,7 @@ int git_remote_list(git_strarray *remotes_list, git_repository *repo)
1768
1770
  return 0;
1769
1771
  }
1770
1772
 
1771
- const git_indexer_progress *git_remote_stats(git_remote *remote)
1773
+ const git_transfer_progress* git_remote_stats(git_remote *remote)
1772
1774
  {
1773
1775
  assert(remote);
1774
1776
  return &remote->stats;
@@ -29,7 +29,7 @@ struct git_remote {
29
29
  git_transport *transport;
30
30
  git_repository *repo;
31
31
  git_push *push;
32
- git_indexer_progress stats;
32
+ git_transfer_progress stats;
33
33
  unsigned int need_pack;
34
34
  git_remote_autotag_option_t download_tags;
35
35
  int prune_refs;
@@ -45,7 +45,7 @@ typedef struct git_remote_connection_opts {
45
45
 
46
46
  int git_remote__connect(git_remote *remote, git_direction direction, const git_remote_callbacks *callbacks, const git_remote_connection_opts *conn);
47
47
 
48
- int git_remote__urlfordirection(git_buf *url_out, struct git_remote *remote, int direction, const git_remote_callbacks *callbacks);
48
+ const char* git_remote__urlfordirection(struct git_remote *remote, int direction);
49
49
  int git_remote__get_http_proxy(git_remote *remote, bool use_ssl, char **proxy_url);
50
50
 
51
51
  git_refspec *git_remote__matching_refspec(git_remote *remote, const char *refname);
@@ -16,7 +16,7 @@
16
16
  #include "commit.h"
17
17
  #include "tag.h"
18
18
  #include "blob.h"
19
- #include "futils.h"
19
+ #include "fileops.h"
20
20
  #include "sysdir.h"
21
21
  #include "filebuf.h"
22
22
  #include "index.h"
@@ -42,24 +42,23 @@ bool git_repository__fsync_gitdir = false;
42
42
 
43
43
  static const struct {
44
44
  git_repository_item_t parent;
45
- git_repository_item_t fallback;
46
45
  const char *name;
47
46
  bool directory;
48
47
  } items[] = {
49
- { GIT_REPOSITORY_ITEM_GITDIR, GIT_REPOSITORY_ITEM__LAST, NULL, true },
50
- { GIT_REPOSITORY_ITEM_WORKDIR, GIT_REPOSITORY_ITEM__LAST, NULL, true },
51
- { GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM__LAST, NULL, true },
52
- { GIT_REPOSITORY_ITEM_GITDIR, GIT_REPOSITORY_ITEM__LAST, "index", false },
53
- { GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "objects", true },
54
- { GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "refs", true },
55
- { GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "packed-refs", false },
56
- { GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "remotes", true },
57
- { GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "config", false },
58
- { GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "info", true },
59
- { GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "hooks", true },
60
- { GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "logs", true },
61
- { GIT_REPOSITORY_ITEM_GITDIR, GIT_REPOSITORY_ITEM__LAST, "modules", true },
62
- { GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "worktrees", true }
48
+ { GIT_REPOSITORY_ITEM_GITDIR, NULL, true },
49
+ { GIT_REPOSITORY_ITEM_WORKDIR, NULL, true },
50
+ { GIT_REPOSITORY_ITEM_COMMONDIR, NULL, true },
51
+ { GIT_REPOSITORY_ITEM_GITDIR, "index", false },
52
+ { GIT_REPOSITORY_ITEM_COMMONDIR, "objects", true },
53
+ { GIT_REPOSITORY_ITEM_COMMONDIR, "refs", true },
54
+ { GIT_REPOSITORY_ITEM_COMMONDIR, "packed-refs", false },
55
+ { GIT_REPOSITORY_ITEM_COMMONDIR, "remotes", true },
56
+ { GIT_REPOSITORY_ITEM_COMMONDIR, "config", false },
57
+ { GIT_REPOSITORY_ITEM_COMMONDIR, "info", true },
58
+ { GIT_REPOSITORY_ITEM_COMMONDIR, "hooks", true },
59
+ { GIT_REPOSITORY_ITEM_COMMONDIR, "logs", true },
60
+ { GIT_REPOSITORY_ITEM_GITDIR, "modules", true },
61
+ { GIT_REPOSITORY_ITEM_COMMONDIR, "worktrees", true }
63
62
  };
64
63
 
65
64
  static int check_repositoryformatversion(git_config *config);
@@ -122,7 +121,7 @@ static void set_config(git_repository *repo, git_config *config)
122
121
  git_config_free(config);
123
122
  }
124
123
 
125
- git_repository__configmap_lookup_cache_clear(repo);
124
+ git_repository__cvar_cache_clear(repo);
126
125
  }
127
126
 
128
127
  static void set_index(git_repository *repo, git_index *index)
@@ -161,7 +160,7 @@ void git_repository_free(git_repository *repo)
161
160
 
162
161
  git_repository__cleanup(repo);
163
162
 
164
- git_cache_dispose(&repo->objects);
163
+ git_cache_free(&repo->objects);
165
164
 
166
165
  git_diff_driver_registry_free(repo->diff_drivers);
167
166
  repo->diff_drivers = NULL;
@@ -239,14 +238,14 @@ static git_repository *repository_alloc(void)
239
238
  if (!repo->reserved_names.ptr)
240
239
  goto on_error;
241
240
 
242
- /* set all the entries in the configmap cache to `unset` */
243
- git_repository__configmap_lookup_cache_clear(repo);
241
+ /* set all the entries in the cvar cache to `unset` */
242
+ git_repository__cvar_cache_clear(repo);
244
243
 
245
244
  return repo;
246
245
 
247
246
  on_error:
248
247
  if (repo)
249
- git_cache_dispose(&repo->objects);
248
+ git_cache_free(&repo->objects);
250
249
 
251
250
  git__free(repo);
252
251
  return NULL;
@@ -800,7 +799,7 @@ int git_repository_open_ext(
800
799
  unsigned is_worktree;
801
800
  git_buf gitdir = GIT_BUF_INIT, workdir = GIT_BUF_INIT,
802
801
  gitlink = GIT_BUF_INIT, commondir = GIT_BUF_INIT;
803
- git_repository *repo = NULL;
802
+ git_repository *repo;
804
803
  git_config *config = NULL;
805
804
 
806
805
  if (flags & GIT_REPOSITORY_OPEN_FROM_ENV)
@@ -813,7 +812,7 @@ int git_repository_open_ext(
813
812
  &gitdir, &workdir, &gitlink, &commondir, start_path, flags, ceiling_dirs);
814
813
 
815
814
  if (error < 0 || !repo_ptr)
816
- goto cleanup;
815
+ return error;
817
816
 
818
817
  repo = repository_alloc();
819
818
  GIT_ERROR_CHECK_ALLOC(repo);
@@ -859,14 +858,11 @@ int git_repository_open_ext(
859
858
  cleanup:
860
859
  git_buf_dispose(&gitdir);
861
860
  git_buf_dispose(&workdir);
862
- git_buf_dispose(&gitlink);
863
- git_buf_dispose(&commondir);
864
861
  git_config_free(config);
865
862
 
866
863
  if (error < 0)
867
864
  git_repository_free(repo);
868
-
869
- if (repo_ptr)
865
+ else
870
866
  *repo_ptr = repo;
871
867
 
872
868
  return error;
@@ -882,8 +878,7 @@ int git_repository_open_from_worktree(git_repository **repo_out, git_worktree *w
882
878
  {
883
879
  git_buf path = GIT_BUF_INIT;
884
880
  git_repository *repo = NULL;
885
- size_t len;
886
- int err;
881
+ int len, err;
887
882
 
888
883
  assert(repo_out && wt);
889
884
 
@@ -1290,8 +1285,8 @@ bool git_repository__reserved_names(
1290
1285
  int (*prefixcmp)(const char *, const char *);
1291
1286
  int error, ignorecase;
1292
1287
 
1293
- error = git_repository__configmap_lookup(
1294
- &ignorecase, repo, GIT_CONFIGMAP_IGNORECASE);
1288
+ error = git_repository__cvar(
1289
+ &ignorecase, repo, GIT_CVAR_IGNORECASE);
1295
1290
  prefixcmp = (error || ignorecase) ? git__prefixcmp_icase :
1296
1291
  git__prefixcmp;
1297
1292
 
@@ -1363,11 +1358,10 @@ int git_repository_create_head(const char *git_dir, const char *ref_name)
1363
1358
  git_buf ref_path = GIT_BUF_INIT;
1364
1359
  git_filebuf ref = GIT_FILEBUF_INIT;
1365
1360
  const char *fmt;
1366
- int error;
1367
1361
 
1368
- if ((error = git_buf_joinpath(&ref_path, git_dir, GIT_HEAD_FILE)) < 0 ||
1369
- (error = git_filebuf_open(&ref, ref_path.ptr, 0, GIT_REFS_FILE_MODE)) < 0)
1370
- goto out;
1362
+ if (git_buf_joinpath(&ref_path, git_dir, GIT_HEAD_FILE) < 0 ||
1363
+ git_filebuf_open(&ref, ref_path.ptr, 0, GIT_REFS_FILE_MODE) < 0)
1364
+ goto fail;
1371
1365
 
1372
1366
  if (!ref_name)
1373
1367
  ref_name = GIT_BRANCH_MASTER;
@@ -1377,14 +1371,17 @@ int git_repository_create_head(const char *git_dir, const char *ref_name)
1377
1371
  else
1378
1372
  fmt = "ref: " GIT_REFS_HEADS_DIR "%s\n";
1379
1373
 
1380
- if ((error = git_filebuf_printf(&ref, fmt, ref_name)) < 0 ||
1381
- (error = git_filebuf_commit(&ref)) < 0)
1382
- goto out;
1374
+ if (git_filebuf_printf(&ref, fmt, ref_name) < 0 ||
1375
+ git_filebuf_commit(&ref) < 0)
1376
+ goto fail;
1383
1377
 
1384
- out:
1378
+ git_buf_dispose(&ref_path);
1379
+ return 0;
1380
+
1381
+ fail:
1385
1382
  git_buf_dispose(&ref_path);
1386
1383
  git_filebuf_cleanup(&ref);
1387
- return error;
1384
+ return -1;
1388
1385
  }
1389
1386
 
1390
1387
  static bool is_chmod_supported(const char *file_path)
@@ -1422,6 +1419,9 @@ static bool are_symlinks_supported(const char *wd_path)
1422
1419
  git_buf xdg_buf = GIT_BUF_INIT;
1423
1420
  git_buf system_buf = GIT_BUF_INIT;
1424
1421
  git_buf programdata_buf = GIT_BUF_INIT;
1422
+ git_buf path = GIT_BUF_INIT;
1423
+ int fd;
1424
+ struct stat st;
1425
1425
  int symlinks = 0;
1426
1426
 
1427
1427
  /*
@@ -1448,14 +1448,23 @@ static bool are_symlinks_supported(const char *wd_path)
1448
1448
  goto done;
1449
1449
  #endif
1450
1450
 
1451
- if (!(symlinks = git_path_supports_symlinks(wd_path)))
1451
+ if ((fd = git_futils_mktmp(&path, wd_path, 0666)) < 0 ||
1452
+ p_close(fd) < 0 ||
1453
+ p_unlink(path.ptr) < 0 ||
1454
+ p_symlink("testing", path.ptr) < 0 ||
1455
+ p_lstat(path.ptr, &st) < 0)
1452
1456
  goto done;
1453
1457
 
1458
+ symlinks = (S_ISLNK(st.st_mode) != 0);
1459
+
1460
+ (void)p_unlink(path.ptr);
1461
+
1454
1462
  done:
1455
1463
  git_buf_dispose(&global_buf);
1456
1464
  git_buf_dispose(&xdg_buf);
1457
1465
  git_buf_dispose(&system_buf);
1458
1466
  git_buf_dispose(&programdata_buf);
1467
+ git_buf_dispose(&path);
1459
1468
  git_config_free(config);
1460
1469
  return symlinks != 0;
1461
1470
  }
@@ -1649,7 +1658,7 @@ int git_repository_reinit_filesystem(git_repository *repo, int recurse)
1649
1658
  git_config_free(config);
1650
1659
  git_buf_dispose(&path);
1651
1660
 
1652
- git_repository__configmap_lookup_cache_clear(repo);
1661
+ git_repository__cvar_cache_clear(repo);
1653
1662
 
1654
1663
  if (!repo->is_bare && recurse)
1655
1664
  (void)git_submodule_foreach(repo, repo_reinit_submodule_fs, NULL);
@@ -2047,59 +2056,53 @@ int git_repository_init_ext(
2047
2056
  const char *given_repo,
2048
2057
  git_repository_init_options *opts)
2049
2058
  {
2059
+ int error;
2050
2060
  git_buf repo_path = GIT_BUF_INIT, wd_path = GIT_BUF_INIT,
2051
- common_path = GIT_BUF_INIT, head_path = GIT_BUF_INIT;
2061
+ common_path = GIT_BUF_INIT;
2052
2062
  const char *wd;
2053
- int error;
2054
2063
 
2055
2064
  assert(out && given_repo && opts);
2056
2065
 
2057
2066
  GIT_ERROR_CHECK_VERSION(opts, GIT_REPOSITORY_INIT_OPTIONS_VERSION, "git_repository_init_options");
2058
2067
 
2059
- if ((error = repo_init_directories(&repo_path, &wd_path, given_repo, opts)) < 0)
2060
- goto out;
2068
+ error = repo_init_directories(&repo_path, &wd_path, given_repo, opts);
2069
+ if (error < 0)
2070
+ goto cleanup;
2061
2071
 
2062
2072
  wd = (opts->flags & GIT_REPOSITORY_INIT_BARE) ? NULL : git_buf_cstr(&wd_path);
2063
-
2064
2073
  if (valid_repository_path(&repo_path, &common_path)) {
2074
+
2065
2075
  if ((opts->flags & GIT_REPOSITORY_INIT_NO_REINIT) != 0) {
2066
2076
  git_error_set(GIT_ERROR_REPOSITORY,
2067
2077
  "attempt to reinitialize '%s'", given_repo);
2068
2078
  error = GIT_EEXISTS;
2069
- goto out;
2079
+ goto cleanup;
2070
2080
  }
2071
2081
 
2072
2082
  opts->flags |= GIT_REPOSITORY_INIT__IS_REINIT;
2073
2083
 
2074
- if ((error = repo_init_config(repo_path.ptr, wd, opts->flags, opts->mode)) < 0)
2075
- goto out;
2084
+ error = repo_init_config(
2085
+ repo_path.ptr, wd, opts->flags, opts->mode);
2076
2086
 
2077
2087
  /* TODO: reinitialize the templates */
2078
- } else {
2079
- if ((error = repo_init_structure(repo_path.ptr, wd, opts)) < 0 ||
2080
- (error = repo_init_config(repo_path.ptr, wd, opts->flags, opts->mode)) < 0 ||
2081
- (error = git_buf_joinpath(&head_path, repo_path.ptr, GIT_HEAD_FILE)) < 0)
2082
- goto out;
2083
-
2084
- /*
2085
- * Only set the new HEAD if the file does not exist already via
2086
- * a template or if the caller has explicitly supplied an
2087
- * initial HEAD value.
2088
- */
2089
- if ((!git_path_exists(head_path.ptr) || opts->initial_head) &&
2090
- (error = git_repository_create_head(repo_path.ptr, opts->initial_head)) < 0)
2091
- goto out;
2092
2088
  }
2089
+ else {
2090
+ if (!(error = repo_init_structure(
2091
+ repo_path.ptr, wd, opts)) &&
2092
+ !(error = repo_init_config(
2093
+ repo_path.ptr, wd, opts->flags, opts->mode)))
2094
+ error = git_repository_create_head(
2095
+ repo_path.ptr, opts->initial_head);
2096
+ }
2097
+ if (error < 0)
2098
+ goto cleanup;
2093
2099
 
2094
- if ((error = git_repository_open(out, repo_path.ptr)) < 0)
2095
- goto out;
2100
+ error = git_repository_open(out, repo_path.ptr);
2096
2101
 
2097
- if (opts->origin_url &&
2098
- (error = repo_init_create_origin(*out, opts->origin_url)) < 0)
2099
- goto out;
2102
+ if (!error && opts->origin_url)
2103
+ error = repo_init_create_origin(*out, opts->origin_url);
2100
2104
 
2101
- out:
2102
- git_buf_dispose(&head_path);
2105
+ cleanup:
2103
2106
  git_buf_dispose(&common_path);
2104
2107
  git_buf_dispose(&repo_path);
2105
2108
  git_buf_dispose(&wd_path);
@@ -2207,37 +2210,30 @@ out:
2207
2210
  return error;
2208
2211
  }
2209
2212
 
2210
- int git_repository_foreach_head(git_repository *repo,
2211
- git_repository_foreach_head_cb cb,
2212
- int flags, void *payload)
2213
+ int git_repository_foreach_head(git_repository *repo, git_repository_foreach_head_cb cb, void *payload)
2213
2214
  {
2214
2215
  git_strarray worktrees = GIT_VECTOR_INIT;
2215
2216
  git_buf path = GIT_BUF_INIT;
2216
- int error = 0;
2217
+ int error;
2217
2218
  size_t i;
2218
2219
 
2220
+ /* Execute callback for HEAD of commondir */
2221
+ if ((error = git_buf_joinpath(&path, repo->commondir, GIT_HEAD_FILE)) < 0 ||
2222
+ (error = cb(repo, path.ptr, payload) != 0))
2223
+ goto out;
2219
2224
 
2220
- if (!(flags & GIT_REPOSITORY_FOREACH_HEAD_SKIP_REPO)) {
2221
- /* Gather HEAD of main repository */
2222
- if ((error = git_buf_joinpath(&path, repo->commondir, GIT_HEAD_FILE)) < 0 ||
2223
- (error = cb(repo, path.ptr, payload) != 0))
2224
- goto out;
2225
+ if ((error = git_worktree_list(&worktrees, repo)) < 0) {
2226
+ error = 0;
2227
+ goto out;
2225
2228
  }
2226
2229
 
2227
- if (!(flags & GIT_REPOSITORY_FOREACH_HEAD_SKIP_WORKTREES)) {
2228
- if ((error = git_worktree_list(&worktrees, repo)) < 0) {
2229
- error = 0;
2230
- goto out;
2231
- }
2232
-
2233
- /* Gather HEADs of all worktrees */
2234
- for (i = 0; i < worktrees.count; i++) {
2235
- if (get_worktree_file_path(&path, repo, worktrees.strings[i], GIT_HEAD_FILE) < 0)
2236
- continue;
2230
+ /* Execute callback for all worktree HEADs */
2231
+ for (i = 0; i < worktrees.count; i++) {
2232
+ if (get_worktree_file_path(&path, repo, worktrees.strings[i], GIT_HEAD_FILE) < 0)
2233
+ continue;
2237
2234
 
2238
- if ((error = cb(repo, path.ptr, payload)) != 0)
2239
- goto out;
2240
- }
2235
+ if ((error = cb(repo, path.ptr, payload)) != 0)
2236
+ goto out;
2241
2237
  }
2242
2238
 
2243
2239
  out:
@@ -2304,11 +2300,11 @@ int git_repository_is_empty(git_repository *repo)
2304
2300
  return is_empty;
2305
2301
  }
2306
2302
 
2307
- static const char *resolved_parent_path(const git_repository *repo, git_repository_item_t item, git_repository_item_t fallback)
2303
+ int git_repository_item_path(git_buf *out, const git_repository *repo, git_repository_item_t item)
2308
2304
  {
2309
2305
  const char *parent;
2310
2306
 
2311
- switch (item) {
2307
+ switch (items[item].parent) {
2312
2308
  case GIT_REPOSITORY_ITEM_GITDIR:
2313
2309
  parent = git_repository_path(repo);
2314
2310
  break;
@@ -2320,17 +2316,9 @@ static const char *resolved_parent_path(const git_repository *repo, git_reposito
2320
2316
  break;
2321
2317
  default:
2322
2318
  git_error_set(GIT_ERROR_INVALID, "invalid item directory");
2323
- return NULL;
2319
+ return -1;
2324
2320
  }
2325
- if (!parent && fallback != GIT_REPOSITORY_ITEM__LAST)
2326
- return resolved_parent_path(repo, fallback, GIT_REPOSITORY_ITEM__LAST);
2327
-
2328
- return parent;
2329
- }
2330
2321
 
2331
- int git_repository_item_path(git_buf *out, const git_repository *repo, git_repository_item_t item)
2332
- {
2333
- const char *parent = resolved_parent_path(repo, items[item].parent, items[item].fallback);
2334
2322
  if (parent == NULL) {
2335
2323
  git_error_set(GIT_ERROR_INVALID, "path cannot exist in repository");
2336
2324
  return GIT_ENOTFOUND;
@@ -2485,7 +2473,7 @@ int git_repository__set_orig_head(git_repository *repo, const git_oid *orig_head
2485
2473
  git_oid_fmt(orig_head_str, orig_head);
2486
2474
 
2487
2475
  if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_ORIG_HEAD_FILE)) == 0 &&
2488
- (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_CREATE_LEADING_DIRS, GIT_MERGE_FILE_MODE)) == 0 &&
2476
+ (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_MERGE_FILE_MODE)) == 0 &&
2489
2477
  (error = git_filebuf_printf(&file, "%.*s\n", GIT_OID_HEXSZ, orig_head_str)) == 0)
2490
2478
  error = git_filebuf_commit(&file);
2491
2479
 
@@ -2545,7 +2533,7 @@ int git_repository_hashfile(
2545
2533
  int error;
2546
2534
  git_filter_list *fl = NULL;
2547
2535
  git_file fd = -1;
2548
- uint64_t len;
2536
+ git_off_t len;
2549
2537
  git_buf full_path = GIT_BUF_INIT;
2550
2538
 
2551
2539
  assert(out && path && repo); /* as_path can be NULL */
@@ -2582,8 +2570,11 @@ int git_repository_hashfile(
2582
2570
  goto cleanup;
2583
2571
  }
2584
2572
 
2585
- if ((error = git_futils_filesize(&len, fd)) < 0)
2573
+ len = git_futils_filesize(fd);
2574
+ if (len < 0) {
2575
+ error = (int)len;
2586
2576
  goto cleanup;
2577
+ }
2587
2578
 
2588
2579
  if (!git__is_sizet(len)) {
2589
2580
  git_error_set(GIT_ERROR_OS, "file size overflow for 32-bit systems");
@@ -2872,7 +2863,7 @@ int git_repository_is_shallow(git_repository *repo)
2872
2863
  return st.st_size == 0 ? 0 : 1;
2873
2864
  }
2874
2865
 
2875
- int git_repository_init_options_init(
2866
+ int git_repository_init_init_options(
2876
2867
  git_repository_init_options *opts, unsigned int version)
2877
2868
  {
2878
2869
  GIT_INIT_STRUCTURE_FROM_TEMPLATE(
@@ -2881,12 +2872,6 @@ int git_repository_init_options_init(
2881
2872
  return 0;
2882
2873
  }
2883
2874
 
2884
- int git_repository_init_init_options(
2885
- git_repository_init_options *opts, unsigned int version)
2886
- {
2887
- return git_repository_init_options_init(opts, version);
2888
- }
2889
-
2890
2875
  int git_repository_ident(const char **name, const char **email, const git_repository *repo)
2891
2876
  {
2892
2877
  *name = repo->ident_name;
@@ -2924,7 +2909,7 @@ int git_repository_submodule_cache_all(git_repository *repo)
2924
2909
 
2925
2910
  assert(repo);
2926
2911
 
2927
- if ((error = git_strmap_new(&repo->submodule_cache)))
2912
+ if ((error = git_strmap_alloc(&repo->submodule_cache)))
2928
2913
  return error;
2929
2914
 
2930
2915
  error = git_submodule__map(repo, repo->submodule_cache);