rugged 0.26.7 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (341) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/ext/rugged/rugged_blame.c +6 -3
  4. data/ext/rugged/rugged_branch_collection.c +3 -6
  5. data/ext/rugged/rugged_commit.c +56 -0
  6. data/ext/rugged/rugged_config.c +44 -9
  7. data/ext/rugged/rugged_diff.c +3 -14
  8. data/ext/rugged/rugged_diff_hunk.c +1 -3
  9. data/ext/rugged/rugged_index.c +1 -5
  10. data/ext/rugged/rugged_note.c +1 -4
  11. data/ext/rugged/rugged_patch.c +1 -4
  12. data/ext/rugged/rugged_reference_collection.c +1 -7
  13. data/ext/rugged/rugged_remote.c +5 -8
  14. data/ext/rugged/rugged_remote_collection.c +1 -6
  15. data/ext/rugged/rugged_repo.c +16 -48
  16. data/ext/rugged/rugged_revwalk.c +7 -16
  17. data/ext/rugged/rugged_settings.c +28 -0
  18. data/ext/rugged/rugged_submodule_collection.c +3 -4
  19. data/ext/rugged/rugged_tag_collection.c +1 -5
  20. data/ext/rugged/rugged_tree.c +2 -3
  21. data/lib/rugged/repository.rb +43 -0
  22. data/lib/rugged/version.rb +1 -1
  23. data/vendor/libgit2/AUTHORS +1 -0
  24. data/vendor/libgit2/CMakeLists.txt +61 -510
  25. data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +14 -0
  26. data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +25 -8
  27. data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +27 -8
  28. data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +20 -0
  29. data/vendor/libgit2/cmake/Modules/IdeSplitSources.cmake +22 -0
  30. data/vendor/libgit2/deps/http-parser/CMakeLists.txt +3 -0
  31. data/vendor/libgit2/deps/regex/CMakeLists.txt +2 -0
  32. data/vendor/libgit2/deps/winhttp/CMakeLists.txt +26 -0
  33. data/vendor/libgit2/deps/zlib/CMakeLists.txt +4 -0
  34. data/vendor/libgit2/include/git2/config.h +29 -2
  35. data/vendor/libgit2/include/git2/describe.h +1 -1
  36. data/vendor/libgit2/include/git2/diff.h +59 -8
  37. data/vendor/libgit2/include/git2/graph.h +3 -0
  38. data/vendor/libgit2/include/git2/merge.h +6 -0
  39. data/vendor/libgit2/include/git2/message.h +43 -3
  40. data/vendor/libgit2/include/git2/notes.h +89 -0
  41. data/vendor/libgit2/include/git2/odb.h +8 -1
  42. data/vendor/libgit2/include/git2/patch.h +2 -2
  43. data/vendor/libgit2/include/git2/pathspec.h +35 -18
  44. data/vendor/libgit2/include/git2/refs.h +3 -0
  45. data/vendor/libgit2/include/git2/remote.h +34 -4
  46. data/vendor/libgit2/include/git2/repository.h +6 -6
  47. data/vendor/libgit2/include/git2/reset.h +4 -4
  48. data/vendor/libgit2/include/git2/status.h +4 -0
  49. data/vendor/libgit2/include/git2/sys/config.h +4 -1
  50. data/vendor/libgit2/include/git2/sys/odb_backend.h +2 -1
  51. data/vendor/libgit2/include/git2/tree.h +4 -3
  52. data/vendor/libgit2/include/git2/types.h +1 -0
  53. data/vendor/libgit2/include/git2/version.h +4 -4
  54. data/vendor/libgit2/include/git2/worktree.h +1 -1
  55. data/vendor/libgit2/src/CMakeLists.txt +463 -0
  56. data/vendor/libgit2/src/annotated_commit.c +1 -1
  57. data/vendor/libgit2/src/annotated_commit.h +2 -0
  58. data/vendor/libgit2/src/apply.c +2 -1
  59. data/vendor/libgit2/src/apply.h +2 -0
  60. data/vendor/libgit2/src/attr.c +24 -4
  61. data/vendor/libgit2/src/attr.h +2 -0
  62. data/vendor/libgit2/src/attr_file.c +9 -2
  63. data/vendor/libgit2/src/attr_file.h +2 -0
  64. data/vendor/libgit2/src/attrcache.c +9 -1
  65. data/vendor/libgit2/src/attrcache.h +2 -0
  66. data/vendor/libgit2/src/blame.c +1 -0
  67. data/vendor/libgit2/src/blame.h +2 -1
  68. data/vendor/libgit2/src/blame_git.c +1 -0
  69. data/vendor/libgit2/src/blame_git.h +2 -0
  70. data/vendor/libgit2/src/blob.c +2 -2
  71. data/vendor/libgit2/src/blob.h +2 -0
  72. data/vendor/libgit2/src/branch.c +8 -1
  73. data/vendor/libgit2/src/branch.h +2 -0
  74. data/vendor/libgit2/src/buf_text.c +7 -7
  75. data/vendor/libgit2/src/buf_text.h +3 -3
  76. data/vendor/libgit2/src/buffer.c +31 -1
  77. data/vendor/libgit2/src/buffer.h +3 -0
  78. data/vendor/libgit2/src/cache.c +2 -2
  79. data/vendor/libgit2/src/cache.h +2 -0
  80. data/vendor/libgit2/src/cc-compat.h +3 -3
  81. data/vendor/libgit2/src/checkout.c +30 -19
  82. data/vendor/libgit2/src/checkout.h +2 -0
  83. data/vendor/libgit2/src/cherrypick.c +1 -0
  84. data/vendor/libgit2/src/clone.c +2 -1
  85. data/vendor/libgit2/src/clone.h +4 -0
  86. data/vendor/libgit2/src/commit.c +2 -1
  87. data/vendor/libgit2/src/commit.h +2 -0
  88. data/vendor/libgit2/src/commit_list.c +1 -1
  89. data/vendor/libgit2/src/commit_list.h +2 -0
  90. data/vendor/libgit2/src/common.h +11 -5
  91. data/vendor/libgit2/src/config.c +12 -10
  92. data/vendor/libgit2/src/config.h +2 -0
  93. data/vendor/libgit2/src/config_cache.c +1 -0
  94. data/vendor/libgit2/src/config_file.c +287 -786
  95. data/vendor/libgit2/src/config_file.h +4 -3
  96. data/vendor/libgit2/src/config_parse.c +525 -0
  97. data/vendor/libgit2/src/config_parse.h +64 -0
  98. data/vendor/libgit2/src/crlf.c +2 -1
  99. data/vendor/libgit2/src/delta.c +28 -30
  100. data/vendor/libgit2/src/delta.h +1 -0
  101. data/vendor/libgit2/src/describe.c +3 -1
  102. data/vendor/libgit2/src/diff.c +148 -2
  103. data/vendor/libgit2/src/diff.h +3 -1
  104. data/vendor/libgit2/src/diff_driver.c +12 -9
  105. data/vendor/libgit2/src/diff_driver.h +4 -1
  106. data/vendor/libgit2/src/diff_file.c +7 -4
  107. data/vendor/libgit2/src/diff_file.h +1 -0
  108. data/vendor/libgit2/src/diff_generate.c +6 -3
  109. data/vendor/libgit2/src/diff_generate.h +6 -1
  110. data/vendor/libgit2/src/diff_parse.c +5 -4
  111. data/vendor/libgit2/src/diff_parse.h +2 -0
  112. data/vendor/libgit2/src/diff_print.c +2 -0
  113. data/vendor/libgit2/src/diff_stats.c +2 -0
  114. data/vendor/libgit2/src/diff_tform.c +2 -1
  115. data/vendor/libgit2/src/diff_tform.h +4 -1
  116. data/vendor/libgit2/src/diff_xdiff.c +5 -2
  117. data/vendor/libgit2/src/diff_xdiff.h +2 -0
  118. data/vendor/libgit2/src/errors.c +2 -0
  119. data/vendor/libgit2/src/features.h.in +36 -0
  120. data/vendor/libgit2/src/fetch.c +2 -2
  121. data/vendor/libgit2/src/fetch.h +4 -0
  122. data/vendor/libgit2/src/fetchhead.c +3 -3
  123. data/vendor/libgit2/src/fetchhead.h +3 -0
  124. data/vendor/libgit2/src/filebuf.c +2 -1
  125. data/vendor/libgit2/src/filebuf.h +2 -0
  126. data/vendor/libgit2/src/fileops.c +12 -1
  127. data/vendor/libgit2/src/fileops.h +7 -1
  128. data/vendor/libgit2/src/filter.c +2 -1
  129. data/vendor/libgit2/src/filter.h +1 -0
  130. data/vendor/libgit2/src/fnmatch.c +2 -2
  131. data/vendor/libgit2/src/fnmatch.h +3 -4
  132. data/vendor/libgit2/src/global.c +4 -3
  133. data/vendor/libgit2/src/global.h +1 -5
  134. data/vendor/libgit2/src/graph.c +2 -0
  135. data/vendor/libgit2/src/hash.c +0 -1
  136. data/vendor/libgit2/src/hash.h +3 -1
  137. data/vendor/libgit2/src/hash/hash_collisiondetect.h +3 -3
  138. data/vendor/libgit2/src/hash/hash_common_crypto.h +18 -5
  139. data/vendor/libgit2/src/hash/hash_generic.c +2 -2
  140. data/vendor/libgit2/src/hash/hash_generic.h +5 -3
  141. data/vendor/libgit2/src/hash/hash_openssl.h +3 -3
  142. data/vendor/libgit2/src/hash/hash_win32.c +57 -14
  143. data/vendor/libgit2/src/hash/hash_win32.h +4 -3
  144. data/vendor/libgit2/src/hashsig.c +3 -0
  145. data/vendor/libgit2/src/ident.c +2 -0
  146. data/vendor/libgit2/src/idxmap.h +2 -1
  147. data/vendor/libgit2/src/ignore.c +14 -2
  148. data/vendor/libgit2/src/ignore.h +2 -0
  149. data/vendor/libgit2/src/index.c +20 -40
  150. data/vendor/libgit2/src/index.h +2 -0
  151. data/vendor/libgit2/src/indexer.c +13 -5
  152. data/vendor/libgit2/src/indexer.h +5 -1
  153. data/vendor/libgit2/src/integer.h +1 -1
  154. data/vendor/libgit2/src/iterator.c +44 -3
  155. data/vendor/libgit2/src/iterator.h +3 -0
  156. data/vendor/libgit2/src/map.h +1 -1
  157. data/vendor/libgit2/src/merge.c +155 -33
  158. data/vendor/libgit2/src/merge.h +2 -0
  159. data/vendor/libgit2/src/merge_driver.c +2 -2
  160. data/vendor/libgit2/src/merge_driver.h +2 -0
  161. data/vendor/libgit2/src/merge_file.c +3 -0
  162. data/vendor/libgit2/src/message.h +3 -1
  163. data/vendor/libgit2/src/mwindow.c +1 -1
  164. data/vendor/libgit2/src/mwindow.h +2 -0
  165. data/vendor/libgit2/src/netops.c +75 -62
  166. data/vendor/libgit2/src/netops.h +2 -1
  167. data/vendor/libgit2/src/notes.c +164 -48
  168. data/vendor/libgit2/src/notes.h +1 -1
  169. data/vendor/libgit2/src/object.c +14 -3
  170. data/vendor/libgit2/src/object.h +4 -0
  171. data/vendor/libgit2/src/object_api.c +3 -2
  172. data/vendor/libgit2/src/odb.c +104 -38
  173. data/vendor/libgit2/src/odb.h +3 -1
  174. data/vendor/libgit2/src/odb_loose.c +414 -267
  175. data/vendor/libgit2/src/odb_mempack.c +1 -0
  176. data/vendor/libgit2/src/odb_pack.c +2 -1
  177. data/vendor/libgit2/src/offmap.h +1 -0
  178. data/vendor/libgit2/src/oid.c +2 -1
  179. data/vendor/libgit2/src/oid.h +3 -8
  180. data/vendor/libgit2/src/oidarray.c +2 -1
  181. data/vendor/libgit2/src/oidarray.h +1 -0
  182. data/vendor/libgit2/src/oidmap.h +1 -0
  183. data/vendor/libgit2/src/pack-objects.c +5 -1
  184. data/vendor/libgit2/src/pack-objects.h +1 -1
  185. data/vendor/libgit2/src/pack.c +2 -6
  186. data/vendor/libgit2/src/pack.h +2 -1
  187. data/vendor/libgit2/src/parse.c +121 -0
  188. data/vendor/libgit2/src/parse.h +61 -0
  189. data/vendor/libgit2/src/patch.c +9 -2
  190. data/vendor/libgit2/src/patch.h +2 -0
  191. data/vendor/libgit2/src/patch_generate.c +6 -5
  192. data/vendor/libgit2/src/patch_generate.h +1 -0
  193. data/vendor/libgit2/src/patch_parse.c +265 -276
  194. data/vendor/libgit2/src/patch_parse.h +6 -11
  195. data/vendor/libgit2/src/path.c +24 -181
  196. data/vendor/libgit2/src/path.h +14 -73
  197. data/vendor/libgit2/src/pathspec.c +2 -1
  198. data/vendor/libgit2/src/pathspec.h +2 -1
  199. data/vendor/libgit2/src/pool.c +8 -0
  200. data/vendor/libgit2/src/pool.h +1 -0
  201. data/vendor/libgit2/src/posix.c +2 -1
  202. data/vendor/libgit2/src/posix.h +1 -0
  203. data/vendor/libgit2/src/pqueue.c +1 -0
  204. data/vendor/libgit2/src/pqueue.h +2 -0
  205. data/vendor/libgit2/src/proxy.c +2 -1
  206. data/vendor/libgit2/src/proxy.h +3 -1
  207. data/vendor/libgit2/src/push.c +4 -171
  208. data/vendor/libgit2/src/push.h +2 -0
  209. data/vendor/libgit2/src/rebase.c +1 -0
  210. data/vendor/libgit2/src/refdb.c +2 -3
  211. data/vendor/libgit2/src/refdb.h +2 -0
  212. data/vendor/libgit2/src/refdb_fs.c +5 -3
  213. data/vendor/libgit2/src/refdb_fs.h +4 -0
  214. data/vendor/libgit2/src/reflog.c +1 -0
  215. data/vendor/libgit2/src/reflog.h +2 -1
  216. data/vendor/libgit2/src/refs.c +1 -0
  217. data/vendor/libgit2/src/refs.h +2 -1
  218. data/vendor/libgit2/src/refspec.c +2 -2
  219. data/vendor/libgit2/src/refspec.h +2 -0
  220. data/vendor/libgit2/src/remote.c +56 -10
  221. data/vendor/libgit2/src/remote.h +2 -0
  222. data/vendor/libgit2/src/repository.c +16 -14
  223. data/vendor/libgit2/src/repository.h +2 -0
  224. data/vendor/libgit2/src/reset.c +6 -5
  225. data/vendor/libgit2/src/revert.c +1 -0
  226. data/vendor/libgit2/src/revparse.c +3 -5
  227. data/vendor/libgit2/src/revwalk.c +2 -2
  228. data/vendor/libgit2/src/revwalk.h +2 -0
  229. data/vendor/libgit2/src/settings.c +6 -8
  230. data/vendor/libgit2/src/sha1_lookup.c +2 -216
  231. data/vendor/libgit2/src/sha1_lookup.h +2 -6
  232. data/vendor/libgit2/src/signature.c +8 -3
  233. data/vendor/libgit2/src/signature.h +2 -0
  234. data/vendor/libgit2/src/sortedcache.c +7 -0
  235. data/vendor/libgit2/src/sortedcache.h +2 -0
  236. data/vendor/libgit2/src/stash.c +1 -0
  237. data/vendor/libgit2/src/status.c +14 -9
  238. data/vendor/libgit2/src/status.h +2 -0
  239. data/vendor/libgit2/src/{curl_stream.c → streams/curl.c} +2 -0
  240. data/vendor/libgit2/src/{curl_stream.h → streams/curl.h} +4 -2
  241. data/vendor/libgit2/src/{openssl_stream.c → streams/openssl.c} +47 -18
  242. data/vendor/libgit2/src/{openssl_stream.h → streams/openssl.h} +6 -2
  243. data/vendor/libgit2/src/{socket_stream.c → streams/socket.c} +2 -2
  244. data/vendor/libgit2/src/{socket_stream.h → streams/socket.h} +4 -2
  245. data/vendor/libgit2/src/{stransport_stream.c → streams/stransport.c} +4 -2
  246. data/vendor/libgit2/src/{stransport_stream.h → streams/stransport.h} +4 -2
  247. data/vendor/libgit2/src/{tls_stream.c → streams/tls.c} +4 -3
  248. data/vendor/libgit2/src/{tls_stream.h → streams/tls.h} +4 -2
  249. data/vendor/libgit2/src/submodule.c +28 -80
  250. data/vendor/libgit2/src/submodule.h +2 -13
  251. data/vendor/libgit2/src/sysdir.c +75 -8
  252. data/vendor/libgit2/src/sysdir.h +2 -1
  253. data/vendor/libgit2/src/tag.c +2 -2
  254. data/vendor/libgit2/src/tag.h +2 -0
  255. data/vendor/libgit2/src/thread-utils.c +1 -0
  256. data/vendor/libgit2/src/thread-utils.h +1 -1
  257. data/vendor/libgit2/src/trace.c +2 -2
  258. data/vendor/libgit2/src/trace.h +2 -0
  259. data/vendor/libgit2/src/trailer.c +416 -0
  260. data/vendor/libgit2/src/transaction.c +2 -1
  261. data/vendor/libgit2/src/transport.c +2 -0
  262. data/vendor/libgit2/src/transports/auth.c +2 -1
  263. data/vendor/libgit2/src/transports/auth.h +4 -3
  264. data/vendor/libgit2/src/transports/auth_negotiate.c +2 -1
  265. data/vendor/libgit2/src/transports/auth_negotiate.h +3 -3
  266. data/vendor/libgit2/src/transports/cred.c +2 -0
  267. data/vendor/libgit2/src/transports/cred.h +4 -2
  268. data/vendor/libgit2/src/transports/cred_helpers.c +1 -0
  269. data/vendor/libgit2/src/transports/git.c +3 -1
  270. data/vendor/libgit2/src/transports/http.c +10 -14
  271. data/vendor/libgit2/src/transports/http.h +23 -0
  272. data/vendor/libgit2/src/transports/local.c +23 -5
  273. data/vendor/libgit2/src/transports/smart.c +3 -1
  274. data/vendor/libgit2/src/transports/smart.h +23 -16
  275. data/vendor/libgit2/src/transports/smart_pkt.c +114 -130
  276. data/vendor/libgit2/src/transports/smart_protocol.c +26 -22
  277. data/vendor/libgit2/src/transports/ssh.c +12 -7
  278. data/vendor/libgit2/src/transports/ssh.h +4 -2
  279. data/vendor/libgit2/src/transports/winhttp.c +19 -21
  280. data/vendor/libgit2/src/tree-cache.c +1 -0
  281. data/vendor/libgit2/src/tree-cache.h +1 -0
  282. data/vendor/libgit2/src/tree.c +20 -14
  283. data/vendor/libgit2/src/tree.h +2 -0
  284. data/vendor/libgit2/src/tsort.c +0 -1
  285. data/vendor/libgit2/src/unix/map.c +4 -1
  286. data/vendor/libgit2/src/unix/posix.h +8 -4
  287. data/vendor/libgit2/src/unix/pthread.h +1 -1
  288. data/vendor/libgit2/src/unix/realpath.c +4 -1
  289. data/vendor/libgit2/src/util.c +6 -5
  290. data/vendor/libgit2/src/util.h +39 -111
  291. data/vendor/libgit2/src/varint.c +0 -1
  292. data/vendor/libgit2/src/varint.h +2 -0
  293. data/vendor/libgit2/src/vector.c +1 -1
  294. data/vendor/libgit2/src/win32/dir.c +3 -0
  295. data/vendor/libgit2/src/win32/dir.h +4 -3
  296. data/vendor/libgit2/src/win32/error.c +1 -1
  297. data/vendor/libgit2/src/win32/error.h +4 -2
  298. data/vendor/libgit2/src/win32/findfile.c +2 -1
  299. data/vendor/libgit2/src/win32/findfile.h +4 -2
  300. data/vendor/libgit2/src/win32/map.c +2 -0
  301. data/vendor/libgit2/src/win32/mingw-compat.h +3 -3
  302. data/vendor/libgit2/src/win32/msvc-compat.h +3 -3
  303. data/vendor/libgit2/src/win32/path_w32.c +7 -12
  304. data/vendor/libgit2/src/win32/path_w32.h +3 -2
  305. data/vendor/libgit2/src/win32/posix.h +2 -2
  306. data/vendor/libgit2/src/win32/posix_w32.c +11 -5
  307. data/vendor/libgit2/src/win32/precompiled.h +2 -1
  308. data/vendor/libgit2/src/win32/reparse.h +2 -2
  309. data/vendor/libgit2/src/win32/thread.c +1 -0
  310. data/vendor/libgit2/src/win32/thread.h +2 -2
  311. data/vendor/libgit2/src/win32/utf-conv.c +0 -1
  312. data/vendor/libgit2/src/win32/utf-conv.h +4 -3
  313. data/vendor/libgit2/src/win32/w32_buffer.c +1 -1
  314. data/vendor/libgit2/src/win32/w32_buffer.h +4 -2
  315. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -1
  316. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +85 -2
  317. data/vendor/libgit2/src/win32/w32_stack.c +2 -1
  318. data/vendor/libgit2/src/win32/w32_stack.h +5 -3
  319. data/vendor/libgit2/src/win32/w32_util.h +4 -2
  320. data/vendor/libgit2/src/win32/win32-compat.h +3 -3
  321. data/vendor/libgit2/src/worktree.c +4 -5
  322. data/vendor/libgit2/src/worktree.h +2 -0
  323. data/vendor/libgit2/src/xdiff/xdiff.h +22 -13
  324. data/vendor/libgit2/src/xdiff/xdiffi.c +523 -81
  325. data/vendor/libgit2/src/xdiff/xdiffi.h +2 -2
  326. data/vendor/libgit2/src/xdiff/xemit.c +63 -39
  327. data/vendor/libgit2/src/xdiff/xemit.h +2 -2
  328. data/vendor/libgit2/src/xdiff/xhistogram.c +0 -1
  329. data/vendor/libgit2/src/xdiff/xinclude.h +3 -2
  330. data/vendor/libgit2/src/xdiff/xmacros.h +2 -2
  331. data/vendor/libgit2/src/xdiff/xmerge.c +80 -20
  332. data/vendor/libgit2/src/xdiff/xpatience.c +41 -9
  333. data/vendor/libgit2/src/xdiff/xprepare.c +2 -2
  334. data/vendor/libgit2/src/xdiff/xprepare.h +2 -2
  335. data/vendor/libgit2/src/xdiff/xtypes.h +2 -2
  336. data/vendor/libgit2/src/xdiff/xutils.c +47 -27
  337. data/vendor/libgit2/src/xdiff/xutils.h +2 -5
  338. data/vendor/libgit2/src/zstream.c +65 -45
  339. data/vendor/libgit2/src/zstream.h +9 -2
  340. metadata +27 -13
  341. data/vendor/libgit2/include/git2/sys/remote.h +0 -16
@@ -4,8 +4,10 @@
4
4
  * This file is part of libgit2, distributed under the GNU GPL v2 with
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
- #ifndef INCLUDE_openssl_stream_h__
8
- #define INCLUDE_openssl_stream_h__
7
+ #ifndef INCLUDE_streams_openssl_h__
8
+ #define INCLUDE_streams_openssl_h__
9
+
10
+ #include "common.h"
9
11
 
10
12
  #include "git2/sys/stream.h"
11
13
 
@@ -13,6 +15,8 @@ extern int git_openssl_stream_global_init(void);
13
15
 
14
16
  extern int git_openssl_stream_new(git_stream **out, const char *host, const char *port);
15
17
 
18
+ extern int git_openssl__set_cert_location(const char *file, const char *path);
19
+
16
20
  /*
17
21
  * OpenSSL 1.1 made BIO opaque so we have to use functions to interact with it
18
22
  * which do not exist in previous versions. We define these inline functions so
@@ -5,11 +5,11 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
- #include "common.h"
8
+ #include "streams/socket.h"
9
+
9
10
  #include "posix.h"
10
11
  #include "netops.h"
11
12
  #include "stream.h"
12
- #include "socket_stream.h"
13
13
 
14
14
  #ifndef _WIN32
15
15
  # include <sys/types.h>
@@ -4,8 +4,10 @@
4
4
  * This file is part of libgit2, distributed under the GNU GPL v2 with
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
- #ifndef INCLUDE_socket_stream_h__
8
- #define INCLUDE_socket_stream_h__
7
+ #ifndef INCLUDE_streams_socket_h__
8
+ #define INCLUDE_streams_socket_h__
9
+
10
+ #include "common.h"
9
11
 
10
12
  #include "netops.h"
11
13
 
@@ -5,6 +5,8 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
+ #include "streams/stransport.h"
9
+
8
10
  #ifdef GIT_SECURE_TRANSPORT
9
11
 
10
12
  #include <CoreFoundation/CoreFoundation.h>
@@ -13,8 +15,8 @@
13
15
 
14
16
  #include "git2/transport.h"
15
17
 
16
- #include "socket_stream.h"
17
- #include "curl_stream.h"
18
+ #include "streams/socket.h"
19
+ #include "streams/curl.h"
18
20
 
19
21
  static int stransport_error(OSStatus ret)
20
22
  {
@@ -4,8 +4,10 @@
4
4
  * This file is part of libgit2, distributed under the GNU GPL v2 with
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
- #ifndef INCLUDE_stransport_stream_h__
8
- #define INCLUDE_stransport_stream_h__
7
+ #ifndef INCLUDE_streams_stransport_h__
8
+ #define INCLUDE_streams_stransport_h__
9
+
10
+ #include "common.h"
9
11
 
10
12
  #include "git2/sys/stream.h"
11
13
 
@@ -5,11 +5,12 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
+ #include "streams/tls.h"
9
+
8
10
  #include "git2/errors.h"
9
- #include "common.h"
10
11
 
11
- #include "openssl_stream.h"
12
- #include "stransport_stream.h"
12
+ #include "streams/openssl.h"
13
+ #include "streams/stransport.h"
13
14
 
14
15
  static git_stream_cb tls_ctor;
15
16
 
@@ -4,8 +4,10 @@
4
4
  * This file is part of libgit2, distributed under the GNU GPL v2 with
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
- #ifndef INCLUDE_tls_stream_h__
8
- #define INCLUDE_tls_stream_h__
7
+ #ifndef INCLUDE_streams_tls_h__
8
+ #define INCLUDE_streams_tls_h__
9
+
10
+ #include "common.h"
9
11
 
10
12
  #include "git2/sys/stream.h"
11
13
 
@@ -5,7 +5,8 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
- #include "common.h"
8
+ #include "submodule.h"
9
+
9
10
  #include "git2/config.h"
10
11
  #include "git2/sys/config.h"
11
12
  #include "git2/types.h"
@@ -17,7 +18,6 @@
17
18
  #include "config_file.h"
18
19
  #include "config.h"
19
20
  #include "repository.h"
20
- #include "submodule.h"
21
21
  #include "tree.h"
22
22
  #include "iterator.h"
23
23
  #include "path.h"
@@ -169,13 +169,13 @@ static void free_submodule_names(git_strmap *names)
169
169
  * TODO: for some use-cases, this might need case-folding on a
170
170
  * case-insensitive filesystem
171
171
  */
172
- static int load_submodule_names(git_strmap *out, git_repository *repo, git_config *cfg)
172
+ static int load_submodule_names(git_strmap *out, git_config *cfg)
173
173
  {
174
174
  const char *key = "submodule\\..*\\.path";
175
175
  git_config_iterator *iter;
176
176
  git_config_entry *entry;
177
177
  git_buf buf = GIT_BUF_INIT;
178
- int rval, isvalid;
178
+ int rval;
179
179
  int error = 0;
180
180
 
181
181
  if ((error = git_config_iterator_glob_new(&iter, cfg, key)) < 0)
@@ -186,29 +186,16 @@ static int load_submodule_names(git_strmap *out, git_repository *repo, git_confi
186
186
  fdot = strchr(entry->name, '.');
187
187
  ldot = strrchr(entry->name, '.');
188
188
 
189
- git_buf_clear(&buf);
190
189
  git_buf_put(&buf, fdot + 1, ldot - fdot - 1);
191
- isvalid = git_submodule_name_is_valid(repo, buf.ptr, 0);
192
- if (isvalid < 0) {
193
- error = isvalid;
194
- goto out;
195
- }
196
- if (!isvalid)
197
- continue;
198
-
199
190
  git_strmap_insert(out, entry->value, git_buf_detach(&buf), &rval);
200
191
  if (rval < 0) {
201
192
  giterr_set(GITERR_NOMEMORY, "error inserting submodule into hash table");
202
193
  return -1;
203
194
  }
204
195
  }
205
- if (error == GIT_ITEROVER)
206
- error = 0;
207
196
 
208
- out:
209
- git_buf_free(&buf);
210
197
  git_config_iterator_free(iter);
211
- return error;
198
+ return 0;
212
199
  }
213
200
 
214
201
  int git_submodule_lookup(
@@ -222,6 +209,11 @@ int git_submodule_lookup(
222
209
 
223
210
  assert(repo && name);
224
211
 
212
+ if (repo->is_bare) {
213
+ giterr_set(GITERR_SUBMODULE, "cannot get submodules without a working tree");
214
+ return -1;
215
+ }
216
+
225
217
  if (repo->submodule_cache != NULL) {
226
218
  khiter_t pos = git_strmap_lookup_index(repo->submodule_cache, name);
227
219
  if (git_strmap_valid_index(repo->submodule_cache, pos)) {
@@ -322,28 +314,6 @@ int git_submodule_lookup(
322
314
  return 0;
323
315
  }
324
316
 
325
- int git_submodule_name_is_valid(git_repository *repo, const char *name, int flags)
326
- {
327
- git_buf buf = GIT_BUF_INIT;
328
- int error, isvalid;
329
-
330
- if (flags == 0)
331
- flags = GIT_PATH_REJECT_FILESYSTEM_DEFAULTS;
332
-
333
- /* Avoid allocating a new string if we can avoid it */
334
- if (strchr(name, '\\') != NULL) {
335
- if ((error = git_path_normalize_slashes(&buf, name)) < 0)
336
- return error;
337
- } else {
338
- git_buf_attach_notowned(&buf, name, strlen(name));
339
- }
340
-
341
- isvalid = git_path_isvalid(repo, buf.ptr, 0, flags);
342
- git_buf_free(&buf);
343
-
344
- return isvalid;
345
- }
346
-
347
317
  static void submodule_free_dup(void *sm)
348
318
  {
349
319
  git_submodule_free(sm);
@@ -389,7 +359,7 @@ static int submodules_from_index(git_strmap *map, git_index *idx, git_config *cf
389
359
  git_strmap *names = 0;
390
360
 
391
361
  git_strmap_alloc(&names);
392
- if ((error = load_submodule_names(names, git_index_owner(idx), cfg)))
362
+ if ((error = load_submodule_names(names, cfg)))
393
363
  goto done;
394
364
 
395
365
  if ((error = git_iterator_for_index(&i, git_index_owner(idx), idx, NULL)) < 0)
@@ -441,7 +411,7 @@ static int submodules_from_head(git_strmap *map, git_tree *head, git_config *cfg
441
411
  const git_index_entry *entry;
442
412
  git_strmap *names = 0;
443
413
  git_strmap_alloc(&names);
444
- if ((error = load_submodule_names(names, git_tree_owner(head), cfg)))
414
+ if ((error = load_submodule_names(names, cfg)))
445
415
  goto done;
446
416
 
447
417
  if ((error = git_iterator_for_tree(&i, head, NULL)) < 0)
@@ -584,6 +554,11 @@ int git_submodule_foreach(
584
554
  int error;
585
555
  size_t i;
586
556
 
557
+ if (repo->is_bare) {
558
+ giterr_set(GITERR_SUBMODULE, "cannot get submodules without a working tree");
559
+ return -1;
560
+ }
561
+
587
562
  if ((error = git_strmap_alloc(&submodules)) < 0)
588
563
  return error;
589
564
 
@@ -1527,19 +1502,13 @@ static int submodule_update_head(git_submodule *submodule)
1527
1502
 
1528
1503
  int git_submodule_reload(git_submodule *sm, int force)
1529
1504
  {
1530
- int error = 0, isvalid;
1505
+ int error = 0;
1531
1506
  git_config *mods;
1532
1507
 
1533
1508
  GIT_UNUSED(force);
1534
1509
 
1535
1510
  assert(sm);
1536
1511
 
1537
- isvalid = git_submodule_name_is_valid(sm->repo, sm->name, 0);
1538
- if (isvalid <= 0) {
1539
- /* This should come with a warning, but we've no API for that */
1540
- return isvalid;
1541
- }
1542
-
1543
1512
  if (!git_repository_is_bare(sm->repo)) {
1544
1513
  /* refresh config data */
1545
1514
  mods = gitmodules_snapshot(sm->repo);
@@ -1792,14 +1761,6 @@ static int get_value(const char **out, git_config *cfg, git_buf *buf, const char
1792
1761
  return error;
1793
1762
  }
1794
1763
 
1795
- static bool looks_like_command_line_option(const char *s)
1796
- {
1797
- if (s && s[0] == '-')
1798
- return true;
1799
-
1800
- return false;
1801
- }
1802
-
1803
1764
  static int submodule_read_config(git_submodule *sm, git_config *cfg)
1804
1765
  {
1805
1766
  git_buf key = GIT_BUF_INIT;
@@ -1813,31 +1774,24 @@ static int submodule_read_config(git_submodule *sm, git_config *cfg)
1813
1774
 
1814
1775
  if ((error = get_value(&value, cfg, &key, sm->name, "path")) == 0) {
1815
1776
  in_config = 1;
1816
- /* We would warn here if we had that API */
1817
- if (!looks_like_command_line_option(value)) {
1818
1777
  /*
1819
1778
  * TODO: if case insensitive filesystem, then the following strcmp
1820
1779
  * should be strcasecmp
1821
1780
  */
1822
- if (strcmp(sm->name, value) != 0) {
1823
- if (sm->path != sm->name)
1824
- git__free(sm->path);
1825
- sm->path = git__strdup(value);
1826
- GITERR_CHECK_ALLOC(sm->path);
1827
- }
1828
-
1781
+ if (strcmp(sm->name, value) != 0) {
1782
+ if (sm->path != sm->name)
1783
+ git__free(sm->path);
1784
+ sm->path = git__strdup(value);
1785
+ GITERR_CHECK_ALLOC(sm->path);
1829
1786
  }
1830
1787
  } else if (error != GIT_ENOTFOUND) {
1831
1788
  goto cleanup;
1832
1789
  }
1833
1790
 
1834
1791
  if ((error = get_value(&value, cfg, &key, sm->name, "url")) == 0) {
1835
- /* We would warn here if we had that API */
1836
- if (!looks_like_command_line_option(value)) {
1837
- in_config = 1;
1838
- sm->url = git__strdup(value);
1839
- GITERR_CHECK_ALLOC(sm->url);
1840
- }
1792
+ in_config = 1;
1793
+ sm->url = git__strdup(value);
1794
+ GITERR_CHECK_ALLOC(sm->url);
1841
1795
  } else if (error != GIT_ENOTFOUND) {
1842
1796
  goto cleanup;
1843
1797
  }
@@ -1895,7 +1849,7 @@ static int submodule_load_each(const git_config_entry *entry, void *payload)
1895
1849
  git_strmap *map = data->map;
1896
1850
  git_buf name = GIT_BUF_INIT;
1897
1851
  git_submodule *sm;
1898
- int error, isvalid;
1852
+ int error;
1899
1853
 
1900
1854
  if (git__prefixcmp(entry->name, "submodule.") != 0)
1901
1855
  return 0;
@@ -1911,12 +1865,6 @@ static int submodule_load_each(const git_config_entry *entry, void *payload)
1911
1865
  if ((error = git_buf_set(&name, namestart, property - namestart -1)) < 0)
1912
1866
  return error;
1913
1867
 
1914
- isvalid = git_submodule_name_is_valid(data->repo, name.ptr, 0);
1915
- if (isvalid <= 0) {
1916
- error = isvalid;
1917
- goto done;
1918
- }
1919
-
1920
1868
  /*
1921
1869
  * Now that we have the submodule's name, we can use that to
1922
1870
  * figure out whether it's in the map. If it's not, we create
@@ -2012,7 +1960,7 @@ static git_config_backend *open_gitmodules(
2012
1960
  if (git_config_file__ondisk(&mods, path.ptr) < 0)
2013
1961
  mods = NULL;
2014
1962
  /* open should only fail here if the file is malformed */
2015
- else if (git_config_file_open(mods, GIT_CONFIG_LEVEL_LOCAL) < 0) {
1963
+ else if (git_config_file_open(mods, GIT_CONFIG_LEVEL_LOCAL, repo) < 0) {
2016
1964
  git_config_file_free(mods);
2017
1965
  mods = NULL;
2018
1966
  }
@@ -7,6 +7,8 @@
7
7
  #ifndef INCLUDE_submodule_h__
8
8
  #define INCLUDE_submodule_h__
9
9
 
10
+ #include "common.h"
11
+
10
12
  #include "git2/submodule.h"
11
13
  #include "git2/repository.h"
12
14
  #include "fileops.h"
@@ -146,17 +148,4 @@ extern int git_submodule_parse_update(
146
148
  extern int git_submodule__map(
147
149
  git_repository *repo,
148
150
  git_strmap *map);
149
-
150
- /**
151
- * Check whether a submodule's name is valid.
152
- *
153
- * Check the path against the path validity rules, either the filesystem
154
- * defaults (like checkout does) or whichever you want to compare against.
155
- *
156
- * @param repo the repository which contains the submodule
157
- * @param name the name to check
158
- * @param flags the `GIT_PATH` flags to use for the check (0 to use filesystem defaults)
159
- */
160
- extern int git_submodule_name_is_valid(git_repository *repo, const char *name, int flags);
161
-
162
151
  #endif
@@ -5,14 +5,17 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
- #include "common.h"
9
8
  #include "sysdir.h"
9
+
10
10
  #include "global.h"
11
11
  #include "buffer.h"
12
12
  #include "path.h"
13
13
  #include <ctype.h>
14
14
  #if GIT_WIN32
15
15
  #include "win32/findfile.h"
16
+ #else
17
+ #include <unistd.h>
18
+ #include <pwd.h>
16
19
  #endif
17
20
 
18
21
  static int git_sysdir_guess_programdata_dirs(git_buf *out)
@@ -34,12 +37,63 @@ static int git_sysdir_guess_system_dirs(git_buf *out)
34
37
  #endif
35
38
  }
36
39
 
40
+ #ifndef GIT_WIN32
41
+ static int get_passwd_home(git_buf *out, uid_t uid)
42
+ {
43
+ struct passwd pwd, *pwdptr;
44
+ char *buf = NULL;
45
+ long buflen;
46
+ int error;
47
+
48
+ assert(out);
49
+
50
+ if ((buflen = sysconf(_SC_GETPW_R_SIZE_MAX)) == -1)
51
+ buflen = 1024;
52
+
53
+ do {
54
+ buf = git__realloc(buf, buflen);
55
+ error = getpwuid_r(uid, &pwd, buf, buflen, &pwdptr);
56
+ buflen *= 2;
57
+ } while (error == ERANGE && buflen <= 8192);
58
+
59
+ if (error) {
60
+ giterr_set(GITERR_OS, "failed to get passwd entry");
61
+ goto out;
62
+ }
63
+
64
+ if (!pwdptr) {
65
+ giterr_set(GITERR_OS, "no passwd entry found for user");
66
+ goto out;
67
+ }
68
+
69
+ if ((error = git_buf_puts(out, pwdptr->pw_dir)) < 0)
70
+ goto out;
71
+
72
+ out:
73
+ git__free(buf);
74
+ return error;
75
+ }
76
+ #endif
77
+
37
78
  static int git_sysdir_guess_global_dirs(git_buf *out)
38
79
  {
39
80
  #ifdef GIT_WIN32
40
81
  return git_win32__find_global_dirs(out);
41
82
  #else
42
- int error = git__getenv(out, "HOME");
83
+ int error;
84
+ uid_t uid, euid;
85
+
86
+ uid = getuid();
87
+ euid = geteuid();
88
+
89
+ /*
90
+ * In case we are running setuid, use the configuration
91
+ * of the effective user.
92
+ */
93
+ if (uid == euid)
94
+ error = git__getenv(out, "HOME");
95
+ else
96
+ error = get_passwd_home(out, euid);
43
97
 
44
98
  if (error == GIT_ENOTFOUND) {
45
99
  giterr_clear();
@@ -57,12 +111,25 @@ static int git_sysdir_guess_xdg_dirs(git_buf *out)
57
111
  #else
58
112
  git_buf env = GIT_BUF_INIT;
59
113
  int error;
60
-
61
- if ((error = git__getenv(&env, "XDG_CONFIG_HOME")) == 0)
62
- error = git_buf_joinpath(out, env.ptr, "git");
63
-
64
- if (error == GIT_ENOTFOUND && (error = git__getenv(&env, "HOME")) == 0)
65
- error = git_buf_joinpath(out, env.ptr, ".config/git");
114
+ uid_t uid, euid;
115
+
116
+ uid = getuid();
117
+ euid = geteuid();
118
+
119
+ /*
120
+ * In case we are running setuid, only look up passwd
121
+ * directory of the effective user.
122
+ */
123
+ if (uid == euid) {
124
+ if ((error = git__getenv(&env, "XDG_CONFIG_HOME")) == 0)
125
+ error = git_buf_joinpath(out, env.ptr, "git");
126
+
127
+ if (error == GIT_ENOTFOUND && (error = git__getenv(&env, "HOME")) == 0)
128
+ error = git_buf_joinpath(out, env.ptr, ".config/git");
129
+ } else {
130
+ if ((error = get_passwd_home(&env, euid)) == 0)
131
+ error = git_buf_joinpath(out, env.ptr, ".config/git");
132
+ }
66
133
 
67
134
  if (error == GIT_ENOTFOUND) {
68
135
  giterr_clear();