rugged 1.7.2 → 1.9.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 (361) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rugged/version.rb +1 -1
  3. data/vendor/libgit2/AUTHORS +1 -0
  4. data/vendor/libgit2/CMakeLists.txt +23 -10
  5. data/vendor/libgit2/COPYING +195 -1
  6. data/vendor/libgit2/cmake/{FindIconv.cmake → FindIntlIconv.cmake} +6 -0
  7. data/vendor/libgit2/cmake/FindLLHTTP.cmake +39 -0
  8. data/vendor/libgit2/cmake/SelectGSSAPI.cmake +1 -1
  9. data/vendor/libgit2/cmake/SelectHTTPParser.cmake +23 -8
  10. data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +17 -8
  11. data/vendor/libgit2/cmake/SelectHashes.cmake +28 -11
  12. data/vendor/libgit2/cmake/SelectRegex.cmake +6 -1
  13. data/vendor/libgit2/cmake/SelectSSH.cmake +22 -17
  14. data/vendor/libgit2/cmake/SelectZlib.cmake +4 -0
  15. data/vendor/libgit2/deps/llhttp/CMakeLists.txt +8 -0
  16. data/vendor/libgit2/deps/llhttp/LICENSE-MIT +22 -0
  17. data/vendor/libgit2/deps/llhttp/api.c +510 -0
  18. data/vendor/libgit2/deps/llhttp/http.c +170 -0
  19. data/vendor/libgit2/deps/llhttp/llhttp.c +10168 -0
  20. data/vendor/libgit2/deps/llhttp/llhttp.h +897 -0
  21. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +1 -1
  22. data/vendor/libgit2/deps/ntlmclient/crypt_builtin_md4.c +311 -0
  23. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +2 -1
  24. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +0 -20
  25. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +4 -4
  26. data/vendor/libgit2/deps/ntlmclient/ntlm.c +21 -21
  27. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +5 -4
  28. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +2 -1
  29. data/vendor/libgit2/deps/ntlmclient/utf8.h +1176 -721
  30. data/vendor/libgit2/deps/ntlmclient/util.h +11 -0
  31. data/vendor/libgit2/deps/pcre/CMakeLists.txt +1 -0
  32. data/vendor/libgit2/deps/xdiff/xmerge.c +2 -2
  33. data/vendor/libgit2/deps/zlib/CMakeLists.txt +6 -1
  34. data/vendor/libgit2/deps/zlib/LICENSE +22 -0
  35. data/vendor/libgit2/deps/zlib/adler32.c +5 -27
  36. data/vendor/libgit2/deps/zlib/crc32.c +94 -167
  37. data/vendor/libgit2/deps/zlib/deflate.c +358 -435
  38. data/vendor/libgit2/deps/zlib/deflate.h +41 -10
  39. data/vendor/libgit2/deps/zlib/gzguts.h +13 -18
  40. data/vendor/libgit2/deps/zlib/infback.c +17 -30
  41. data/vendor/libgit2/deps/zlib/inffast.c +1 -4
  42. data/vendor/libgit2/deps/zlib/inffast.h +1 -1
  43. data/vendor/libgit2/deps/zlib/inflate.c +36 -102
  44. data/vendor/libgit2/deps/zlib/inftrees.c +6 -11
  45. data/vendor/libgit2/deps/zlib/inftrees.h +6 -6
  46. data/vendor/libgit2/deps/zlib/trees.c +287 -352
  47. data/vendor/libgit2/deps/zlib/zconf.h +23 -14
  48. data/vendor/libgit2/deps/zlib/zlib.h +202 -202
  49. data/vendor/libgit2/deps/zlib/zutil.c +18 -44
  50. data/vendor/libgit2/deps/zlib/zutil.h +13 -33
  51. data/vendor/libgit2/include/git2/annotated_commit.h +12 -5
  52. data/vendor/libgit2/include/git2/apply.h +27 -6
  53. data/vendor/libgit2/include/git2/attr.h +17 -4
  54. data/vendor/libgit2/include/git2/blame.h +133 -28
  55. data/vendor/libgit2/include/git2/blob.h +71 -28
  56. data/vendor/libgit2/include/git2/branch.h +22 -15
  57. data/vendor/libgit2/include/git2/buffer.h +6 -4
  58. data/vendor/libgit2/include/git2/cert.h +2 -1
  59. data/vendor/libgit2/include/git2/checkout.h +83 -32
  60. data/vendor/libgit2/include/git2/cherrypick.h +10 -3
  61. data/vendor/libgit2/include/git2/clone.h +25 -9
  62. data/vendor/libgit2/include/git2/commit.h +132 -3
  63. data/vendor/libgit2/include/git2/common.h +120 -63
  64. data/vendor/libgit2/include/git2/config.h +93 -23
  65. data/vendor/libgit2/include/git2/credential.h +30 -2
  66. data/vendor/libgit2/include/git2/credential_helpers.h +1 -0
  67. data/vendor/libgit2/include/git2/deprecated.h +133 -3
  68. data/vendor/libgit2/include/git2/describe.h +13 -1
  69. data/vendor/libgit2/include/git2/diff.h +38 -8
  70. data/vendor/libgit2/include/git2/email.h +9 -29
  71. data/vendor/libgit2/include/git2/errors.h +46 -73
  72. data/vendor/libgit2/include/git2/filter.h +14 -7
  73. data/vendor/libgit2/include/git2/global.h +8 -1
  74. data/vendor/libgit2/include/git2/graph.h +3 -2
  75. data/vendor/libgit2/include/git2/ignore.h +10 -0
  76. data/vendor/libgit2/include/git2/index.h +99 -14
  77. data/vendor/libgit2/include/git2/indexer.h +21 -4
  78. data/vendor/libgit2/include/git2/mailmap.h +7 -1
  79. data/vendor/libgit2/include/git2/merge.h +46 -1
  80. data/vendor/libgit2/include/git2/message.h +2 -2
  81. data/vendor/libgit2/include/git2/net.h +3 -1
  82. data/vendor/libgit2/include/git2/notes.h +9 -6
  83. data/vendor/libgit2/include/git2/object.h +9 -8
  84. data/vendor/libgit2/include/git2/odb.h +91 -49
  85. data/vendor/libgit2/include/git2/odb_backend.h +80 -52
  86. data/vendor/libgit2/include/git2/oid.h +23 -24
  87. data/vendor/libgit2/include/git2/oidarray.h +7 -1
  88. data/vendor/libgit2/include/git2/pack.h +13 -1
  89. data/vendor/libgit2/include/git2/patch.h +2 -3
  90. data/vendor/libgit2/include/git2/pathspec.h +9 -0
  91. data/vendor/libgit2/include/git2/proxy.h +10 -0
  92. data/vendor/libgit2/include/git2/rebase.h +9 -6
  93. data/vendor/libgit2/include/git2/refdb.h +2 -2
  94. data/vendor/libgit2/include/git2/reflog.h +3 -2
  95. data/vendor/libgit2/include/git2/refs.h +9 -6
  96. data/vendor/libgit2/include/git2/refspec.h +14 -4
  97. data/vendor/libgit2/include/git2/remote.h +94 -18
  98. data/vendor/libgit2/include/git2/repository.h +57 -21
  99. data/vendor/libgit2/include/git2/reset.h +16 -3
  100. data/vendor/libgit2/include/git2/revert.h +9 -4
  101. data/vendor/libgit2/include/git2/revparse.h +3 -3
  102. data/vendor/libgit2/include/git2/revwalk.h +3 -2
  103. data/vendor/libgit2/include/git2/signature.h +46 -1
  104. data/vendor/libgit2/include/git2/stash.h +17 -3
  105. data/vendor/libgit2/include/git2/status.h +10 -6
  106. data/vendor/libgit2/include/git2/stdint.h +87 -85
  107. data/vendor/libgit2/include/git2/strarray.h +2 -3
  108. data/vendor/libgit2/include/git2/submodule.h +20 -9
  109. data/vendor/libgit2/include/git2/sys/alloc.h +12 -0
  110. data/vendor/libgit2/include/git2/sys/commit.h +77 -3
  111. data/vendor/libgit2/include/git2/sys/commit_graph.h +103 -62
  112. data/vendor/libgit2/include/git2/sys/config.h +80 -4
  113. data/vendor/libgit2/include/git2/sys/credential.h +4 -3
  114. data/vendor/libgit2/include/git2/sys/diff.h +21 -1
  115. data/vendor/libgit2/include/git2/sys/email.h +7 -0
  116. data/vendor/libgit2/include/git2/sys/errors.h +76 -0
  117. data/vendor/libgit2/include/git2/sys/filter.h +66 -3
  118. data/vendor/libgit2/include/git2/sys/hashsig.h +11 -0
  119. data/vendor/libgit2/include/git2/sys/index.h +3 -2
  120. data/vendor/libgit2/include/git2/sys/mempack.h +32 -2
  121. data/vendor/libgit2/include/git2/sys/merge.h +55 -7
  122. data/vendor/libgit2/include/git2/sys/midx.h +43 -4
  123. data/vendor/libgit2/include/git2/sys/odb_backend.h +7 -3
  124. data/vendor/libgit2/include/git2/sys/openssl.h +8 -1
  125. data/vendor/libgit2/include/git2/sys/path.h +12 -1
  126. data/vendor/libgit2/include/git2/sys/refdb_backend.h +40 -36
  127. data/vendor/libgit2/include/git2/sys/refs.h +3 -2
  128. data/vendor/libgit2/include/git2/sys/remote.h +8 -1
  129. data/vendor/libgit2/include/git2/sys/repository.h +63 -3
  130. data/vendor/libgit2/include/git2/sys/stream.h +11 -2
  131. data/vendor/libgit2/include/git2/sys/transport.h +24 -3
  132. data/vendor/libgit2/include/git2/tag.h +3 -1
  133. data/vendor/libgit2/include/git2/trace.h +9 -3
  134. data/vendor/libgit2/include/git2/transaction.h +3 -2
  135. data/vendor/libgit2/include/git2/transport.h +11 -3
  136. data/vendor/libgit2/include/git2/tree.h +16 -5
  137. data/vendor/libgit2/include/git2/types.h +19 -3
  138. data/vendor/libgit2/include/git2/version.h +44 -8
  139. data/vendor/libgit2/include/git2/worktree.h +16 -6
  140. data/vendor/libgit2/src/CMakeLists.txt +6 -4
  141. data/vendor/libgit2/src/cli/CMakeLists.txt +2 -2
  142. data/vendor/libgit2/src/cli/cmd.c +1 -1
  143. data/vendor/libgit2/src/cli/cmd.h +4 -0
  144. data/vendor/libgit2/src/cli/cmd_blame.c +287 -0
  145. data/vendor/libgit2/src/cli/cmd_cat_file.c +6 -8
  146. data/vendor/libgit2/src/cli/cmd_clone.c +5 -7
  147. data/vendor/libgit2/src/cli/cmd_config.c +241 -0
  148. data/vendor/libgit2/src/cli/cmd_hash_object.c +6 -8
  149. data/vendor/libgit2/src/cli/cmd_help.c +6 -7
  150. data/vendor/libgit2/src/cli/cmd_index_pack.c +114 -0
  151. data/vendor/libgit2/src/cli/cmd_init.c +102 -0
  152. data/vendor/libgit2/src/cli/common.c +168 -0
  153. data/vendor/libgit2/src/cli/common.h +63 -0
  154. data/vendor/libgit2/src/cli/error.h +1 -1
  155. data/vendor/libgit2/src/cli/main.c +52 -24
  156. data/vendor/libgit2/src/cli/opt.c +29 -3
  157. data/vendor/libgit2/src/cli/opt.h +21 -3
  158. data/vendor/libgit2/src/cli/opt_usage.c +102 -33
  159. data/vendor/libgit2/src/cli/opt_usage.h +6 -1
  160. data/vendor/libgit2/src/cli/progress.c +51 -2
  161. data/vendor/libgit2/src/cli/progress.h +12 -0
  162. data/vendor/libgit2/src/cli/unix/sighandler.c +2 -1
  163. data/vendor/libgit2/src/cli/win32/precompiled.h +1 -1
  164. data/vendor/libgit2/src/cli/win32/sighandler.c +1 -1
  165. data/vendor/libgit2/src/libgit2/CMakeLists.txt +26 -8
  166. data/vendor/libgit2/src/libgit2/apply.c +10 -13
  167. data/vendor/libgit2/src/libgit2/attr.c +30 -13
  168. data/vendor/libgit2/src/libgit2/attr_file.c +7 -2
  169. data/vendor/libgit2/src/libgit2/attr_file.h +2 -0
  170. data/vendor/libgit2/src/libgit2/attrcache.c +69 -33
  171. data/vendor/libgit2/src/libgit2/attrcache.h +5 -9
  172. data/vendor/libgit2/src/libgit2/blame.c +130 -44
  173. data/vendor/libgit2/src/libgit2/blame.h +1 -0
  174. data/vendor/libgit2/src/libgit2/cache.c +22 -17
  175. data/vendor/libgit2/src/libgit2/cache.h +7 -9
  176. data/vendor/libgit2/src/libgit2/checkout.c +34 -24
  177. data/vendor/libgit2/src/libgit2/checkout.h +0 -2
  178. data/vendor/libgit2/src/libgit2/cherrypick.c +1 -2
  179. data/vendor/libgit2/src/libgit2/clone.c +186 -166
  180. data/vendor/libgit2/src/libgit2/clone.h +4 -1
  181. data/vendor/libgit2/src/libgit2/commit.c +92 -0
  182. data/vendor/libgit2/src/libgit2/commit_graph.c +67 -56
  183. data/vendor/libgit2/src/libgit2/commit_graph.h +1 -2
  184. data/vendor/libgit2/src/libgit2/config.c +389 -298
  185. data/vendor/libgit2/src/libgit2/config.cmake.in +3 -0
  186. data/vendor/libgit2/src/libgit2/config.h +9 -4
  187. data/vendor/libgit2/src/libgit2/config_backend.h +8 -10
  188. data/vendor/libgit2/src/libgit2/config_cache.c +4 -5
  189. data/vendor/libgit2/src/libgit2/config_file.c +99 -88
  190. data/vendor/libgit2/src/libgit2/config_list.c +285 -0
  191. data/vendor/libgit2/src/libgit2/config_list.h +32 -0
  192. data/vendor/libgit2/src/libgit2/config_mem.c +194 -40
  193. data/vendor/libgit2/src/libgit2/config_parse.c +10 -9
  194. data/vendor/libgit2/src/libgit2/config_snapshot.c +24 -31
  195. data/vendor/libgit2/src/libgit2/describe.c +24 -24
  196. data/vendor/libgit2/src/libgit2/diff.c +1 -1
  197. data/vendor/libgit2/src/libgit2/diff_driver.c +12 -19
  198. data/vendor/libgit2/src/libgit2/diff_driver.h +2 -2
  199. data/vendor/libgit2/src/libgit2/diff_generate.c +3 -3
  200. data/vendor/libgit2/src/libgit2/diff_parse.c +2 -2
  201. data/vendor/libgit2/src/libgit2/diff_print.c +65 -9
  202. data/vendor/libgit2/src/libgit2/diff_tform.c +36 -8
  203. data/vendor/libgit2/src/libgit2/email.c +1 -0
  204. data/vendor/libgit2/src/libgit2/fetch.c +5 -3
  205. data/vendor/libgit2/src/libgit2/filter.c +5 -5
  206. data/vendor/libgit2/src/libgit2/git2.rc +3 -3
  207. data/vendor/libgit2/src/libgit2/grafts.c +18 -20
  208. data/vendor/libgit2/src/libgit2/grafts.h +0 -1
  209. data/vendor/libgit2/src/libgit2/graph.c +1 -1
  210. data/vendor/libgit2/src/libgit2/hashmap_oid.h +30 -0
  211. data/vendor/libgit2/src/libgit2/ignore.c +9 -5
  212. data/vendor/libgit2/src/libgit2/index.c +68 -90
  213. data/vendor/libgit2/src/libgit2/index.h +2 -2
  214. data/vendor/libgit2/src/libgit2/index_map.c +95 -0
  215. data/vendor/libgit2/src/libgit2/index_map.h +28 -0
  216. data/vendor/libgit2/src/libgit2/indexer.c +34 -38
  217. data/vendor/libgit2/src/libgit2/iterator.c +14 -8
  218. data/vendor/libgit2/src/libgit2/libgit2.c +153 -368
  219. data/vendor/libgit2/src/libgit2/mailmap.c +1 -1
  220. data/vendor/libgit2/src/libgit2/merge.c +42 -37
  221. data/vendor/libgit2/src/libgit2/merge_driver.c +2 -2
  222. data/vendor/libgit2/src/libgit2/midx.c +28 -15
  223. data/vendor/libgit2/src/libgit2/mwindow.c +38 -45
  224. data/vendor/libgit2/src/libgit2/mwindow.h +4 -0
  225. data/vendor/libgit2/src/libgit2/object.c +6 -5
  226. data/vendor/libgit2/src/libgit2/odb.c +5 -4
  227. data/vendor/libgit2/src/libgit2/odb_mempack.c +49 -17
  228. data/vendor/libgit2/src/libgit2/odb_pack.c +13 -5
  229. data/vendor/libgit2/src/libgit2/oid.c +32 -5
  230. data/vendor/libgit2/src/libgit2/oid.h +11 -0
  231. data/vendor/libgit2/src/libgit2/pack-objects.c +58 -31
  232. data/vendor/libgit2/src/libgit2/pack-objects.h +12 -4
  233. data/vendor/libgit2/src/libgit2/pack.c +30 -24
  234. data/vendor/libgit2/src/libgit2/pack.h +15 -10
  235. data/vendor/libgit2/src/libgit2/patch_parse.c +2 -2
  236. data/vendor/libgit2/src/libgit2/path.c +1 -1
  237. data/vendor/libgit2/src/libgit2/pathspec.c +1 -1
  238. data/vendor/libgit2/src/libgit2/push.c +79 -28
  239. data/vendor/libgit2/src/libgit2/push.h +1 -0
  240. data/vendor/libgit2/src/libgit2/refdb_fs.c +128 -61
  241. data/vendor/libgit2/src/libgit2/reflog.c +1 -2
  242. data/vendor/libgit2/src/libgit2/reflog.h +2 -0
  243. data/vendor/libgit2/src/libgit2/refs.c +26 -7
  244. data/vendor/libgit2/src/libgit2/refs.h +6 -1
  245. data/vendor/libgit2/src/libgit2/refspec.c +28 -1
  246. data/vendor/libgit2/src/libgit2/refspec.h +8 -0
  247. data/vendor/libgit2/src/libgit2/remote.c +121 -61
  248. data/vendor/libgit2/src/libgit2/repository.c +231 -51
  249. data/vendor/libgit2/src/libgit2/repository.h +10 -6
  250. data/vendor/libgit2/src/libgit2/revert.c +1 -2
  251. data/vendor/libgit2/src/libgit2/revparse.c +2 -2
  252. data/vendor/libgit2/src/libgit2/revwalk.c +13 -10
  253. data/vendor/libgit2/src/libgit2/revwalk.h +3 -3
  254. data/vendor/libgit2/src/libgit2/settings.c +468 -0
  255. data/vendor/libgit2/src/libgit2/settings.h +6 -2
  256. data/vendor/libgit2/src/libgit2/signature.c +132 -15
  257. data/vendor/libgit2/src/libgit2/signature.h +0 -1
  258. data/vendor/libgit2/src/libgit2/status.c +1 -1
  259. data/vendor/libgit2/src/libgit2/streams/mbedtls.c +54 -60
  260. data/vendor/libgit2/src/libgit2/streams/openssl.c +32 -7
  261. data/vendor/libgit2/src/libgit2/streams/openssl.h +2 -0
  262. data/vendor/libgit2/src/libgit2/streams/openssl_dynamic.c +4 -0
  263. data/vendor/libgit2/src/libgit2/streams/openssl_dynamic.h +3 -0
  264. data/vendor/libgit2/src/libgit2/streams/stransport.c +39 -7
  265. data/vendor/libgit2/src/libgit2/submodule.c +106 -63
  266. data/vendor/libgit2/src/libgit2/submodule.h +6 -7
  267. data/vendor/libgit2/src/libgit2/tag.c +1 -1
  268. data/vendor/libgit2/src/libgit2/trailer.c +6 -6
  269. data/vendor/libgit2/src/libgit2/transaction.c +26 -20
  270. data/vendor/libgit2/src/libgit2/transaction.h +4 -1
  271. data/vendor/libgit2/src/libgit2/transport.c +4 -1
  272. data/vendor/libgit2/src/libgit2/transports/credential.c +1 -1
  273. data/vendor/libgit2/src/libgit2/transports/http.c +1 -2
  274. data/vendor/libgit2/src/libgit2/transports/http.h +0 -10
  275. data/vendor/libgit2/src/libgit2/transports/httpclient.c +112 -72
  276. data/vendor/libgit2/src/libgit2/transports/httpparser.c +128 -0
  277. data/vendor/libgit2/src/libgit2/transports/httpparser.h +99 -0
  278. data/vendor/libgit2/src/libgit2/transports/local.c +8 -7
  279. data/vendor/libgit2/src/libgit2/transports/smart.c +20 -8
  280. data/vendor/libgit2/src/libgit2/transports/smart.h +4 -2
  281. data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +2 -2
  282. data/vendor/libgit2/src/libgit2/transports/smart_protocol.c +55 -10
  283. data/vendor/libgit2/src/libgit2/transports/ssh.c +41 -1103
  284. data/vendor/libgit2/src/libgit2/transports/ssh_exec.c +347 -0
  285. data/vendor/libgit2/src/libgit2/transports/ssh_exec.h +26 -0
  286. data/vendor/libgit2/src/libgit2/transports/ssh_libssh2.c +1126 -0
  287. data/vendor/libgit2/src/libgit2/transports/ssh_libssh2.h +28 -0
  288. data/vendor/libgit2/src/libgit2/transports/winhttp.c +35 -7
  289. data/vendor/libgit2/src/libgit2/tree.c +34 -26
  290. data/vendor/libgit2/src/libgit2/tree.h +3 -2
  291. data/vendor/libgit2/src/libgit2/worktree.c +14 -17
  292. data/vendor/libgit2/src/util/CMakeLists.txt +4 -6
  293. data/vendor/libgit2/src/util/alloc.c +4 -1
  294. data/vendor/libgit2/src/util/allocators/debugalloc.c +73 -0
  295. data/vendor/libgit2/src/{cli/cli.h → util/allocators/debugalloc.h} +6 -9
  296. data/vendor/libgit2/src/util/allocators/stdalloc.c +0 -10
  297. data/vendor/libgit2/src/util/array.h +18 -17
  298. data/vendor/libgit2/src/util/cc-compat.h +2 -0
  299. data/vendor/libgit2/src/util/ctype_compat.h +70 -0
  300. data/vendor/libgit2/src/util/date.c +22 -14
  301. data/vendor/libgit2/src/util/date.h +12 -0
  302. data/vendor/libgit2/src/util/errors.c +401 -0
  303. data/vendor/libgit2/src/{libgit2 → util}/errors.h +21 -17
  304. data/vendor/libgit2/src/util/fs_path.c +15 -4
  305. data/vendor/libgit2/src/util/fs_path.h +23 -0
  306. data/vendor/libgit2/src/util/futils.c +6 -5
  307. data/vendor/libgit2/src/util/futils.h +13 -4
  308. data/vendor/libgit2/src/util/git2_features.h.in +12 -1
  309. data/vendor/libgit2/src/util/git2_util.h +6 -0
  310. data/vendor/libgit2/src/util/hash/openssl.c +152 -0
  311. data/vendor/libgit2/src/util/hash/openssl.h +17 -1
  312. data/vendor/libgit2/src/util/hash/sha.h +4 -1
  313. data/vendor/libgit2/src/util/hashmap.h +424 -0
  314. data/vendor/libgit2/src/util/hashmap_str.h +43 -0
  315. data/vendor/libgit2/src/util/integer.h +3 -1
  316. data/vendor/libgit2/src/util/net.c +13 -7
  317. data/vendor/libgit2/src/util/net.h +2 -0
  318. data/vendor/libgit2/src/util/pool.c +1 -1
  319. data/vendor/libgit2/src/util/pool.h +5 -0
  320. data/vendor/libgit2/src/util/pqueue.h +1 -1
  321. data/vendor/libgit2/src/util/process.h +222 -0
  322. data/vendor/libgit2/src/util/rand.c +1 -7
  323. data/vendor/libgit2/src/util/regexp.c +1 -1
  324. data/vendor/libgit2/src/util/sortedcache.c +14 -13
  325. data/vendor/libgit2/src/util/sortedcache.h +3 -3
  326. data/vendor/libgit2/src/util/str.c +2 -2
  327. data/vendor/libgit2/src/util/strlist.c +108 -0
  328. data/vendor/libgit2/src/util/strlist.h +36 -0
  329. data/vendor/libgit2/src/util/unix/posix.h +0 -2
  330. data/vendor/libgit2/src/util/unix/process.c +629 -0
  331. data/vendor/libgit2/src/util/unix/realpath.c +23 -5
  332. data/vendor/libgit2/src/util/util.c +2 -2
  333. data/vendor/libgit2/src/util/util.h +4 -38
  334. data/vendor/libgit2/src/util/vector.c +3 -3
  335. data/vendor/libgit2/src/util/vector.h +2 -2
  336. data/vendor/libgit2/src/util/win32/posix_w32.c +29 -6
  337. data/vendor/libgit2/src/util/win32/process.c +506 -0
  338. metadata +45 -28
  339. data/vendor/libgit2/deps/http-parser/CMakeLists.txt +0 -6
  340. data/vendor/libgit2/deps/http-parser/COPYING +0 -23
  341. data/vendor/libgit2/deps/http-parser/http_parser.c +0 -2182
  342. data/vendor/libgit2/deps/http-parser/http_parser.h +0 -305
  343. data/vendor/libgit2/deps/zlib/COPYING +0 -27
  344. data/vendor/libgit2/include/git2/sys/reflog.h +0 -21
  345. data/vendor/libgit2/src/libgit2/config_entries.c +0 -237
  346. data/vendor/libgit2/src/libgit2/config_entries.h +0 -24
  347. data/vendor/libgit2/src/libgit2/errors.c +0 -293
  348. data/vendor/libgit2/src/libgit2/idxmap.c +0 -157
  349. data/vendor/libgit2/src/libgit2/idxmap.h +0 -177
  350. data/vendor/libgit2/src/libgit2/libgit2.h +0 -15
  351. data/vendor/libgit2/src/libgit2/offmap.c +0 -101
  352. data/vendor/libgit2/src/libgit2/offmap.h +0 -133
  353. data/vendor/libgit2/src/libgit2/oidmap.c +0 -107
  354. data/vendor/libgit2/src/libgit2/oidmap.h +0 -128
  355. data/vendor/libgit2/src/libgit2/threadstate.c +0 -97
  356. data/vendor/libgit2/src/libgit2/threadstate.h +0 -22
  357. data/vendor/libgit2/src/libgit2/transports/ssh.h +0 -14
  358. data/vendor/libgit2/src/util/khash.h +0 -615
  359. data/vendor/libgit2/src/util/strmap.c +0 -100
  360. data/vendor/libgit2/src/util/strmap.h +0 -131
  361. /data/vendor/libgit2/cmake/{FindHTTPParser.cmake → FindHTTP_Parser.cmake} +0 -0
@@ -15,7 +15,7 @@
15
15
 
16
16
  /**
17
17
  * @file git2/diff.h
18
- * @brief Git tree and file differencing routines.
18
+ * @brief Indicate the differences between two versions of the repository
19
19
  * @ingroup Git
20
20
  * @{
21
21
  */
@@ -342,6 +342,12 @@ typedef struct {
342
342
  * diff process continues.
343
343
  * - returns 0, the delta is inserted into the diff, and the diff process
344
344
  * continues.
345
+ *
346
+ * @param diff_so_far the diff structure as it currently exists
347
+ * @param delta_to_add the delta that is to be added
348
+ * @param matched_pathspec the pathspec
349
+ * @param payload the user-specified callback payload
350
+ * @return 0 on success, 1 to skip this delta, or an error code
345
351
  */
346
352
  typedef int GIT_CALLBACK(git_diff_notify_cb)(
347
353
  const git_diff *diff_so_far,
@@ -357,7 +363,8 @@ typedef int GIT_CALLBACK(git_diff_notify_cb)(
357
363
  * @param diff_so_far The diff being generated.
358
364
  * @param old_path The path to the old file or NULL.
359
365
  * @param new_path The path to the new file or NULL.
360
- * @return Non-zero to abort the diff.
366
+ * @param payload the user-specified callback payload
367
+ * @return 0 or an error code
361
368
  */
362
369
  typedef int GIT_CALLBACK(git_diff_progress_cb)(
363
370
  const git_diff *diff_so_far,
@@ -463,10 +470,10 @@ typedef struct {
463
470
  const char *new_prefix;
464
471
  } git_diff_options;
465
472
 
466
- /* The current version of the diff options structure */
473
+ /** The current version of the diff options structure */
467
474
  #define GIT_DIFF_OPTIONS_VERSION 1
468
475
 
469
- /* Stack initializer for diff options. Alternatively use
476
+ /** Stack initializer for diff options. Alternatively use
470
477
  * `git_diff_options_init` programmatic initialization.
471
478
  */
472
479
  #define GIT_DIFF_OPTIONS_INIT \
@@ -492,12 +499,14 @@ GIT_EXTERN(int) git_diff_options_init(
492
499
  * @param delta A pointer to the delta data for the file
493
500
  * @param progress Goes from 0 to 1 over the diff
494
501
  * @param payload User-specified pointer from foreach function
502
+ * @return 0 or an error code
495
503
  */
496
504
  typedef int GIT_CALLBACK(git_diff_file_cb)(
497
505
  const git_diff_delta *delta,
498
506
  float progress,
499
507
  void *payload);
500
508
 
509
+ /** Maximum size of the hunk header */
501
510
  #define GIT_DIFF_HUNK_HEADER_SIZE 128
502
511
 
503
512
  /**
@@ -558,6 +567,11 @@ typedef struct {
558
567
  /**
559
568
  * When iterating over a diff, callback that will be made for
560
569
  * binary content within the diff.
570
+ *
571
+ * @param delta the delta
572
+ * @param binary the binary content
573
+ * @param payload the user-specified callback payload
574
+ * @return 0 or an error code
561
575
  */
562
576
  typedef int GIT_CALLBACK(git_diff_binary_cb)(
563
577
  const git_diff_delta *delta,
@@ -584,6 +598,11 @@ typedef struct {
584
598
 
585
599
  /**
586
600
  * When iterating over a diff, callback that will be made per hunk.
601
+ *
602
+ * @param delta the delta
603
+ * @param hunk the hunk
604
+ * @param payload the user-specified callback payload
605
+ * @return 0 or an error code
587
606
  */
588
607
  typedef int GIT_CALLBACK(git_diff_hunk_cb)(
589
608
  const git_diff_delta *delta,
@@ -645,6 +664,12 @@ typedef struct {
645
664
  * When printing a diff, callback that will be made to output each line
646
665
  * of text. This uses some extra GIT_DIFF_LINE_... constants for output
647
666
  * of lines of file and hunk headers.
667
+ *
668
+ * @param delta the delta that contains the line
669
+ * @param hunk the hunk that contains the line
670
+ * @param line the line in the diff
671
+ * @param payload the user-specified callback payload
672
+ * @return 0 or an error code
648
673
  */
649
674
  typedef int GIT_CALLBACK(git_diff_line_cb)(
650
675
  const git_diff_delta *delta, /**< delta that contains this data */
@@ -802,7 +827,10 @@ typedef struct {
802
827
  git_diff_similarity_metric *metric;
803
828
  } git_diff_find_options;
804
829
 
830
+ /** Current version for the `git_diff_find_options` structure */
805
831
  #define GIT_DIFF_FIND_OPTIONS_VERSION 1
832
+
833
+ /** Static constructor for `git_diff_find_options` */
806
834
  #define GIT_DIFF_FIND_OPTIONS_INIT {GIT_DIFF_FIND_OPTIONS_VERSION}
807
835
 
808
836
  /**
@@ -1296,10 +1324,10 @@ typedef struct {
1296
1324
  git_oid_t oid_type;
1297
1325
  } git_diff_parse_options;
1298
1326
 
1299
- /* The current version of the diff parse options structure */
1327
+ /** The current version of the diff parse options structure */
1300
1328
  #define GIT_DIFF_PARSE_OPTIONS_VERSION 1
1301
1329
 
1302
- /* Stack initializer for diff parse options. Alternatively use
1330
+ /** Stack initializer for diff parse options. Alternatively use
1303
1331
  * `git_diff_parse_options_init` programmatic initialization.
1304
1332
  */
1305
1333
  #define GIT_DIFF_PARSE_OPTIONS_INIT \
@@ -1432,7 +1460,10 @@ typedef struct git_diff_patchid_options {
1432
1460
  unsigned int version;
1433
1461
  } git_diff_patchid_options;
1434
1462
 
1463
+ /** Current version for the `git_diff_patchid_options` structure */
1435
1464
  #define GIT_DIFF_PATCHID_OPTIONS_VERSION 1
1465
+
1466
+ /** Static constructor for `git_diff_patchid_options` */
1436
1467
  #define GIT_DIFF_PATCHID_OPTIONS_INIT { GIT_DIFF_PATCHID_OPTIONS_VERSION }
1437
1468
 
1438
1469
  /**
@@ -1470,8 +1501,7 @@ GIT_EXTERN(int) git_diff_patchid_options_init(
1470
1501
  */
1471
1502
  GIT_EXTERN(int) git_diff_patchid(git_oid *out, git_diff *diff, git_diff_patchid_options *opts);
1472
1503
 
1473
- GIT_END_DECL
1474
-
1475
1504
  /** @} */
1505
+ GIT_END_DECL
1476
1506
 
1477
1507
  #endif
@@ -8,10 +8,11 @@
8
8
  #define INCLUDE_git_email_h__
9
9
 
10
10
  #include "common.h"
11
+ #include "diff.h"
11
12
 
12
13
  /**
13
14
  * @file git2/email.h
14
- * @brief Git email formatting and application routines.
15
+ * @brief Produce email-ready patches
15
16
  * @ingroup Git
16
17
  * @{
17
18
  */
@@ -70,11 +71,14 @@ typedef struct {
70
71
  size_t reroll_number;
71
72
  } git_email_create_options;
72
73
 
73
- /*
74
+ /** Current version for the `git_email_create_options` structure */
75
+ #define GIT_EMAIL_CREATE_OPTIONS_VERSION 1
76
+
77
+ /** Static constructor for `git_email_create_options`
78
+ *
74
79
  * By default, our options include rename detection and binary
75
80
  * diffs to match `git format-patch`.
76
81
  */
77
- #define GIT_EMAIL_CREATE_OPTIONS_VERSION 1
78
82
  #define GIT_EMAIL_CREATE_OPTIONS_INIT \
79
83
  { \
80
84
  GIT_EMAIL_CREATE_OPTIONS_VERSION, \
@@ -83,30 +87,6 @@ typedef struct {
83
87
  GIT_DIFF_FIND_OPTIONS_INIT \
84
88
  }
85
89
 
86
- /**
87
- * Create a diff for a commit in mbox format for sending via email.
88
- *
89
- * @param out buffer to store the e-mail patch in
90
- * @param diff the changes to include in the email
91
- * @param patch_idx the patch index
92
- * @param patch_count the total number of patches that will be included
93
- * @param commit_id the commit id for this change
94
- * @param summary the commit message for this change
95
- * @param body optional text to include above the diffstat
96
- * @param author the person who authored this commit
97
- * @param opts email creation options
98
- */
99
- GIT_EXTERN(int) git_email_create_from_diff(
100
- git_buf *out,
101
- git_diff *diff,
102
- size_t patch_idx,
103
- size_t patch_count,
104
- const git_oid *commit_id,
105
- const char *summary,
106
- const char *body,
107
- const git_signature *author,
108
- const git_email_create_options *opts);
109
-
110
90
  /**
111
91
  * Create a diff for a commit in mbox format for sending via email.
112
92
  * The commit must not be a merge commit.
@@ -114,14 +94,14 @@ GIT_EXTERN(int) git_email_create_from_diff(
114
94
  * @param out buffer to store the e-mail patch in
115
95
  * @param commit commit to create a patch for
116
96
  * @param opts email creation options
97
+ * @return 0 or an error code
117
98
  */
118
99
  GIT_EXTERN(int) git_email_create_from_commit(
119
100
  git_buf *out,
120
101
  git_commit *commit,
121
102
  const git_email_create_options *opts);
122
103
 
123
- GIT_END_DECL
124
-
125
104
  /** @} */
105
+ GIT_END_DECL
126
106
 
127
107
  #endif
@@ -11,7 +11,7 @@
11
11
 
12
12
  /**
13
13
  * @file git2/errors.h
14
- * @brief Git error handling routines and variables
14
+ * @brief Error handling routines and variables
15
15
  * @ingroup Git
16
16
  * @{
17
17
  */
@@ -19,25 +19,32 @@ GIT_BEGIN_DECL
19
19
 
20
20
  /** Generic return codes */
21
21
  typedef enum {
22
- GIT_OK = 0, /**< No error */
22
+ /**
23
+ * No error occurred; the call was successful.
24
+ */
25
+ GIT_OK = 0,
26
+
27
+ /**
28
+ * An error occurred; call `git_error_last` for more information.
29
+ */
30
+ GIT_ERROR = -1,
23
31
 
24
- GIT_ERROR = -1, /**< Generic error */
25
- GIT_ENOTFOUND = -3, /**< Requested object could not be found */
26
- GIT_EEXISTS = -4, /**< Object exists preventing operation */
27
- GIT_EAMBIGUOUS = -5, /**< More than one object matches */
28
- GIT_EBUFS = -6, /**< Output buffer too short to hold data */
32
+ GIT_ENOTFOUND = -3, /**< Requested object could not be found. */
33
+ GIT_EEXISTS = -4, /**< Object exists preventing operation. */
34
+ GIT_EAMBIGUOUS = -5, /**< More than one object matches. */
35
+ GIT_EBUFS = -6, /**< Output buffer too short to hold data. */
29
36
 
30
37
  /**
31
38
  * GIT_EUSER is a special error that is never generated by libgit2
32
39
  * code. You can return it from a callback (e.g to stop an iteration)
33
40
  * to know that it was generated by the callback and not by libgit2.
34
41
  */
35
- GIT_EUSER = -7,
42
+ GIT_EUSER = -7,
36
43
 
37
- GIT_EBAREREPO = -8, /**< Operation not allowed on bare repository */
38
- GIT_EUNBORNBRANCH = -9, /**< HEAD refers to branch with no commits */
39
- GIT_EUNMERGED = -10, /**< Merge in progress prevented operation */
40
- GIT_ENONFASTFORWARD = -11, /**< Reference was not fast-forwardable */
44
+ GIT_EBAREREPO = -8, /**< Operation not allowed on bare repository. */
45
+ GIT_EUNBORNBRANCH = -9, /**< HEAD refers to branch with no commits. */
46
+ GIT_EUNMERGED = -10, /**< Merge in progress prevented operation */
47
+ GIT_ENONFASTFORWARD = -11, /**< Reference was not fast-forwardable */
41
48
  GIT_EINVALIDSPEC = -12, /**< Name/ref spec was not in a valid format */
42
49
  GIT_ECONFLICT = -13, /**< Checkout conflicts prevented operation */
43
50
  GIT_ELOCKED = -14, /**< Lock file prevented operation */
@@ -59,21 +66,16 @@ typedef enum {
59
66
  GIT_EINDEXDIRTY = -34, /**< Unsaved changes in the index would be overwritten */
60
67
  GIT_EAPPLYFAIL = -35, /**< Patch application failed */
61
68
  GIT_EOWNER = -36, /**< The object is not owned by the current user */
62
- GIT_TIMEOUT = -37 /**< The operation timed out */
69
+ GIT_TIMEOUT = -37, /**< The operation timed out */
70
+ GIT_EUNCHANGED = -38, /**< There were no changes */
71
+ GIT_ENOTSUPPORTED = -39, /**< An option is not supported */
72
+ GIT_EREADONLY = -40 /**< The subject is read-only */
63
73
  } git_error_code;
64
74
 
65
75
  /**
66
- * Structure to store extra details of the last error that occurred.
67
- *
68
- * This is kept on a per-thread basis if GIT_THREADS was defined when the
69
- * library was build, otherwise one is kept globally for the library
76
+ * Error classes are the category of error. They reflect the area of the
77
+ * code where an error occurred.
70
78
  */
71
- typedef struct {
72
- char *message;
73
- int klass;
74
- } git_error;
75
-
76
- /** Error classes */
77
79
  typedef enum {
78
80
  GIT_ERROR_NONE = 0,
79
81
  GIT_ERROR_NOMEMORY,
@@ -115,67 +117,38 @@ typedef enum {
115
117
  } git_error_t;
116
118
 
117
119
  /**
118
- * Return the last `git_error` object that was generated for the
119
- * current thread.
120
- *
121
- * The default behaviour of this function is to return NULL if no previous error has occurred.
122
- * However, libgit2's error strings are not cleared aggressively, so a prior
123
- * (unrelated) error may be returned. This can be avoided by only calling
124
- * this function if the prior call to a libgit2 API returned an error.
120
+ * Structure to store extra details of the last error that occurred.
125
121
  *
126
- * @return A git_error object.
127
- */
128
- GIT_EXTERN(const git_error *) git_error_last(void);
129
-
130
- /**
131
- * Clear the last library error that occurred for this thread.
122
+ * This is kept on a per-thread basis if GIT_THREADS was defined when the
123
+ * library was build, otherwise one is kept globally for the library
132
124
  */
133
- GIT_EXTERN(void) git_error_clear(void);
125
+ typedef struct {
126
+ char *message; /**< The error message for the last error. */
127
+ int klass; /**< The category of the last error. @type git_error_t */
128
+ } git_error;
134
129
 
135
130
  /**
136
- * Set the error message string for this thread, using `printf`-style
137
- * formatting.
131
+ * Return the last `git_error` object that was generated for the
132
+ * current thread.
138
133
  *
139
- * This function is public so that custom ODB backends and the like can
140
- * relay an error message through libgit2. Most regular users of libgit2
141
- * will never need to call this function -- actually, calling it in most
142
- * circumstances (for example, calling from within a callback function)
143
- * will just end up having the value overwritten by libgit2 internals.
134
+ * This function will never return NULL.
144
135
  *
145
- * This error message is stored in thread-local storage and only applies
146
- * to the particular thread that this libgit2 call is made from.
136
+ * Callers should not rely on this to determine whether an error has
137
+ * occurred. For error checking, callers should examine the return
138
+ * codes of libgit2 functions.
147
139
  *
148
- * @param error_class One of the `git_error_t` enum above describing the
149
- * general subsystem that is responsible for the error.
150
- * @param fmt The `printf`-style format string; subsequent arguments must
151
- * be the arguments for the format string.
152
- */
153
- GIT_EXTERN(void) git_error_set(int error_class, const char *fmt, ...)
154
- GIT_FORMAT_PRINTF(2, 3);
155
-
156
- /**
157
- * Set the error message string for this thread. This function is like
158
- * `git_error_set` but takes a static string instead of a `printf`-style
159
- * format.
140
+ * This call can only reliably report error messages when an error
141
+ * has occurred. (It may contain stale information if it is called
142
+ * after a different function that succeeds.)
160
143
  *
161
- * @param error_class One of the `git_error_t` enum above describing the
162
- * general subsystem that is responsible for the error.
163
- * @param string The error message to keep
164
- * @return 0 on success or -1 on failure
165
- */
166
- GIT_EXTERN(int) git_error_set_str(int error_class, const char *string);
167
-
168
- /**
169
- * Set the error message to a special value for memory allocation failure.
144
+ * The memory for this object is managed by libgit2. It should not
145
+ * be freed.
170
146
  *
171
- * The normal `git_error_set_str()` function attempts to `strdup()` the
172
- * string that is passed in. This is not a good idea when the error in
173
- * question is a memory allocation failure. That circumstance has a
174
- * special setter function that sets the error string to a known and
175
- * statically allocated internal value.
147
+ * @return A pointer to a `git_error` object that describes the error.
176
148
  */
177
- GIT_EXTERN(void) git_error_set_oom(void);
149
+ GIT_EXTERN(const git_error *) git_error_last(void);
178
150
 
179
151
  /** @} */
180
152
  GIT_END_DECL
153
+
181
154
  #endif
@@ -14,9 +14,15 @@
14
14
 
15
15
  /**
16
16
  * @file git2/filter.h
17
- * @brief Git filter APIs
18
- *
17
+ * @brief Filters modify files during checkout or commit
19
18
  * @ingroup Git
19
+ *
20
+ * During checkout, filters update a file from a "canonical" state to
21
+ * a format appropriate for the local filesystem; during commit, filters
22
+ * produce the canonical state. For example, on Windows, the line ending
23
+ * filters _may_ take a canonical state (with Unix-style newlines) in
24
+ * the repository, and place the contents on-disk with Windows-style
25
+ * `\r\n` line endings.
20
26
  * @{
21
27
  */
22
28
  GIT_BEGIN_DECL
@@ -79,8 +85,11 @@ typedef struct {
79
85
  git_oid attr_commit_id;
80
86
  } git_filter_options;
81
87
 
82
- #define GIT_FILTER_OPTIONS_VERSION 1
83
- #define GIT_FILTER_OPTIONS_INIT {GIT_FILTER_OPTIONS_VERSION}
88
+ /** Current version for the `git_filter_options` structure */
89
+ #define GIT_FILTER_OPTIONS_VERSION 1
90
+
91
+ /** Static constructor for `git_filter_options` */
92
+ #define GIT_FILTER_OPTIONS_INIT {GIT_FILTER_OPTIONS_VERSION}
84
93
 
85
94
  /**
86
95
  * A filter that can transform file data
@@ -268,9 +277,7 @@ GIT_EXTERN(int) git_filter_list_stream_blob(
268
277
  */
269
278
  GIT_EXTERN(void) git_filter_list_free(git_filter_list *filters);
270
279
 
271
-
272
- GIT_END_DECL
273
-
274
280
  /** @} */
281
+ GIT_END_DECL
275
282
 
276
283
  #endif
@@ -9,6 +9,12 @@
9
9
 
10
10
  #include "common.h"
11
11
 
12
+ /**
13
+ * @file git2/global.h
14
+ * @brief libgit2 library initializer and shutdown functionality
15
+ * @ingroup Git
16
+ * @{
17
+ */
12
18
  GIT_BEGIN_DECL
13
19
 
14
20
  /**
@@ -32,7 +38,7 @@ GIT_EXTERN(int) git_libgit2_init(void);
32
38
  * many times as `git_libgit2_init()` was called - it will return the
33
39
  * number of remainining initializations that have not been shutdown
34
40
  * (after this one).
35
- *
41
+ *
36
42
  * @return the number of remaining initializations of the library, or an
37
43
  * error code.
38
44
  */
@@ -40,5 +46,6 @@ GIT_EXTERN(int) git_libgit2_shutdown(void);
40
46
 
41
47
  /** @} */
42
48
  GIT_END_DECL
49
+
43
50
  #endif
44
51
 
@@ -13,7 +13,7 @@
13
13
 
14
14
  /**
15
15
  * @file git2/graph.h
16
- * @brief Git graph traversal routines
16
+ * @brief Graph traversal routines
17
17
  * @defgroup git_revwalk Git graph traversal routines
18
18
  * @ingroup Git
19
19
  * @{
@@ -61,8 +61,8 @@ GIT_EXTERN(int) git_graph_descendant_of(
61
61
  *
62
62
  * @param repo the repository where the commits exist
63
63
  * @param commit a previously loaded commit
64
- * @param length the number of commits in the provided `descendant_array`
65
64
  * @param descendant_array oids of the commits
65
+ * @param length the number of commits in the provided `descendant_array`
66
66
  * @return 1 if the given commit is an ancestor of any of the given potential
67
67
  * descendants, 0 if not, error code otherwise.
68
68
  */
@@ -74,4 +74,5 @@ GIT_EXTERN(int) git_graph_reachable_from_any(
74
74
 
75
75
  /** @} */
76
76
  GIT_END_DECL
77
+
77
78
  #endif
@@ -10,6 +10,15 @@
10
10
  #include "common.h"
11
11
  #include "types.h"
12
12
 
13
+ /**
14
+ * @file git2/ignore.h
15
+ * @brief Ignore particular untracked files
16
+ * @ingroup Git
17
+ * @{
18
+ *
19
+ * When examining the repository status, git can optionally ignore
20
+ * specified untracked files.
21
+ */
13
22
  GIT_BEGIN_DECL
14
23
 
15
24
  /**
@@ -73,6 +82,7 @@ GIT_EXTERN(int) git_ignore_path_is_ignored(
73
82
  git_repository *repo,
74
83
  const char *path);
75
84
 
85
+ /** @} */
76
86
  GIT_END_DECL
77
87
 
78
88
  #endif
@@ -15,9 +15,14 @@
15
15
 
16
16
  /**
17
17
  * @file git2/index.h
18
- * @brief Git index parsing and manipulation routines
18
+ * @brief Index (aka "cache" aka "staging area")
19
19
  * @defgroup git_index Git index parsing and manipulation routines
20
20
  * @ingroup Git
21
+ *
22
+ * The index (or "cache", or "staging area") is the contents of the
23
+ * next commit. In addition, the index stores other data, such as
24
+ * conflicts that occurred during the last merge operation, and
25
+ * the "treecache" to speed up various on-disk operations.
21
26
  * @{
22
27
  */
23
28
  GIT_BEGIN_DECL
@@ -77,8 +82,11 @@ typedef struct git_index_entry {
77
82
  * data in the `flags`.
78
83
  */
79
84
 
85
+ /** Mask for name length */
80
86
  #define GIT_INDEX_ENTRY_NAMEMASK (0x0fff)
87
+ /** Mask for index entry stage */
81
88
  #define GIT_INDEX_ENTRY_STAGEMASK (0x3000)
89
+ /** Shift bits for index entry */
82
90
  #define GIT_INDEX_ENTRY_STAGESHIFT 12
83
91
 
84
92
  /**
@@ -89,9 +97,17 @@ typedef enum {
89
97
  GIT_INDEX_ENTRY_VALID = (0x8000)
90
98
  } git_index_entry_flag_t;
91
99
 
100
+ /**
101
+ * Macro to get the stage value (0 for the "main index", or a conflict
102
+ * value) from an index entry.
103
+ */
92
104
  #define GIT_INDEX_ENTRY_STAGE(E) \
93
105
  (((E)->flags & GIT_INDEX_ENTRY_STAGEMASK) >> GIT_INDEX_ENTRY_STAGESHIFT)
94
106
 
107
+ /**
108
+ * Macro to set the stage value (0 for the "main index", or a conflict
109
+ * value) for an index entry.
110
+ */
95
111
  #define GIT_INDEX_ENTRY_STAGE_SET(E,S) do { \
96
112
  (E)->flags = ((E)->flags & ~GIT_INDEX_ENTRY_STAGEMASK) | \
97
113
  (((S) & 0x03) << GIT_INDEX_ENTRY_STAGESHIFT); } while (0)
@@ -131,7 +147,14 @@ typedef enum {
131
147
  } git_index_capability_t;
132
148
 
133
149
 
134
- /** Callback for APIs that add/remove/update files matching pathspec */
150
+ /**
151
+ * Callback for APIs that add/remove/update files matching pathspec
152
+ *
153
+ * @param path the path
154
+ * @param matched_pathspec the given pathspec
155
+ * @param payload the user-specified payload
156
+ * @return 0 to continue with the index operation, positive number to skip this file for the index operation, negative number on failure
157
+ */
135
158
  typedef int GIT_CALLBACK(git_index_matched_path_cb)(
136
159
  const char *path, const char *matched_pathspec, void *payload);
137
160
 
@@ -166,6 +189,74 @@ typedef enum {
166
189
  GIT_INDEX_STAGE_THEIRS = 3
167
190
  } git_index_stage_t;
168
191
 
192
+ #ifdef GIT_EXPERIMENTAL_SHA256
193
+
194
+ /**
195
+ * The options for opening or creating an index.
196
+ *
197
+ * Initialize with `GIT_INDEX_OPTIONS_INIT`. Alternatively, you can
198
+ * use `git_index_options_init`.
199
+ *
200
+ * @options[version] GIT_INDEX_OPTIONS_VERSION
201
+ * @options[init_macro] GIT_INDEX_OPTIONS_INIT
202
+ * @options[init_function] git_index_options_init
203
+ */
204
+ typedef struct git_index_options {
205
+ unsigned int version; /**< The version */
206
+
207
+ /**
208
+ * The object ID type for the object IDs that exist in the index.
209
+ *
210
+ * If this is not specified, this defaults to `GIT_OID_SHA1`.
211
+ */
212
+ git_oid_t oid_type;
213
+ } git_index_options;
214
+
215
+ /** Current version for the `git_index_options` structure */
216
+ #define GIT_INDEX_OPTIONS_VERSION 1
217
+
218
+ /** Static constructor for `git_index_options` */
219
+ #define GIT_INDEX_OPTIONS_INIT { GIT_INDEX_OPTIONS_VERSION }
220
+
221
+ /**
222
+ * Initialize git_index_options structure
223
+ *
224
+ * Initializes a `git_index_options` with default values. Equivalent to creating
225
+ * an instance with GIT_INDEX_OPTIONS_INIT.
226
+ *
227
+ * @param opts The `git_index_options` struct to initialize.
228
+ * @param version The struct version; pass `GIT_INDEX_OPTIONS_VERSION`.
229
+ * @return Zero on success; -1 on failure.
230
+ */
231
+ GIT_EXTERN(int) git_index_options_init(
232
+ git_index_options *opts,
233
+ unsigned int version);
234
+
235
+ /**
236
+ * Creates a new bare Git index object, without a repository to back
237
+ * it. This index object is capable of storing SHA256 objects.
238
+ *
239
+ * @param index_out the pointer for the new index
240
+ * @param index_path the path to the index file in disk
241
+ * @param opts the options for opening the index, or NULL
242
+ * @return 0 or an error code
243
+ */
244
+ GIT_EXTERN(int) git_index_open(
245
+ git_index **index_out,
246
+ const char *index_path,
247
+ const git_index_options *opts);
248
+
249
+ /**
250
+ * Create an in-memory index object.
251
+ *
252
+ * @param index_out the pointer for the new index
253
+ * @param opts the options for opening the index, or NULL
254
+ * @return 0 or an error code
255
+ */
256
+ GIT_EXTERN(int) git_index_new(git_index **index_out, const git_index_options *opts);
257
+
258
+ #else
259
+
169
260
  /**
170
261
  * Create a new bare Git index object as a memory representation
171
262
  * of the Git index file in 'index_path', without a repository
@@ -180,16 +271,11 @@ typedef enum {
180
271
  *
181
272
  * The index must be freed once it's no longer in use.
182
273
  *
183
- * @param out the pointer for the new index
274
+ * @param index_out the pointer for the new index
184
275
  * @param index_path the path to the index file in disk
185
276
  * @return 0 or an error code
186
277
  */
187
-
188
- #ifdef GIT_EXPERIMENTAL_SHA256
189
- GIT_EXTERN(int) git_index_open(git_index **out, const char *index_path, git_oid_t oid_type);
190
- #else
191
- GIT_EXTERN(int) git_index_open(git_index **out, const char *index_path);
192
- #endif
278
+ GIT_EXTERN(int) git_index_open(git_index **index_out, const char *index_path);
193
279
 
194
280
  /**
195
281
  * Create an in-memory index object.
@@ -199,13 +285,11 @@ GIT_EXTERN(int) git_index_open(git_index **out, const char *index_path);
199
285
  *
200
286
  * The index must be freed once it's no longer in use.
201
287
  *
202
- * @param out the pointer for the new index
288
+ * @param index_out the pointer for the new index
203
289
  * @return 0 or an error code
204
290
  */
205
- #ifdef GIT_EXPERIMENTAL_SHA256
206
- GIT_EXTERN(int) git_index_new(git_index **out, git_oid_t oid_type);
207
- #else
208
- GIT_EXTERN(int) git_index_new(git_index **out);
291
+ GIT_EXTERN(int) git_index_new(git_index **index_out);
292
+
209
293
  #endif
210
294
 
211
295
  /**
@@ -845,4 +929,5 @@ GIT_EXTERN(void) git_index_conflict_iterator_free(
845
929
 
846
930
  /** @} */
847
931
  GIT_END_DECL
932
+
848
933
  #endif