rugged 0.26.7 → 0.27.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -7,6 +7,8 @@
7
7
  #ifndef INCLUDE_refspec_h__
8
8
  #define INCLUDE_refspec_h__
9
9
 
10
+ #include "common.h"
11
+
10
12
  #include "git2/refspec.h"
11
13
  #include "buffer.h"
12
14
  #include "vector.h"
@@ -5,15 +5,15 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
+ #include "remote.h"
9
+
8
10
  #include "git2/config.h"
9
11
  #include "git2/types.h"
10
12
  #include "git2/oid.h"
11
13
  #include "git2/net.h"
12
14
 
13
- #include "common.h"
14
15
  #include "config.h"
15
16
  #include "repository.h"
16
- #include "remote.h"
17
17
  #include "fetch.h"
18
18
  #include "refs.h"
19
19
  #include "refspec.h"
@@ -197,10 +197,10 @@ static int create_internal(git_remote **out, git_repository *repo, const char *n
197
197
  git_buf var = GIT_BUF_INIT;
198
198
  int error = -1;
199
199
 
200
- /* name is optional */
201
- assert(out && repo && url);
200
+ /* repo, name, and fetch are optional */
201
+ assert(out && url);
202
202
 
203
- if ((error = git_repository_config_snapshot(&config_ro, repo)) < 0)
203
+ if (repo && (error = git_repository_config_snapshot(&config_ro, repo)) < 0)
204
204
  return error;
205
205
 
206
206
  remote = git__calloc(1, sizeof(git_remote));
@@ -212,7 +212,11 @@ static int create_internal(git_remote **out, git_repository *repo, const char *n
212
212
  (error = canonicalize_url(&canonical_url, url)) < 0)
213
213
  goto on_error;
214
214
 
215
- remote->url = apply_insteadof(config_ro, canonical_url.ptr, GIT_DIRECTION_FETCH);
215
+ if (repo) {
216
+ remote->url = apply_insteadof(config_ro, canonical_url.ptr, GIT_DIRECTION_FETCH);
217
+ } else {
218
+ remote->url = git__strdup(canonical_url.ptr);
219
+ }
216
220
  GITERR_CHECK_ALLOC(remote->url);
217
221
 
218
222
  if (name != NULL) {
@@ -222,8 +226,9 @@ static int create_internal(git_remote **out, git_repository *repo, const char *n
222
226
  if ((error = git_buf_printf(&var, CONFIG_URL_FMT, name)) < 0)
223
227
  goto on_error;
224
228
 
225
- if ((error = git_repository_config__weakptr(&config_rw, repo)) < 0 ||
226
- (error = git_config_set_string(config_rw, var.ptr, canonical_url.ptr)) < 0)
229
+ if (repo &&
230
+ ((error = git_repository_config__weakptr(&config_rw, repo)) < 0 ||
231
+ (error = git_config_set_string(config_rw, var.ptr, canonical_url.ptr)) < 0))
227
232
  goto on_error;
228
233
  }
229
234
 
@@ -235,7 +240,7 @@ static int create_internal(git_remote **out, git_repository *repo, const char *n
235
240
  if (name && (error = write_add_refspec(repo, name, fetch, true)) < 0)
236
241
  goto on_error;
237
242
 
238
- if ((error = lookup_remote_prune_config(remote, config_ro, name)) < 0)
243
+ if (repo && (error = lookup_remote_prune_config(remote, config_ro, name)) < 0)
239
244
  goto on_error;
240
245
 
241
246
  /* Move the data over to where the matching functions can find them */
@@ -330,6 +335,11 @@ int git_remote_create_anonymous(git_remote **out, git_repository *repo, const ch
330
335
  return create_internal(out, repo, NULL, url, NULL);
331
336
  }
332
337
 
338
+ int git_remote_create_detached(git_remote **out, const char *url)
339
+ {
340
+ return create_internal(out, NULL, NULL, url, NULL);
341
+ }
342
+
333
343
  int git_remote_dup(git_remote **dest, git_remote *source)
334
344
  {
335
345
  size_t i;
@@ -674,7 +684,9 @@ int git_remote_connect(git_remote *remote, git_direction direction, const git_re
674
684
  url = git_remote__urlfordirection(remote, direction);
675
685
  if (url == NULL) {
676
686
  giterr_set(GITERR_INVALID,
677
- "Malformed remote '%s' - missing URL", remote->name);
687
+ "Malformed remote '%s' - missing %s URL",
688
+ remote->name ? remote->name : "(anonymous)",
689
+ direction == GIT_DIRECTION_FETCH ? "fetch" : "push");
678
690
  return -1;
679
691
  }
680
692
 
@@ -859,6 +871,11 @@ int git_remote_download(git_remote *remote, const git_strarray *refspecs, const
859
871
 
860
872
  assert(remote);
861
873
 
874
+ if (!remote->repo) {
875
+ giterr_set(GITERR_INVALID, "cannot download detached remote");
876
+ return -1;
877
+ }
878
+
862
879
  if (opts) {
863
880
  GITERR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
864
881
  cbs = &opts->callbacks;
@@ -1524,6 +1541,20 @@ cleanup:
1524
1541
  return error;
1525
1542
  }
1526
1543
 
1544
+ static int truncate_fetch_head(const char *gitdir)
1545
+ {
1546
+ git_buf path = GIT_BUF_INIT;
1547
+ int error;
1548
+
1549
+ if ((error = git_buf_joinpath(&path, gitdir, GIT_FETCH_HEAD_FILE)) < 0)
1550
+ return error;
1551
+
1552
+ error = git_futils_truncate(path.ptr, GIT_REFS_FILE_MODE);
1553
+ git_buf_free(&path);
1554
+
1555
+ return error;
1556
+ }
1557
+
1527
1558
  int git_remote_update_tips(
1528
1559
  git_remote *remote,
1529
1560
  const git_remote_callbacks *callbacks,
@@ -1554,6 +1585,9 @@ int git_remote_update_tips(
1554
1585
  else
1555
1586
  tagopt = download_tags;
1556
1587
 
1588
+ if ((error = truncate_fetch_head(git_repository_path(remote->repo))) < 0)
1589
+ goto out;
1590
+
1557
1591
  if (tagopt == GIT_REMOTE_DOWNLOAD_TAGS_ALL) {
1558
1592
  if ((error = update_tips_for_spec(remote, callbacks, update_fetchhead, tagopt, &tagspec, &refs, reflog_message)) < 0)
1559
1593
  goto out;
@@ -2344,6 +2378,11 @@ int git_remote_upload(git_remote *remote, const git_strarray *refspecs, const gi
2344
2378
 
2345
2379
  assert(remote);
2346
2380
 
2381
+ if (!remote->repo) {
2382
+ giterr_set(GITERR_INVALID, "cannot download detached remote");
2383
+ return -1;
2384
+ }
2385
+
2347
2386
  if (opts) {
2348
2387
  cbs = &opts->callbacks;
2349
2388
  custom_headers = &opts->custom_headers;
@@ -2403,6 +2442,13 @@ int git_remote_push(git_remote *remote, const git_strarray *refspecs, const git_
2403
2442
  const git_strarray *custom_headers = NULL;
2404
2443
  const git_proxy_options *proxy = NULL;
2405
2444
 
2445
+ assert(remote);
2446
+
2447
+ if (!remote->repo) {
2448
+ giterr_set(GITERR_INVALID, "cannot download detached remote");
2449
+ return -1;
2450
+ }
2451
+
2406
2452
  if (opts) {
2407
2453
  GITERR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
2408
2454
  cbs = &opts->callbacks;
@@ -7,6 +7,8 @@
7
7
  #ifndef INCLUDE_remote_h__
8
8
  #define INCLUDE_remote_h__
9
9
 
10
+ #include "common.h"
11
+
10
12
  #include "git2/remote.h"
11
13
  #include "git2/transport.h"
12
14
  #include "git2/sys/transport.h"
@@ -4,14 +4,15 @@
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
+
8
+ #include "repository.h"
9
+
7
10
  #include <ctype.h>
8
11
 
9
12
  #include "git2/object.h"
10
- #include "git2/refdb.h"
11
13
  #include "git2/sys/repository.h"
12
14
 
13
15
  #include "common.h"
14
- #include "repository.h"
15
16
  #include "commit.h"
16
17
  #include "tag.h"
17
18
  #include "blob.h"
@@ -23,6 +24,7 @@
23
24
  #include "refs.h"
24
25
  #include "filter.h"
25
26
  #include "odb.h"
27
+ #include "refdb.h"
26
28
  #include "remote.h"
27
29
  #include "merge.h"
28
30
  #include "diff_driver.h"
@@ -944,7 +946,7 @@ static int load_config(
944
946
  return error;
945
947
 
946
948
  if ((error = git_repository_item_path(&config_path, repo, GIT_REPOSITORY_ITEM_CONFIG)) == 0)
947
- error = git_config_add_file_ondisk(cfg, config_path.ptr, GIT_CONFIG_LEVEL_LOCAL, 0);
949
+ error = git_config_add_file_ondisk(cfg, config_path.ptr, GIT_CONFIG_LEVEL_LOCAL, repo, 0);
948
950
 
949
951
  if (error && error != GIT_ENOTFOUND)
950
952
  goto on_error;
@@ -953,25 +955,25 @@ static int load_config(
953
955
 
954
956
  if (global_config_path != NULL &&
955
957
  (error = git_config_add_file_ondisk(
956
- cfg, global_config_path, GIT_CONFIG_LEVEL_GLOBAL, 0)) < 0 &&
958
+ cfg, global_config_path, GIT_CONFIG_LEVEL_GLOBAL, repo, 0)) < 0 &&
957
959
  error != GIT_ENOTFOUND)
958
960
  goto on_error;
959
961
 
960
962
  if (xdg_config_path != NULL &&
961
963
  (error = git_config_add_file_ondisk(
962
- cfg, xdg_config_path, GIT_CONFIG_LEVEL_XDG, 0)) < 0 &&
964
+ cfg, xdg_config_path, GIT_CONFIG_LEVEL_XDG, repo, 0)) < 0 &&
963
965
  error != GIT_ENOTFOUND)
964
966
  goto on_error;
965
967
 
966
968
  if (system_config_path != NULL &&
967
969
  (error = git_config_add_file_ondisk(
968
- cfg, system_config_path, GIT_CONFIG_LEVEL_SYSTEM, 0)) < 0 &&
970
+ cfg, system_config_path, GIT_CONFIG_LEVEL_SYSTEM, repo, 0)) < 0 &&
969
971
  error != GIT_ENOTFOUND)
970
972
  goto on_error;
971
973
 
972
974
  if (programdata_path != NULL &&
973
975
  (error = git_config_add_file_ondisk(
974
- cfg, programdata_path, GIT_CONFIG_LEVEL_PROGRAMDATA, 0)) < 0 &&
976
+ cfg, programdata_path, GIT_CONFIG_LEVEL_PROGRAMDATA, repo, 0)) < 0 &&
975
977
  error != GIT_ENOTFOUND)
976
978
  goto on_error;
977
979
 
@@ -1473,7 +1475,7 @@ static int repo_local_config(
1473
1475
  giterr_clear();
1474
1476
 
1475
1477
  if (!(error = git_config_add_file_ondisk(
1476
- parent, cfg_path, GIT_CONFIG_LEVEL_LOCAL, false)))
1478
+ parent, cfg_path, GIT_CONFIG_LEVEL_LOCAL, repo, false)))
1477
1479
  error = git_config_open_level(out, parent, GIT_CONFIG_LEVEL_LOCAL);
1478
1480
  }
1479
1481
 
@@ -2254,7 +2256,7 @@ int git_repository_is_empty(git_repository *repo)
2254
2256
  return is_empty;
2255
2257
  }
2256
2258
 
2257
- int git_repository_item_path(git_buf *out, git_repository *repo, git_repository_item_t item)
2259
+ int git_repository_item_path(git_buf *out, const git_repository *repo, git_repository_item_t item)
2258
2260
  {
2259
2261
  const char *parent;
2260
2262
 
@@ -2294,13 +2296,13 @@ int git_repository_item_path(git_buf *out, git_repository *repo, git_repository_
2294
2296
  return 0;
2295
2297
  }
2296
2298
 
2297
- const char *git_repository_path(git_repository *repo)
2299
+ const char *git_repository_path(const git_repository *repo)
2298
2300
  {
2299
2301
  assert(repo);
2300
2302
  return repo->gitdir;
2301
2303
  }
2302
2304
 
2303
- const char *git_repository_workdir(git_repository *repo)
2305
+ const char *git_repository_workdir(const git_repository *repo)
2304
2306
  {
2305
2307
  assert(repo);
2306
2308
 
@@ -2310,7 +2312,7 @@ const char *git_repository_workdir(git_repository *repo)
2310
2312
  return repo->workdir;
2311
2313
  }
2312
2314
 
2313
- const char *git_repository_commondir(git_repository *repo)
2315
+ const char *git_repository_commondir(const git_repository *repo)
2314
2316
  {
2315
2317
  assert(repo);
2316
2318
  return repo->commondir;
@@ -2360,13 +2362,13 @@ int git_repository_set_workdir(
2360
2362
  return error;
2361
2363
  }
2362
2364
 
2363
- int git_repository_is_bare(git_repository *repo)
2365
+ int git_repository_is_bare(const git_repository *repo)
2364
2366
  {
2365
2367
  assert(repo);
2366
2368
  return repo->is_bare;
2367
2369
  }
2368
2370
 
2369
- int git_repository_is_worktree(git_repository *repo)
2371
+ int git_repository_is_worktree(const git_repository *repo)
2370
2372
  {
2371
2373
  assert(repo);
2372
2374
  return repo->is_worktree;
@@ -7,6 +7,8 @@
7
7
  #ifndef INCLUDE_repository_h__
8
8
  #define INCLUDE_repository_h__
9
9
 
10
+ #include "common.h"
11
+
10
12
  #include "git2/common.h"
11
13
  #include "git2/oid.h"
12
14
  #include "git2/odb.h"
@@ -6,6 +6,7 @@
6
6
  */
7
7
 
8
8
  #include "common.h"
9
+
9
10
  #include "commit.h"
10
11
  #include "tag.h"
11
12
  #include "merge.h"
@@ -20,8 +21,8 @@
20
21
 
21
22
  int git_reset_default(
22
23
  git_repository *repo,
23
- git_object *target,
24
- git_strarray* pathspecs)
24
+ const git_object *target,
25
+ const git_strarray* pathspecs)
25
26
  {
26
27
  git_object *commit = NULL;
27
28
  git_tree *tree = NULL;
@@ -100,7 +101,7 @@ cleanup:
100
101
 
101
102
  static int reset(
102
103
  git_repository *repo,
103
- git_object *target,
104
+ const git_object *target,
104
105
  const char *to,
105
106
  git_reset_t reset_type,
106
107
  const git_checkout_options *checkout_opts)
@@ -182,7 +183,7 @@ cleanup:
182
183
 
183
184
  int git_reset(
184
185
  git_repository *repo,
185
- git_object *target,
186
+ const git_object *target,
186
187
  git_reset_t reset_type,
187
188
  const git_checkout_options *checkout_opts)
188
189
  {
@@ -191,7 +192,7 @@ int git_reset(
191
192
 
192
193
  int git_reset_from_annotated(
193
194
  git_repository *repo,
194
- git_annotated_commit *commit,
195
+ const git_annotated_commit *commit,
195
196
  git_reset_t reset_type,
196
197
  const git_checkout_options *checkout_opts)
197
198
  {
@@ -6,6 +6,7 @@
6
6
  */
7
7
 
8
8
  #include "common.h"
9
+
9
10
  #include "repository.h"
10
11
  #include "filebuf.h"
11
12
  #include "merge.h"
@@ -5,9 +5,10 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
+ #include "common.h"
9
+
8
10
  #include <assert.h>
9
11
 
10
- #include "common.h"
11
12
  #include "buffer.h"
12
13
  #include "tree.h"
13
14
  #include "refdb.h"
@@ -769,7 +770,6 @@ int revparse__ext(
769
770
  }
770
771
 
771
772
  case '@':
772
- {
773
773
  if (spec[pos+1] == '{') {
774
774
  git_object *temp_object = NULL;
775
775
 
@@ -785,10 +785,8 @@ int revparse__ext(
785
785
  if (temp_object != NULL)
786
786
  base_rev = temp_object;
787
787
  break;
788
- } else {
789
- /* Fall through */
790
788
  }
791
- }
789
+ /* fall through */
792
790
 
793
791
  default:
794
792
  if ((error = ensure_left_hand_identifier_is_not_known_yet(base_rev, reference)) < 0)
@@ -5,12 +5,12 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
- #include "common.h"
8
+ #include "revwalk.h"
9
+
9
10
  #include "commit.h"
10
11
  #include "odb.h"
11
12
  #include "pool.h"
12
13
 
13
- #include "revwalk.h"
14
14
  #include "git2/revparse.h"
15
15
  #include "merge.h"
16
16
  #include "vector.h"
@@ -7,6 +7,8 @@
7
7
  #ifndef INCLUDE_revwalk_h__
8
8
  #define INCLUDE_revwalk_h__
9
9
 
10
+ #include "common.h"
11
+
10
12
  #include "git2/revwalk.h"
11
13
  #include "oidmap.h"
12
14
  #include "commit_list.h"
@@ -5,12 +5,13 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
+ #include "common.h"
9
+
8
10
  #ifdef GIT_OPENSSL
9
11
  # include <openssl/err.h>
10
12
  #endif
11
13
 
12
14
  #include <git2.h>
13
- #include "common.h"
14
15
  #include "sysdir.h"
15
16
  #include "cache.h"
16
17
  #include "global.h"
@@ -18,6 +19,7 @@
18
19
  #include "odb.h"
19
20
  #include "refs.h"
20
21
  #include "transports/smart.h"
22
+ #include "streams/openssl.h"
21
23
 
22
24
  void git_libgit2_version(int *major, int *minor, int *rev)
23
25
  {
@@ -171,14 +173,10 @@ int git_libgit2_opts(int key, ...)
171
173
  {
172
174
  const char *file = va_arg(ap, const char *);
173
175
  const char *path = va_arg(ap, const char *);
174
- if (!SSL_CTX_load_verify_locations(git__ssl_ctx, file, path)) {
175
- giterr_set(GITERR_NET, "SSL error: %s",
176
- ERR_error_string(ERR_get_error(), NULL));
177
- error = -1;
178
- }
176
+ error = git_openssl__set_cert_location(file, path);
179
177
  }
180
178
  #else
181
- giterr_set(GITERR_NET, "cannot set certificate locations: OpenSSL is not enabled");
179
+ giterr_set(GITERR_SSL, "TLS backend doesn't support certificate locations");
182
180
  error = -1;
183
181
  #endif
184
182
  break;
@@ -211,7 +209,7 @@ int git_libgit2_opts(int key, ...)
211
209
  }
212
210
  }
213
211
  #else
214
- giterr_set(GITERR_NET, "cannot set custom ciphers: OpenSSL is not enabled");
212
+ giterr_set(GITERR_SSL, "TLS backend doesn't support custom ciphers");
215
213
  error = -1;
216
214
  #endif
217
215
  break;