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,6 +4,9 @@
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 "common.h"
9
+
7
10
  #include "git2.h"
8
11
  #include "git2/odb_backend.h"
9
12
 
@@ -41,7 +44,7 @@ int git_smart__store_refs(transport_smart *t, int flushes)
41
44
 
42
45
  do {
43
46
  if (buf->offset > 0)
44
- error = git_pkt_parse_line(&pkt, &line_end, buf->data, buf->offset);
47
+ error = git_pkt_parse_line(&pkt, buf->data, &line_end, buf->offset);
45
48
  else
46
49
  error = GIT_EBUFS;
47
50
 
@@ -206,15 +209,15 @@ int git_smart__detect_caps(git_pkt_ref *pkt, transport_smart_caps *caps, git_vec
206
209
  return 0;
207
210
  }
208
211
 
209
- static int recv_pkt(git_pkt **out, git_pkt_type *pkt_type, gitno_buffer *buf)
212
+ static int recv_pkt(git_pkt **out, gitno_buffer *buf)
210
213
  {
211
214
  const char *ptr = buf->data, *line_end = ptr;
212
215
  git_pkt *pkt = NULL;
213
- int error = 0, ret;
216
+ int pkt_type, error = 0, ret;
214
217
 
215
218
  do {
216
219
  if (buf->offset > 0)
217
- error = git_pkt_parse_line(&pkt, &line_end, ptr, buf->offset);
220
+ error = git_pkt_parse_line(&pkt, ptr, &line_end, buf->offset);
218
221
  else
219
222
  error = GIT_EBUFS;
220
223
 
@@ -233,14 +236,13 @@ static int recv_pkt(git_pkt **out, git_pkt_type *pkt_type, gitno_buffer *buf)
233
236
  } while (error);
234
237
 
235
238
  gitno_consume(buf, line_end);
236
- if (pkt_type)
237
- *pkt_type = pkt->type;
239
+ pkt_type = pkt->type;
238
240
  if (out != NULL)
239
241
  *out = pkt;
240
242
  else
241
243
  git__free(pkt);
242
244
 
243
- return error;
245
+ return pkt_type;
244
246
  }
245
247
 
246
248
  static int store_common(transport_smart *t)
@@ -250,7 +252,7 @@ static int store_common(transport_smart *t)
250
252
  int error;
251
253
 
252
254
  do {
253
- if ((error = recv_pkt(&pkt, NULL, buf)) < 0)
255
+ if ((error = recv_pkt(&pkt, buf)) < 0)
254
256
  return error;
255
257
 
256
258
  if (pkt->type == GIT_PKT_ACK) {
@@ -318,7 +320,7 @@ static int wait_while_ack(gitno_buffer *buf)
318
320
  while (1) {
319
321
  git__free(pkt);
320
322
 
321
- if ((error = recv_pkt((git_pkt **)&pkt, NULL, buf)) < 0)
323
+ if ((error = recv_pkt((git_pkt **)&pkt, buf)) < 0)
322
324
  return error;
323
325
 
324
326
  if (pkt->type == GIT_PKT_NAK)
@@ -343,8 +345,7 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
343
345
  gitno_buffer *buf = &t->buffer;
344
346
  git_buf data = GIT_BUF_INIT;
345
347
  git_revwalk *walk = NULL;
346
- int error = -1;
347
- git_pkt_type pkt_type;
348
+ int error = -1, pkt_type;
348
349
  unsigned int i;
349
350
  git_oid oid;
350
351
 
@@ -394,13 +395,16 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
394
395
  if ((error = store_common(t)) < 0)
395
396
  goto on_error;
396
397
  } else {
397
- error = recv_pkt(NULL, &pkt_type, buf);
398
- if (error < 0) {
399
- goto on_error;
400
- } else if (pkt_type == GIT_PKT_ACK) {
398
+ pkt_type = recv_pkt(NULL, buf);
399
+
400
+ if (pkt_type == GIT_PKT_ACK) {
401
401
  break;
402
402
  } else if (pkt_type == GIT_PKT_NAK) {
403
403
  continue;
404
+ } else if (pkt_type < 0) {
405
+ /* recv_pkt returned an error */
406
+ error = pkt_type;
407
+ goto on_error;
404
408
  } else {
405
409
  giterr_set(GITERR_NET, "Unexpected pkt type");
406
410
  error = -1;
@@ -466,10 +470,10 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
466
470
 
467
471
  /* Now let's eat up whatever the server gives us */
468
472
  if (!t->caps.multi_ack && !t->caps.multi_ack_detailed) {
469
- error = recv_pkt(NULL, &pkt_type, buf);
473
+ pkt_type = recv_pkt(NULL, buf);
470
474
 
471
- if (error < 0) {
472
- return error;
475
+ if (pkt_type < 0) {
476
+ return pkt_type;
473
477
  } else if (pkt_type != GIT_PKT_ACK && pkt_type != GIT_PKT_NAK) {
474
478
  giterr_set(GITERR_NET, "Unexpected pkt type");
475
479
  return -1;
@@ -590,7 +594,7 @@ int git_smart__download_pack(
590
594
  goto done;
591
595
  }
592
596
 
593
- if ((error = recv_pkt(&pkt, NULL, buf)) >= 0) {
597
+ if ((error = recv_pkt(&pkt, buf)) >= 0) {
594
598
  /* Check cancellation after network call */
595
599
  if (t->cancelled.val) {
596
600
  giterr_clear();
@@ -748,7 +752,7 @@ static int add_push_report_sideband_pkt(git_push *push, git_pkt_data *data_pkt,
748
752
  }
749
753
 
750
754
  while (line_len > 0) {
751
- error = git_pkt_parse_line(&pkt, &line_end, line, line_len);
755
+ error = git_pkt_parse_line(&pkt, line, &line_end, line_len);
752
756
 
753
757
  if (error == GIT_EBUFS) {
754
758
  /* Buffer the data when the inner packet is split
@@ -791,8 +795,8 @@ static int parse_report(transport_smart *transport, git_push *push)
791
795
 
792
796
  for (;;) {
793
797
  if (buf->offset > 0)
794
- error = git_pkt_parse_line(&pkt, &line_end,
795
- buf->data, buf->offset);
798
+ error = git_pkt_parse_line(&pkt, buf->data,
799
+ &line_end, buf->offset);
796
800
  else
797
801
  error = GIT_EBUFS;
798
802
 
@@ -5,6 +5,8 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
+ #include "ssh.h"
9
+
8
10
  #ifdef GIT_SSH
9
11
  #include <libssh2.h>
10
12
  #endif
@@ -15,8 +17,7 @@
15
17
  #include "netops.h"
16
18
  #include "smart.h"
17
19
  #include "cred.h"
18
- #include "socket_stream.h"
19
- #include "ssh.h"
20
+ #include "streams/socket.h"
20
21
 
21
22
  #ifdef GIT_SSH
22
23
 
@@ -63,7 +64,7 @@ static void ssh_error(LIBSSH2_SESSION *session, const char *errmsg)
63
64
  */
64
65
  static int gen_proto(git_buf *request, const char *cmd, const char *url)
65
66
  {
66
- char *repo;
67
+ const char *repo;
67
68
  int len;
68
69
  size_t i;
69
70
 
@@ -91,8 +92,10 @@ done:
91
92
  len = strlen(cmd) + 1 /* Space */ + 1 /* Quote */ + strlen(repo) + 1 /* Quote */ + 1;
92
93
 
93
94
  git_buf_grow(request, len);
94
- git_buf_printf(request, "%s '%s'", cmd, repo);
95
- git_buf_putc(request, '\0');
95
+ git_buf_puts(request, cmd);
96
+ git_buf_puts(request, " '");
97
+ git_buf_decode_percent(request, repo, strlen(repo));
98
+ git_buf_puts(request, "'");
96
99
 
97
100
  if (git_buf_oom(request))
98
101
  return -1;
@@ -418,8 +421,10 @@ static int _git_ssh_authenticate_session(
418
421
  }
419
422
  } while (LIBSSH2_ERROR_EAGAIN == rc || LIBSSH2_ERROR_TIMEOUT == rc);
420
423
 
421
- if (rc == LIBSSH2_ERROR_PASSWORD_EXPIRED || rc == LIBSSH2_ERROR_AUTHENTICATION_FAILED)
422
- return GIT_EAUTH;
424
+ if (rc == LIBSSH2_ERROR_PASSWORD_EXPIRED ||
425
+ rc == LIBSSH2_ERROR_AUTHENTICATION_FAILED ||
426
+ rc == LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED)
427
+ return GIT_EAUTH;
423
428
 
424
429
  if (rc != LIBSSH2_ERROR_NONE) {
425
430
  if (!giterr_last())
@@ -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_ssh_h__
8
- #define INCLUDE_ssh_h__
7
+ #ifndef INCLUDE_transports_ssh_h__
8
+ #define INCLUDE_transports_ssh_h__
9
+
10
+ #include "common.h"
9
11
 
10
12
  int git_transport_ssh_global_init(void);
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 "common.h"
9
+
8
10
  #ifdef GIT_WINHTTP
9
11
 
10
12
  #include "git2.h"
@@ -16,6 +18,7 @@
16
18
  #include "remote.h"
17
19
  #include "repository.h"
18
20
  #include "global.h"
21
+ #include "http.h"
19
22
 
20
23
  #include <wincrypt.h>
21
24
  #include <winhttp.h>
@@ -178,9 +181,15 @@ static int apply_default_credentials(HINTERNET request, int mechanisms)
178
181
  * is "medium" which applies to the intranet and sounds like it would correspond
179
182
  * to Internet Explorer security zones, but in fact does not. */
180
183
  DWORD data = WINHTTP_AUTOLOGON_SECURITY_LEVEL_LOW;
184
+ DWORD native_scheme = 0;
185
+
186
+ if ((mechanisms & GIT_WINHTTP_AUTH_NTLM) != 0)
187
+ native_scheme |= WINHTTP_AUTH_SCHEME_NTLM;
181
188
 
182
- if ((mechanisms & GIT_WINHTTP_AUTH_NTLM) == 0 &&
183
- (mechanisms & GIT_WINHTTP_AUTH_NEGOTIATE) == 0) {
189
+ if ((mechanisms & GIT_WINHTTP_AUTH_NEGOTIATE) != 0)
190
+ native_scheme |= WINHTTP_AUTH_SCHEME_NEGOTIATE;
191
+
192
+ if (!native_scheme) {
184
193
  giterr_set(GITERR_NET, "invalid authentication scheme");
185
194
  return -1;
186
195
  }
@@ -188,6 +197,9 @@ static int apply_default_credentials(HINTERNET request, int mechanisms)
188
197
  if (!WinHttpSetOption(request, WINHTTP_OPTION_AUTOLOGON_POLICY, &data, sizeof(DWORD)))
189
198
  return -1;
190
199
 
200
+ if (!WinHttpSetCredentials(request, WINHTTP_AUTH_TARGET_SERVER, native_scheme, NULL, NULL, NULL))
201
+ return -1;
202
+
191
203
  return 0;
192
204
  }
193
205
 
@@ -275,7 +287,7 @@ static int certificate_check(winhttp_stream *s, int valid)
275
287
  cert.parent.cert_type = GIT_CERT_X509;
276
288
  cert.data = cert_ctx->pbCertEncoded;
277
289
  cert.len = cert_ctx->cbCertEncoded;
278
- error = t->owner->certificate_check_cb((git_cert *) &cert, valid, t->connection_data.host, t->owner->cred_acquire_payload);
290
+ error = t->owner->certificate_check_cb((git_cert *) &cert, valid, t->connection_data.host, t->owner->message_cb_payload);
279
291
  CertFreeCertificateContext(cert_ctx);
280
292
 
281
293
  if (error < 0 && !giterr_last())
@@ -612,12 +624,12 @@ static int parse_unauthorized_response(
612
624
  if (WINHTTP_AUTH_SCHEME_NTLM & supported) {
613
625
  *allowed_types |= GIT_CREDTYPE_USERPASS_PLAINTEXT;
614
626
  *allowed_types |= GIT_CREDTYPE_DEFAULT;
615
- *allowed_mechanisms = GIT_WINHTTP_AUTH_NEGOTIATE;
627
+ *allowed_mechanisms |= GIT_WINHTTP_AUTH_NTLM;
616
628
  }
617
629
 
618
630
  if (WINHTTP_AUTH_SCHEME_NEGOTIATE & supported) {
619
631
  *allowed_types |= GIT_CREDTYPE_DEFAULT;
620
- *allowed_mechanisms = GIT_WINHTTP_AUTH_NEGOTIATE;
632
+ *allowed_mechanisms |= GIT_WINHTTP_AUTH_NEGOTIATE;
621
633
  }
622
634
 
623
635
  if (WINHTTP_AUTH_SCHEME_BASIC & supported) {
@@ -698,21 +710,6 @@ static int winhttp_close_connection(winhttp_subtransport *t)
698
710
  return ret;
699
711
  }
700
712
 
701
- static int user_agent(git_buf *ua)
702
- {
703
- const char *custom = git_libgit2__user_agent();
704
-
705
- git_buf_clear(ua);
706
- git_buf_PUTS(ua, "git/1.0 (");
707
-
708
- if (custom)
709
- git_buf_puts(ua, custom);
710
- else
711
- git_buf_PUTS(ua, "libgit2 " LIBGIT2_VERSION);
712
-
713
- return git_buf_putc(ua, ')');
714
- }
715
-
716
713
  static void CALLBACK winhttp_status(
717
714
  HINTERNET connection,
718
715
  DWORD_PTR ctx,
@@ -773,7 +770,8 @@ static int winhttp_connect(
773
770
  return -1;
774
771
  }
775
772
 
776
- if ((error = user_agent(&ua)) < 0) {
773
+
774
+ if ((error = git_http__user_agent(&ua)) < 0) {
777
775
  git__free(wide_host);
778
776
  return error;
779
777
  }
@@ -6,6 +6,7 @@
6
6
  */
7
7
 
8
8
  #include "tree-cache.h"
9
+
9
10
  #include "pool.h"
10
11
  #include "tree.h"
11
12
 
@@ -9,6 +9,7 @@
9
9
  #define INCLUDE_tree_cache_h__
10
10
 
11
11
  #include "common.h"
12
+
12
13
  #include "pool.h"
13
14
  #include "buffer.h"
14
15
  #include "git2/oid.h"
@@ -5,9 +5,9 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
- #include "common.h"
9
- #include "commit.h"
10
8
  #include "tree.h"
9
+
10
+ #include "commit.h"
11
11
  #include "git2/repository.h"
12
12
  #include "git2/object.h"
13
13
  #include "fileops.h"
@@ -54,7 +54,7 @@ GIT_INLINE(git_filemode_t) normalize_filemode(git_filemode_t filemode)
54
54
  static int valid_entry_name(git_repository *repo, const char *filename)
55
55
  {
56
56
  return *filename != '\0' &&
57
- git_path_isvalid(repo, filename, 0,
57
+ git_path_isvalid(repo, filename,
58
58
  GIT_PATH_REJECT_TRAVERSAL | GIT_PATH_REJECT_DOT_GIT | GIT_PATH_REJECT_SLASH);
59
59
  }
60
60
 
@@ -440,16 +440,16 @@ int git_tree__parse(void *_tree, git_odb_object *odb_obj)
440
440
  unsigned int attr;
441
441
 
442
442
  if (parse_mode(&attr, buffer, &buffer) < 0 || !buffer)
443
- return tree_error("Failed to parse tree. Can't parse filemode", NULL);
443
+ return tree_error("failed to parse tree: can't parse filemode", NULL);
444
444
 
445
445
  if ((nul = memchr(buffer, 0, buffer_end - buffer)) == NULL)
446
- return tree_error("Failed to parse tree. Object is corrupted", NULL);
446
+ return tree_error("failed to parse tree: object is corrupted", NULL);
447
447
 
448
448
  if ((filename_len = nul - buffer) == 0)
449
- return tree_error("Failed to parse tree. Can't parse filename", NULL);
449
+ return tree_error("failed to parse tree: can't parse filename", NULL);
450
450
 
451
451
  if ((buffer_end - (nul + 1)) < GIT_OID_RAWSZ)
452
- return tree_error("Failed to parse tree. Can't parse OID", NULL);
452
+ return tree_error("failed to parse tree: can't parse OID", NULL);
453
453
 
454
454
  /* Allocate the entry */
455
455
  {
@@ -496,7 +496,10 @@ static int append_entry(
496
496
  int error = 0;
497
497
 
498
498
  if (!valid_entry_name(bld->repo, filename))
499
- return tree_error("Failed to insert entry. Invalid name for a tree entry", filename);
499
+ return tree_error("failed to insert entry: invalid name for a tree entry", filename);
500
+
501
+ if (git_oid_iszero(id))
502
+ return tree_error("failed to insert entry: invalid null OID for a tree entry", filename);
500
503
 
501
504
  entry = alloc_entry(filename, strlen(filename), id);
502
505
  GITERR_CHECK_ALLOC(entry);
@@ -735,14 +738,17 @@ int git_treebuilder_insert(
735
738
  assert(bld && id && filename);
736
739
 
737
740
  if (!valid_filemode(filemode))
738
- return tree_error("Failed to insert entry. Invalid filemode for file", filename);
741
+ return tree_error("failed to insert entry: invalid filemode for file", filename);
739
742
 
740
743
  if (!valid_entry_name(bld->repo, filename))
741
- return tree_error("Failed to insert entry. Invalid name for a tree entry", filename);
744
+ return tree_error("failed to insert entry: invalid name for a tree entry", filename);
745
+
746
+ if (git_oid_iszero(id))
747
+ return tree_error("failed to insert entry: invalid null OID", filename);
742
748
 
743
749
  if (filemode != GIT_FILEMODE_COMMIT &&
744
750
  !git_object__is_valid(bld->repo, id, otype_from_mode(filemode)))
745
- return tree_error("Failed to insert entry; invalid object specified", filename);
751
+ return tree_error("failed to insert entry: invalid object specified", filename);
746
752
 
747
753
  pos = git_strmap_lookup_index(bld->map, filename);
748
754
  if (git_strmap_valid_index(bld->map, pos)) {
@@ -793,7 +799,7 @@ int git_treebuilder_remove(git_treebuilder *bld, const char *filename)
793
799
  git_tree_entry *entry = treebuilder_get(bld, filename);
794
800
 
795
801
  if (entry == NULL)
796
- return tree_error("Failed to remove entry. File isn't in the tree", filename);
802
+ return tree_error("failed to remove entry: file isn't in the tree", filename);
797
803
 
798
804
  git_strmap_delete(bld->map, filename);
799
805
  git_tree_entry_free(entry);
@@ -946,12 +952,12 @@ int git_tree_entry_bypath(
946
952
  return GIT_ENOTFOUND;
947
953
  }
948
954
 
949
- /* If there's only a slash left in the path, we
955
+ /* If there's only a slash left in the path, we
950
956
  * return the current entry; otherwise, we keep
951
957
  * walking down the path */
952
958
  if (path[filename_len + 1] != '\0')
953
959
  break;
954
-
960
+ /* fall through */
955
961
  case '\0':
956
962
  /* If there are no more components in the path, return
957
963
  * this entry */
@@ -7,6 +7,8 @@
7
7
  #ifndef INCLUDE_tree_h__
8
8
  #define INCLUDE_tree_h__
9
9
 
10
+ #include "common.h"
11
+
10
12
  #include "git2/tree.h"
11
13
  #include "repository.h"
12
14
  #include "odb.h"
@@ -310,7 +310,6 @@ static ssize_t collapse(void **dst, struct tsort_run *stack, ssize_t stack_curr,
310
310
  #define PUSH_NEXT() do {\
311
311
  len = count_run(dst, curr, size, store);\
312
312
  run = minrun;\
313
- if (run < minrun) run = minrun;\
314
313
  if (run > (ssize_t)size - curr) run = size - curr;\
315
314
  if (run > len) {\
316
315
  bisort(&dst[curr], len, run, cmp, payload);\
@@ -4,7 +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
- #include <git2/common.h>
7
+
8
+ #include "common.h"
9
+
10
+ #include "git2/common.h"
8
11
 
9
12
  #if !defined(GIT_WIN32) && !defined(NO_MMAP)
10
13