rugged 0.27.10.1 → 0.28.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (297) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/extconf.rb +23 -2
  3. data/ext/rugged/rugged.c +48 -2
  4. data/ext/rugged/rugged.h +5 -0
  5. data/ext/rugged/rugged_allocator.c +89 -0
  6. data/ext/rugged/rugged_blob.c +3 -3
  7. data/ext/rugged/rugged_branch.c +1 -1
  8. data/ext/rugged/rugged_commit.c +8 -8
  9. data/ext/rugged/rugged_config.c +1 -1
  10. data/ext/rugged/rugged_diff.c +24 -4
  11. data/ext/rugged/rugged_note.c +1 -1
  12. data/ext/rugged/rugged_repo.c +10 -10
  13. data/ext/rugged/rugged_settings.c +1 -1
  14. data/lib/rugged/version.rb +1 -1
  15. data/vendor/libgit2/CMakeLists.txt +69 -47
  16. data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +15 -1
  17. data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +5 -8
  18. data/vendor/libgit2/cmake/Modules/FindmbedTLS.cmake +93 -0
  19. data/vendor/libgit2/deps/http-parser/CMakeLists.txt +2 -0
  20. data/vendor/libgit2/deps/http-parser/{LICENSE-MIT → COPYING} +0 -0
  21. data/vendor/libgit2/deps/regex/COPYING +502 -0
  22. data/vendor/libgit2/deps/winhttp/COPYING.GPL +993 -0
  23. data/vendor/libgit2/deps/winhttp/COPYING.LGPL +502 -0
  24. data/vendor/libgit2/deps/zlib/CMakeLists.txt +1 -0
  25. data/vendor/libgit2/deps/zlib/COPYING +27 -0
  26. data/vendor/libgit2/include/git2.h +3 -0
  27. data/vendor/libgit2/include/git2/annotated_commit.h +9 -0
  28. data/vendor/libgit2/include/git2/apply.h +129 -0
  29. data/vendor/libgit2/include/git2/attr.h +19 -8
  30. data/vendor/libgit2/include/git2/blame.h +41 -24
  31. data/vendor/libgit2/include/git2/blob.h +1 -1
  32. data/vendor/libgit2/include/git2/branch.h +1 -1
  33. data/vendor/libgit2/include/git2/buffer.h +2 -2
  34. data/vendor/libgit2/include/git2/checkout.h +20 -19
  35. data/vendor/libgit2/include/git2/cherrypick.h +6 -4
  36. data/vendor/libgit2/include/git2/clone.h +11 -9
  37. data/vendor/libgit2/include/git2/commit.h +30 -2
  38. data/vendor/libgit2/include/git2/common.h +54 -4
  39. data/vendor/libgit2/include/git2/config.h +18 -7
  40. data/vendor/libgit2/include/git2/deprecated.h +253 -0
  41. data/vendor/libgit2/include/git2/describe.h +30 -7
  42. data/vendor/libgit2/include/git2/diff.h +193 -143
  43. data/vendor/libgit2/include/git2/errors.h +54 -46
  44. data/vendor/libgit2/include/git2/ignore.h +2 -2
  45. data/vendor/libgit2/include/git2/index.h +72 -51
  46. data/vendor/libgit2/include/git2/indexer.h +30 -4
  47. data/vendor/libgit2/include/git2/mailmap.h +115 -0
  48. data/vendor/libgit2/include/git2/merge.h +29 -8
  49. data/vendor/libgit2/include/git2/net.h +1 -1
  50. data/vendor/libgit2/include/git2/notes.h +1 -1
  51. data/vendor/libgit2/include/git2/object.h +16 -16
  52. data/vendor/libgit2/include/git2/odb.h +10 -10
  53. data/vendor/libgit2/include/git2/odb_backend.h +7 -7
  54. data/vendor/libgit2/include/git2/oid.h +1 -1
  55. data/vendor/libgit2/include/git2/pack.h +2 -2
  56. data/vendor/libgit2/include/git2/proxy.h +9 -5
  57. data/vendor/libgit2/include/git2/rebase.h +7 -4
  58. data/vendor/libgit2/include/git2/refs.h +14 -15
  59. data/vendor/libgit2/include/git2/refspec.h +17 -0
  60. data/vendor/libgit2/include/git2/remote.h +92 -16
  61. data/vendor/libgit2/include/git2/repository.h +52 -37
  62. data/vendor/libgit2/include/git2/revert.h +5 -3
  63. data/vendor/libgit2/include/git2/revwalk.h +7 -7
  64. data/vendor/libgit2/include/git2/signature.h +2 -2
  65. data/vendor/libgit2/include/git2/stash.h +13 -10
  66. data/vendor/libgit2/include/git2/status.h +8 -4
  67. data/vendor/libgit2/include/git2/submodule.h +11 -10
  68. data/vendor/libgit2/include/git2/sys/alloc.h +101 -0
  69. data/vendor/libgit2/include/git2/sys/commit.h +1 -1
  70. data/vendor/libgit2/include/git2/sys/config.h +13 -13
  71. data/vendor/libgit2/include/git2/sys/filter.h +6 -6
  72. data/vendor/libgit2/include/git2/sys/index.h +3 -0
  73. data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
  74. data/vendor/libgit2/include/git2/sys/merge.h +9 -4
  75. data/vendor/libgit2/include/git2/sys/odb_backend.h +19 -19
  76. data/vendor/libgit2/include/git2/sys/path.h +64 -0
  77. data/vendor/libgit2/include/git2/sys/refdb_backend.h +19 -19
  78. data/vendor/libgit2/include/git2/sys/stream.h +92 -12
  79. data/vendor/libgit2/include/git2/sys/transport.h +127 -81
  80. data/vendor/libgit2/include/git2/tag.h +2 -2
  81. data/vendor/libgit2/include/git2/trace.h +1 -1
  82. data/vendor/libgit2/include/git2/transaction.h +1 -0
  83. data/vendor/libgit2/include/git2/transport.h +47 -18
  84. data/vendor/libgit2/include/git2/tree.h +3 -3
  85. data/vendor/libgit2/include/git2/types.h +35 -28
  86. data/vendor/libgit2/include/git2/version.h +4 -4
  87. data/vendor/libgit2/include/git2/worktree.h +47 -12
  88. data/vendor/libgit2/src/CMakeLists.txt +87 -26
  89. data/vendor/libgit2/src/alloc.c +55 -0
  90. data/vendor/libgit2/src/alloc.h +40 -0
  91. data/vendor/libgit2/src/annotated_commit.c +15 -8
  92. data/vendor/libgit2/src/apply.c +490 -14
  93. data/vendor/libgit2/src/apply.h +3 -1
  94. data/vendor/libgit2/src/array.h +2 -2
  95. data/vendor/libgit2/src/attr.c +11 -11
  96. data/vendor/libgit2/src/attr_file.c +20 -15
  97. data/vendor/libgit2/src/attrcache.c +11 -11
  98. data/vendor/libgit2/src/blame.c +30 -15
  99. data/vendor/libgit2/src/blame.h +1 -0
  100. data/vendor/libgit2/src/blame_git.c +16 -13
  101. data/vendor/libgit2/src/blob.c +50 -28
  102. data/vendor/libgit2/src/blob.h +18 -1
  103. data/vendor/libgit2/src/branch.c +38 -38
  104. data/vendor/libgit2/src/buf_text.c +7 -6
  105. data/vendor/libgit2/src/buffer.c +55 -50
  106. data/vendor/libgit2/src/buffer.h +1 -1
  107. data/vendor/libgit2/src/cache.c +16 -16
  108. data/vendor/libgit2/src/cache.h +2 -2
  109. data/vendor/libgit2/src/cc-compat.h +15 -3
  110. data/vendor/libgit2/src/checkout.c +83 -74
  111. data/vendor/libgit2/src/cherrypick.c +6 -6
  112. data/vendor/libgit2/src/clone.c +20 -20
  113. data/vendor/libgit2/src/commit.c +53 -33
  114. data/vendor/libgit2/src/commit.h +1 -0
  115. data/vendor/libgit2/src/commit_list.c +6 -10
  116. data/vendor/libgit2/src/common.h +32 -30
  117. data/vendor/libgit2/src/config.c +167 -147
  118. data/vendor/libgit2/src/config.h +1 -14
  119. data/vendor/libgit2/src/config_backend.h +84 -0
  120. data/vendor/libgit2/src/config_cache.c +7 -1
  121. data/vendor/libgit2/src/config_entries.c +259 -0
  122. data/vendor/libgit2/src/config_entries.h +23 -0
  123. data/vendor/libgit2/src/config_file.c +167 -439
  124. data/vendor/libgit2/src/config_mem.c +224 -0
  125. data/vendor/libgit2/src/config_parse.c +69 -38
  126. data/vendor/libgit2/src/config_parse.h +4 -4
  127. data/vendor/libgit2/src/crlf.c +215 -186
  128. data/vendor/libgit2/src/delta.c +25 -18
  129. data/vendor/libgit2/src/describe.c +23 -23
  130. data/vendor/libgit2/src/diff.c +12 -12
  131. data/vendor/libgit2/src/diff_driver.c +14 -15
  132. data/vendor/libgit2/src/diff_file.c +10 -10
  133. data/vendor/libgit2/src/diff_generate.c +29 -23
  134. data/vendor/libgit2/src/diff_generate.h +1 -1
  135. data/vendor/libgit2/src/diff_parse.c +3 -3
  136. data/vendor/libgit2/src/diff_print.c +17 -17
  137. data/vendor/libgit2/src/diff_stats.c +22 -7
  138. data/vendor/libgit2/src/diff_tform.c +12 -12
  139. data/vendor/libgit2/src/diff_xdiff.c +15 -3
  140. data/vendor/libgit2/src/errors.c +42 -20
  141. data/vendor/libgit2/src/features.h.in +2 -1
  142. data/vendor/libgit2/src/fetch.c +3 -3
  143. data/vendor/libgit2/src/fetchhead.c +16 -16
  144. data/vendor/libgit2/src/filebuf.c +28 -28
  145. data/vendor/libgit2/src/fileops.c +54 -54
  146. data/vendor/libgit2/src/fileops.h +1 -1
  147. data/vendor/libgit2/src/filter.c +30 -30
  148. data/vendor/libgit2/src/filter.h +0 -10
  149. data/vendor/libgit2/src/global.c +36 -23
  150. data/vendor/libgit2/src/hash.h +4 -1
  151. data/vendor/libgit2/src/hash/hash_collisiondetect.h +6 -2
  152. data/vendor/libgit2/src/hash/hash_common_crypto.h +5 -1
  153. data/vendor/libgit2/src/hash/hash_generic.h +5 -1
  154. data/vendor/libgit2/src/hash/hash_mbedtls.c +38 -0
  155. data/vendor/libgit2/src/hash/hash_mbedtls.h +24 -0
  156. data/vendor/libgit2/src/hash/hash_openssl.h +8 -4
  157. data/vendor/libgit2/src/hash/hash_win32.c +13 -13
  158. data/vendor/libgit2/src/hashsig.c +4 -4
  159. data/vendor/libgit2/src/idxmap.c +25 -5
  160. data/vendor/libgit2/src/idxmap.h +4 -18
  161. data/vendor/libgit2/src/ignore.c +9 -9
  162. data/vendor/libgit2/src/index.c +280 -198
  163. data/vendor/libgit2/src/index.h +16 -0
  164. data/vendor/libgit2/src/indexer.c +311 -139
  165. data/vendor/libgit2/src/integer.h +32 -22
  166. data/vendor/libgit2/src/iterator.c +116 -49
  167. data/vendor/libgit2/src/iterator.h +15 -0
  168. data/vendor/libgit2/src/khash.h +3 -1
  169. data/vendor/libgit2/src/mailmap.c +485 -0
  170. data/vendor/libgit2/src/mailmap.h +35 -0
  171. data/vendor/libgit2/src/merge.c +89 -59
  172. data/vendor/libgit2/src/merge_driver.c +7 -7
  173. data/vendor/libgit2/src/merge_file.c +1 -1
  174. data/vendor/libgit2/src/mwindow.c +8 -8
  175. data/vendor/libgit2/src/netops.c +22 -13
  176. data/vendor/libgit2/src/netops.h +2 -0
  177. data/vendor/libgit2/src/notes.c +15 -10
  178. data/vendor/libgit2/src/object.c +118 -67
  179. data/vendor/libgit2/src/object.h +20 -9
  180. data/vendor/libgit2/src/object_api.c +8 -8
  181. data/vendor/libgit2/src/odb.c +72 -72
  182. data/vendor/libgit2/src/odb.h +7 -7
  183. data/vendor/libgit2/src/odb_loose.c +46 -46
  184. data/vendor/libgit2/src/odb_mempack.c +14 -14
  185. data/vendor/libgit2/src/odb_pack.c +14 -10
  186. data/vendor/libgit2/src/offmap.c +30 -0
  187. data/vendor/libgit2/src/offmap.h +20 -11
  188. data/vendor/libgit2/src/oid.c +6 -6
  189. data/vendor/libgit2/src/oidmap.c +20 -0
  190. data/vendor/libgit2/src/oidmap.h +9 -12
  191. data/vendor/libgit2/src/pack-objects.c +71 -63
  192. data/vendor/libgit2/src/pack-objects.h +1 -7
  193. data/vendor/libgit2/src/pack.c +58 -58
  194. data/vendor/libgit2/src/pack.h +6 -6
  195. data/vendor/libgit2/src/parse.h +1 -1
  196. data/vendor/libgit2/src/patch.c +3 -3
  197. data/vendor/libgit2/src/patch_generate.c +18 -18
  198. data/vendor/libgit2/src/patch_parse.c +13 -13
  199. data/vendor/libgit2/src/path.c +93 -225
  200. data/vendor/libgit2/src/path.h +2 -84
  201. data/vendor/libgit2/src/pathspec.c +6 -6
  202. data/vendor/libgit2/src/posix.c +3 -3
  203. data/vendor/libgit2/src/proxy.c +1 -1
  204. data/vendor/libgit2/src/push.c +27 -26
  205. data/vendor/libgit2/src/push.h +2 -1
  206. data/vendor/libgit2/src/reader.c +265 -0
  207. data/vendor/libgit2/src/reader.h +107 -0
  208. data/vendor/libgit2/src/rebase.c +49 -52
  209. data/vendor/libgit2/src/refdb.c +3 -3
  210. data/vendor/libgit2/src/refdb_fs.c +181 -103
  211. data/vendor/libgit2/src/reflog.c +3 -3
  212. data/vendor/libgit2/src/refs.c +98 -74
  213. data/vendor/libgit2/src/refs.h +5 -3
  214. data/vendor/libgit2/src/refspec.c +47 -21
  215. data/vendor/libgit2/src/refspec.h +1 -1
  216. data/vendor/libgit2/src/remote.c +219 -166
  217. data/vendor/libgit2/src/remote.h +9 -0
  218. data/vendor/libgit2/src/repository.c +173 -133
  219. data/vendor/libgit2/src/repository.h +6 -3
  220. data/vendor/libgit2/src/reset.c +8 -8
  221. data/vendor/libgit2/src/revert.c +6 -6
  222. data/vendor/libgit2/src/revparse.c +30 -30
  223. data/vendor/libgit2/src/revwalk.c +60 -30
  224. data/vendor/libgit2/src/revwalk.h +2 -1
  225. data/vendor/libgit2/src/settings.c +42 -10
  226. data/vendor/libgit2/src/signature.c +11 -11
  227. data/vendor/libgit2/src/sortedcache.c +13 -13
  228. data/vendor/libgit2/src/stash.c +91 -45
  229. data/vendor/libgit2/src/status.c +13 -13
  230. data/vendor/libgit2/src/stdalloc.c +120 -0
  231. data/vendor/libgit2/src/{streams/curl.h → stdalloc.h} +6 -6
  232. data/vendor/libgit2/src/stream.h +17 -2
  233. data/vendor/libgit2/src/streams/mbedtls.c +483 -0
  234. data/vendor/libgit2/src/streams/mbedtls.h +23 -0
  235. data/vendor/libgit2/src/streams/openssl.c +204 -114
  236. data/vendor/libgit2/src/streams/openssl.h +4 -108
  237. data/vendor/libgit2/src/streams/registry.c +118 -0
  238. data/vendor/libgit2/src/streams/registry.h +19 -0
  239. data/vendor/libgit2/src/streams/socket.c +54 -29
  240. data/vendor/libgit2/src/streams/stransport.c +57 -32
  241. data/vendor/libgit2/src/streams/stransport.h +5 -0
  242. data/vendor/libgit2/src/streams/tls.c +50 -19
  243. data/vendor/libgit2/src/streams/tls.h +12 -4
  244. data/vendor/libgit2/src/strmap.c +22 -2
  245. data/vendor/libgit2/src/strmap.h +18 -15
  246. data/vendor/libgit2/src/submodule.c +179 -155
  247. data/vendor/libgit2/src/sysdir.c +18 -18
  248. data/vendor/libgit2/src/tag.c +31 -26
  249. data/vendor/libgit2/src/tag.h +2 -1
  250. data/vendor/libgit2/src/trace.c +1 -1
  251. data/vendor/libgit2/src/trace.h +1 -1
  252. data/vendor/libgit2/src/trailer.c +6 -6
  253. data/vendor/libgit2/src/transaction.c +23 -23
  254. data/vendor/libgit2/src/transport.c +5 -5
  255. data/vendor/libgit2/src/transports/auth.c +7 -4
  256. data/vendor/libgit2/src/transports/auth.h +1 -1
  257. data/vendor/libgit2/src/transports/auth_negotiate.c +12 -11
  258. data/vendor/libgit2/src/transports/cred.c +18 -18
  259. data/vendor/libgit2/src/transports/git.c +15 -15
  260. data/vendor/libgit2/src/transports/http.c +606 -216
  261. data/vendor/libgit2/src/transports/http.h +2 -0
  262. data/vendor/libgit2/src/transports/local.c +26 -26
  263. data/vendor/libgit2/src/transports/smart.c +54 -31
  264. data/vendor/libgit2/src/transports/smart.h +1 -2
  265. data/vendor/libgit2/src/transports/smart_pkt.c +43 -40
  266. data/vendor/libgit2/src/transports/smart_protocol.c +61 -57
  267. data/vendor/libgit2/src/transports/ssh.c +34 -33
  268. data/vendor/libgit2/src/transports/winhttp.c +99 -119
  269. data/vendor/libgit2/src/tree-cache.c +5 -5
  270. data/vendor/libgit2/src/tree.c +96 -121
  271. data/vendor/libgit2/src/tree.h +1 -12
  272. data/vendor/libgit2/src/unix/map.c +2 -2
  273. data/vendor/libgit2/src/util.c +22 -6
  274. data/vendor/libgit2/src/util.h +12 -135
  275. data/vendor/libgit2/src/vector.c +4 -4
  276. data/vendor/libgit2/src/win32/dir.c +3 -3
  277. data/vendor/libgit2/src/win32/findfile.c +3 -3
  278. data/vendor/libgit2/src/win32/map.c +6 -6
  279. data/vendor/libgit2/src/win32/msvc-compat.h +6 -0
  280. data/vendor/libgit2/src/win32/path_w32.c +101 -7
  281. data/vendor/libgit2/src/win32/path_w32.h +18 -0
  282. data/vendor/libgit2/src/win32/posix_w32.c +24 -43
  283. data/vendor/libgit2/src/win32/w32_buffer.c +2 -2
  284. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +96 -2
  285. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +28 -75
  286. data/vendor/libgit2/src/win32/w32_stack.c +2 -2
  287. data/vendor/libgit2/src/win32/w32_util.c +1 -69
  288. data/vendor/libgit2/src/win32/w32_util.h +1 -19
  289. data/vendor/libgit2/src/worktree.c +75 -54
  290. data/vendor/libgit2/src/worktree.h +2 -0
  291. data/vendor/libgit2/src/xdiff/xdiffi.c +7 -5
  292. data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
  293. data/vendor/libgit2/src/xdiff/xmerge.c +15 -15
  294. data/vendor/libgit2/src/zstream.c +4 -4
  295. metadata +33 -7
  296. data/vendor/libgit2/src/config_file.h +0 -73
  297. data/vendor/libgit2/src/streams/curl.c +0 -385
@@ -27,7 +27,8 @@ typedef enum {
27
27
  GIT_EAMBIGUOUS = -5, /**< More than one object matches */
28
28
  GIT_EBUFS = -6, /**< Output buffer too short to hold data */
29
29
 
30
- /* GIT_EUSER is a special error that is never generated by libgit2
30
+ /**
31
+ * GIT_EUSER is a special error that is never generated by libgit2
31
32
  * code. You can return it from a callback (e.g to stop an iteration)
32
33
  * to know that it was generated by the callback and not by libgit2.
33
34
  */
@@ -51,10 +52,12 @@ typedef enum {
51
52
  GIT_EDIRECTORY = -23, /**< The operation is not valid for a directory */
52
53
  GIT_EMERGECONFLICT = -24, /**< A merge conflict exists and cannot continue */
53
54
 
54
- GIT_PASSTHROUGH = -30, /**< Internal only */
55
+ GIT_PASSTHROUGH = -30, /**< A user-configured callback refused to act */
55
56
  GIT_ITEROVER = -31, /**< Signals end of iteration with iterator */
56
57
  GIT_RETRY = -32, /**< Internal only */
57
58
  GIT_EMISMATCH = -33, /**< Hashsum mismatch in object */
59
+ GIT_EINDEXDIRTY = -34, /**< Unsaved changes in the index would be overwritten */
60
+ GIT_EAPPLYFAIL = -35, /**< Patch application failed */
58
61
  } git_error_code;
59
62
 
60
63
  /**
@@ -70,54 +73,59 @@ typedef struct {
70
73
 
71
74
  /** Error classes */
72
75
  typedef enum {
73
- GITERR_NONE = 0,
74
- GITERR_NOMEMORY,
75
- GITERR_OS,
76
- GITERR_INVALID,
77
- GITERR_REFERENCE,
78
- GITERR_ZLIB,
79
- GITERR_REPOSITORY,
80
- GITERR_CONFIG,
81
- GITERR_REGEX,
82
- GITERR_ODB,
83
- GITERR_INDEX,
84
- GITERR_OBJECT,
85
- GITERR_NET,
86
- GITERR_TAG,
87
- GITERR_TREE,
88
- GITERR_INDEXER,
89
- GITERR_SSL,
90
- GITERR_SUBMODULE,
91
- GITERR_THREAD,
92
- GITERR_STASH,
93
- GITERR_CHECKOUT,
94
- GITERR_FETCHHEAD,
95
- GITERR_MERGE,
96
- GITERR_SSH,
97
- GITERR_FILTER,
98
- GITERR_REVERT,
99
- GITERR_CALLBACK,
100
- GITERR_CHERRYPICK,
101
- GITERR_DESCRIBE,
102
- GITERR_REBASE,
103
- GITERR_FILESYSTEM,
104
- GITERR_PATCH,
105
- GITERR_WORKTREE,
106
- GITERR_SHA1
76
+ GIT_ERROR_NONE = 0,
77
+ GIT_ERROR_NOMEMORY,
78
+ GIT_ERROR_OS,
79
+ GIT_ERROR_INVALID,
80
+ GIT_ERROR_REFERENCE,
81
+ GIT_ERROR_ZLIB,
82
+ GIT_ERROR_REPOSITORY,
83
+ GIT_ERROR_CONFIG,
84
+ GIT_ERROR_REGEX,
85
+ GIT_ERROR_ODB,
86
+ GIT_ERROR_INDEX,
87
+ GIT_ERROR_OBJECT,
88
+ GIT_ERROR_NET,
89
+ GIT_ERROR_TAG,
90
+ GIT_ERROR_TREE,
91
+ GIT_ERROR_INDEXER,
92
+ GIT_ERROR_SSL,
93
+ GIT_ERROR_SUBMODULE,
94
+ GIT_ERROR_THREAD,
95
+ GIT_ERROR_STASH,
96
+ GIT_ERROR_CHECKOUT,
97
+ GIT_ERROR_FETCHHEAD,
98
+ GIT_ERROR_MERGE,
99
+ GIT_ERROR_SSH,
100
+ GIT_ERROR_FILTER,
101
+ GIT_ERROR_REVERT,
102
+ GIT_ERROR_CALLBACK,
103
+ GIT_ERROR_CHERRYPICK,
104
+ GIT_ERROR_DESCRIBE,
105
+ GIT_ERROR_REBASE,
106
+ GIT_ERROR_FILESYSTEM,
107
+ GIT_ERROR_PATCH,
108
+ GIT_ERROR_WORKTREE,
109
+ GIT_ERROR_SHA1
107
110
  } git_error_t;
108
111
 
109
112
  /**
110
113
  * Return the last `git_error` object that was generated for the
111
- * current thread or NULL if no error has occurred.
114
+ * current thread.
115
+ *
116
+ * The default behaviour of this function is to return NULL if no previous error has occurred.
117
+ * However, libgit2's error strings are not cleared aggressively, so a prior
118
+ * (unrelated) error may be returned. This can be avoided by only calling
119
+ * this function if the prior call to a libgit2 API returned an error.
112
120
  *
113
121
  * @return A git_error object.
114
122
  */
115
- GIT_EXTERN(const git_error *) giterr_last(void);
123
+ GIT_EXTERN(const git_error *) git_error_last(void);
116
124
 
117
125
  /**
118
126
  * Clear the last library error that occurred for this thread.
119
127
  */
120
- GIT_EXTERN(void) giterr_clear(void);
128
+ GIT_EXTERN(void) git_error_clear(void);
121
129
 
122
130
  /**
123
131
  * Set the error message string for this thread.
@@ -135,18 +143,18 @@ GIT_EXTERN(void) giterr_clear(void);
135
143
  * general subsystem that is responsible for the error.
136
144
  * @param string The formatted error message to keep
137
145
  */
138
- GIT_EXTERN(void) giterr_set_str(int error_class, const char *string);
146
+ GIT_EXTERN(void) git_error_set_str(int error_class, const char *string);
139
147
 
140
148
  /**
141
149
  * Set the error message to a special value for memory allocation failure.
142
150
  *
143
- * The normal `giterr_set_str()` function attempts to `strdup()` the string
144
- * that is passed in. This is not a good idea when the error in question
145
- * is a memory allocation failure. That circumstance has a special setter
146
- * function that sets the error string to a known and statically allocated
147
- * internal value.
151
+ * The normal `git_error_set_str()` function attempts to `strdup()` the
152
+ * string that is passed in. This is not a good idea when the error in
153
+ * question is a memory allocation failure. That circumstance has a
154
+ * special setter function that sets the error string to a known and
155
+ * statically allocated internal value.
148
156
  */
149
- GIT_EXTERN(void) giterr_set_oom(void);
157
+ GIT_EXTERN(void) git_error_set_oom(void);
150
158
 
151
159
  /** @} */
152
160
  GIT_END_DECL
@@ -59,8 +59,8 @@ GIT_EXTERN(int) git_ignore_clear_internal_rules(
59
59
  * given file. This indicates if the file would be ignored regardless of
60
60
  * whether the file is already in the index or committed to the repository.
61
61
  *
62
- * One way to think of this is if you were to do "git add ." on the
63
- * directory containing the file, would it be added or not?
62
+ * One way to think of this is if you were to do "git check-ignore --no-index"
63
+ * on the given file, would it be shown or not?
64
64
  *
65
65
  * @param ignored boolean returning 0 if the file is not ignored, 1 if it is
66
66
  * @param repo a repository object
@@ -37,11 +37,11 @@ typedef struct {
37
37
  * "Documentation/technical/index-format.txt").
38
38
  *
39
39
  * The `flags` field consists of a number of bit fields which can be
40
- * accessed via the first set of `GIT_IDXENTRY_...` bitmasks below. These
41
- * flags are all read from and persisted to disk.
40
+ * accessed via the first set of `GIT_INDEX_ENTRY_...` bitmasks below.
41
+ * These flags are all read from and persisted to disk.
42
42
  *
43
43
  * The `flags_extended` field also has a number of bit fields which can be
44
- * accessed via the later `GIT_IDXENTRY_...` bitmasks below. Some of
44
+ * accessed via the later `GIT_INDEX_ENTRY_...` bitmasks below. Some of
45
45
  * these flags are read from and written to disk, but some are set aside
46
46
  * for in-memory only reference.
47
47
  *
@@ -76,24 +76,25 @@ typedef struct git_index_entry {
76
76
  * value both in memory and on disk. You can use them to interpret the
77
77
  * data in the `flags`.
78
78
  */
79
- #define GIT_IDXENTRY_NAMEMASK (0x0fff)
80
- #define GIT_IDXENTRY_STAGEMASK (0x3000)
81
- #define GIT_IDXENTRY_STAGESHIFT 12
79
+
80
+ #define GIT_INDEX_ENTRY_NAMEMASK (0x0fff)
81
+ #define GIT_INDEX_ENTRY_STAGEMASK (0x3000)
82
+ #define GIT_INDEX_ENTRY_STAGESHIFT 12
82
83
 
83
84
  /**
84
85
  * Flags for index entries
85
86
  */
86
87
  typedef enum {
87
- GIT_IDXENTRY_EXTENDED = (0x4000),
88
- GIT_IDXENTRY_VALID = (0x8000),
89
- } git_indxentry_flag_t;
88
+ GIT_INDEX_ENTRY_EXTENDED = (0x4000),
89
+ GIT_INDEX_ENTRY_VALID = (0x8000),
90
+ } git_index_entry_flag_t;
90
91
 
91
- #define GIT_IDXENTRY_STAGE(E) \
92
- (((E)->flags & GIT_IDXENTRY_STAGEMASK) >> GIT_IDXENTRY_STAGESHIFT)
92
+ #define GIT_INDEX_ENTRY_STAGE(E) \
93
+ (((E)->flags & GIT_INDEX_ENTRY_STAGEMASK) >> GIT_INDEX_ENTRY_STAGESHIFT)
93
94
 
94
- #define GIT_IDXENTRY_STAGE_SET(E,S) do { \
95
- (E)->flags = ((E)->flags & ~GIT_IDXENTRY_STAGEMASK) | \
96
- (((S) & 0x03) << GIT_IDXENTRY_STAGESHIFT); } while (0)
95
+ #define GIT_INDEX_ENTRY_STAGE_SET(E,S) do { \
96
+ (E)->flags = ((E)->flags & ~GIT_INDEX_ENTRY_STAGEMASK) | \
97
+ (((S) & 0x03) << GIT_INDEX_ENTRY_STAGESHIFT); } while (0)
97
98
 
98
99
  /**
99
100
  * Bitmasks for on-disk fields of `git_index_entry`'s `flags_extended`
@@ -101,7 +102,7 @@ typedef enum {
101
102
  * In memory, the `flags_extended` fields are divided into two parts: the
102
103
  * fields that are read from and written to disk, and other fields that
103
104
  * in-memory only and used by libgit2. Only the flags in
104
- * `GIT_IDXENTRY_EXTENDED_FLAGS` will get saved on-disk.
105
+ * `GIT_INDEX_ENTRY_EXTENDED_FLAGS` will get saved on-disk.
105
106
  *
106
107
  * Thee first three bitmasks match the three fields in the
107
108
  * `git_index_entry` `flags_extended` value that belong on disk. You
@@ -113,37 +114,25 @@ typedef enum {
113
114
  *
114
115
  */
115
116
  typedef enum {
117
+ GIT_INDEX_ENTRY_INTENT_TO_ADD = (1 << 13),
118
+ GIT_INDEX_ENTRY_SKIP_WORKTREE = (1 << 14),
116
119
 
117
- GIT_IDXENTRY_INTENT_TO_ADD = (1 << 13),
118
- GIT_IDXENTRY_SKIP_WORKTREE = (1 << 14),
119
- /** Reserved for future extension */
120
- GIT_IDXENTRY_EXTENDED2 = (1 << 15),
121
-
122
- GIT_IDXENTRY_EXTENDED_FLAGS = (GIT_IDXENTRY_INTENT_TO_ADD | GIT_IDXENTRY_SKIP_WORKTREE),
123
- GIT_IDXENTRY_UPDATE = (1 << 0),
124
- GIT_IDXENTRY_REMOVE = (1 << 1),
125
- GIT_IDXENTRY_UPTODATE = (1 << 2),
126
- GIT_IDXENTRY_ADDED = (1 << 3),
120
+ GIT_INDEX_ENTRY_EXTENDED_FLAGS = (GIT_INDEX_ENTRY_INTENT_TO_ADD | GIT_INDEX_ENTRY_SKIP_WORKTREE),
127
121
 
128
- GIT_IDXENTRY_HASHED = (1 << 4),
129
- GIT_IDXENTRY_UNHASHED = (1 << 5),
130
- GIT_IDXENTRY_WT_REMOVE = (1 << 6), /**< remove in work directory */
131
- GIT_IDXENTRY_CONFLICTED = (1 << 7),
132
-
133
- GIT_IDXENTRY_UNPACKED = (1 << 8),
134
- GIT_IDXENTRY_NEW_SKIP_WORKTREE = (1 << 9),
135
- } git_idxentry_extended_flag_t;
122
+ GIT_INDEX_ENTRY_UPTODATE = (1 << 2),
123
+ } git_index_entry_extended_flag_t;
136
124
 
137
125
  /** Capabilities of system that affect index actions. */
138
126
  typedef enum {
139
- GIT_INDEXCAP_IGNORE_CASE = 1,
140
- GIT_INDEXCAP_NO_FILEMODE = 2,
141
- GIT_INDEXCAP_NO_SYMLINKS = 4,
142
- GIT_INDEXCAP_FROM_OWNER = -1,
143
- } git_indexcap_t;
127
+ GIT_INDEX_CAPABILITY_IGNORE_CASE = 1,
128
+ GIT_INDEX_CAPABILITY_NO_FILEMODE = 2,
129
+ GIT_INDEX_CAPABILITY_NO_SYMLINKS = 4,
130
+ GIT_INDEX_CAPABILITY_FROM_OWNER = -1,
131
+ } git_index_capability_t;
132
+
144
133
 
145
134
  /** Callback for APIs that add/remove/update files matching pathspec */
146
- typedef int (*git_index_matched_path_cb)(
135
+ typedef int GIT_CALLBACK(git_index_matched_path_cb)(
147
136
  const char *path, const char *matched_pathspec, void *payload);
148
137
 
149
138
  /** Flags for APIs that add files matching pathspec */
@@ -176,12 +165,6 @@ typedef enum {
176
165
  GIT_INDEX_STAGE_THEIRS = 3,
177
166
  } git_index_stage_t;
178
167
 
179
- /** @name Index File Functions
180
- *
181
- * These functions work on the index file itself.
182
- */
183
- /**@{*/
184
-
185
168
  /**
186
169
  * Create a new bare Git index object as a memory representation
187
170
  * of the Git index file in 'index_path', without a repository
@@ -234,19 +217,19 @@ GIT_EXTERN(git_repository *) git_index_owner(const git_index *index);
234
217
  * Read index capabilities flags.
235
218
  *
236
219
  * @param index An existing index object
237
- * @return A combination of GIT_INDEXCAP values
220
+ * @return A combination of GIT_INDEX_CAPABILITY values
238
221
  */
239
222
  GIT_EXTERN(int) git_index_caps(const git_index *index);
240
223
 
241
224
  /**
242
225
  * Set index capabilities flags.
243
226
  *
244
- * If you pass `GIT_INDEXCAP_FROM_OWNER` for the caps, then the
227
+ * If you pass `GIT_INDEX_CAPABILITY_FROM_OWNER` for the caps, then
245
228
  * capabilities will be read from the config of the owner object,
246
229
  * looking at `core.ignorecase`, `core.filemode`, `core.symlinks`.
247
230
  *
248
231
  * @param index An existing index object
249
- * @param caps A combination of GIT_INDEXCAP values
232
+ * @param caps A combination of GIT_INDEX_CAPABILITY values
250
233
  * @return 0 on success, -1 on failure
251
234
  */
252
235
  GIT_EXTERN(int) git_index_set_caps(git_index *index, int caps);
@@ -474,7 +457,7 @@ GIT_EXTERN(int) git_index_add(git_index *index, const git_index_entry *source_en
474
457
  *
475
458
  * This entry is calculated from the entry's flag attribute like this:
476
459
  *
477
- * (entry->flags & GIT_IDXENTRY_STAGEMASK) >> GIT_IDXENTRY_STAGESHIFT
460
+ * (entry->flags & GIT_INDEX_ENTRY_STAGEMASK) >> GIT_INDEX_ENTRY_STAGESHIFT
478
461
  *
479
462
  * @param entry The entry
480
463
  * @return the stage number
@@ -492,6 +475,46 @@ GIT_EXTERN(int) git_index_entry_is_conflict(const git_index_entry *entry);
492
475
 
493
476
  /**@}*/
494
477
 
478
+ /** @name Index Entry Iteration Functions
479
+ *
480
+ * These functions provide an iterator for index entries.
481
+ */
482
+ /**@{*/
483
+
484
+ /**
485
+ * Create an iterator that will return every entry contained in the
486
+ * index at the time of creation. Entries are returned in order,
487
+ * sorted by path. This iterator is backed by a snapshot that allows
488
+ * callers to modify the index while iterating without affecting the
489
+ * iterator.
490
+ *
491
+ * @param iterator_out The newly created iterator
492
+ * @param index The index to iterate
493
+ */
494
+ GIT_EXTERN(int) git_index_iterator_new(
495
+ git_index_iterator **iterator_out,
496
+ git_index *index);
497
+
498
+ /**
499
+ * Return the next index entry in-order from the iterator.
500
+ *
501
+ * @param out Pointer to store the index entry in
502
+ * @param iterator The iterator
503
+ * @return 0, GIT_ITEROVER on iteration completion or an error code
504
+ */
505
+ GIT_EXTERN(int) git_index_iterator_next(
506
+ const git_index_entry **out,
507
+ git_index_iterator *iterator);
508
+
509
+ /**
510
+ * Free the index iterator
511
+ *
512
+ * @param iterator The iterator to free
513
+ */
514
+ GIT_EXTERN(void) git_index_iterator_free(git_index_iterator *iterator);
515
+
516
+ /**@}*/
517
+
495
518
  /** @name Workdir Index Entry Functions
496
519
  *
497
520
  * These functions work on index entries specifically in the working
@@ -805,8 +828,6 @@ GIT_EXTERN(int) git_index_conflict_next(
805
828
  GIT_EXTERN(void) git_index_conflict_iterator_free(
806
829
  git_index_conflict_iterator *iterator);
807
830
 
808
- /**@}*/
809
-
810
831
  /** @} */
811
832
  GIT_END_DECL
812
833
  #endif
@@ -15,6 +15,33 @@ GIT_BEGIN_DECL
15
15
 
16
16
  typedef struct git_indexer git_indexer;
17
17
 
18
+ typedef struct git_indexer_options {
19
+ unsigned int version;
20
+
21
+ /** progress_cb function to call with progress information */
22
+ git_transfer_progress_cb progress_cb;
23
+ /** progress_cb_payload payload for the progress callback */
24
+ void *progress_cb_payload;
25
+
26
+ /** Do connectivity checks for the received pack */
27
+ unsigned char verify;
28
+ } git_indexer_options;
29
+
30
+ #define GIT_INDEXER_OPTIONS_VERSION 1
31
+ #define GIT_INDEXER_OPTIONS_INIT { GIT_INDEXER_OPTIONS_VERSION }
32
+
33
+ /**
34
+ * Initializes a `git_indexer_options` with default values. Equivalent to
35
+ * creating an instance with GIT_INDEXER_OPTIONS_INIT.
36
+ *
37
+ * @param opts the `git_indexer_options` struct to initialize.
38
+ * @param version Version of struct; pass `GIT_INDEXER_OPTIONS_VERSION`
39
+ * @return Zero on success; -1 on failure.
40
+ */
41
+ GIT_EXTERN(int) git_indexer_init_options(
42
+ git_indexer_options *opts,
43
+ unsigned int version);
44
+
18
45
  /**
19
46
  * Create a new indexer instance
20
47
  *
@@ -24,16 +51,15 @@ typedef struct git_indexer git_indexer;
24
51
  * @param odb object database from which to read base objects when
25
52
  * fixing thin packs. Pass NULL if no thin pack is expected (an error
26
53
  * will be returned if there are bases missing)
27
- * @param progress_cb function to call with progress information
28
- * @param progress_cb_payload payload for the progress callback
54
+ * @param opts Optional structure containing additional options. See
55
+ * `git_indexer_options` above.
29
56
  */
30
57
  GIT_EXTERN(int) git_indexer_new(
31
58
  git_indexer **out,
32
59
  const char *path,
33
60
  unsigned int mode,
34
61
  git_odb *odb,
35
- git_transfer_progress_cb progress_cb,
36
- void *progress_cb_payload);
62
+ git_indexer_options *opts);
37
63
 
38
64
  /**
39
65
  * Add data to the indexer
@@ -0,0 +1,115 @@
1
+ /*
2
+ * Copyright (C) the libgit2 contributors. All rights reserved.
3
+ *
4
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
5
+ * a Linking Exception. For full terms see the included COPYING file.
6
+ */
7
+ #ifndef INCLUDE_git_mailmap_h__
8
+ #define INCLUDE_git_mailmap_h__
9
+
10
+ #include "common.h"
11
+ #include "types.h"
12
+ #include "buffer.h"
13
+
14
+ /**
15
+ * @file git2/mailmap.h
16
+ * @brief Mailmap parsing routines
17
+ * @defgroup git_mailmap Git mailmap routines
18
+ * @ingroup Git
19
+ * @{
20
+ */
21
+ GIT_BEGIN_DECL
22
+
23
+ /**
24
+ * Allocate a new mailmap object.
25
+ *
26
+ * This object is empty, so you'll have to add a mailmap file before you can do
27
+ * anything with it. The mailmap must be freed with 'git_mailmap_free'.
28
+ *
29
+ * @param out pointer to store the new mailmap
30
+ * @return 0 on success, or an error code
31
+ */
32
+ GIT_EXTERN(int) git_mailmap_new(git_mailmap **out);
33
+
34
+ /**
35
+ * Free the mailmap and its associated memory.
36
+ *
37
+ * @param mm the mailmap to free
38
+ */
39
+ GIT_EXTERN(void) git_mailmap_free(git_mailmap *mm);
40
+
41
+ /**
42
+ * Add a single entry to the given mailmap object. If the entry already exists,
43
+ * it will be replaced with the new entry.
44
+ *
45
+ * @param mm mailmap to add the entry to
46
+ * @param real_name the real name to use, or NULL
47
+ * @param real_email the real email to use, or NULL
48
+ * @param replace_name the name to replace, or NULL
49
+ * @param replace_email the email to replace
50
+ * @return 0 on success, or an error code
51
+ */
52
+ GIT_EXTERN(int) git_mailmap_add_entry(
53
+ git_mailmap *mm, const char *real_name, const char *real_email,
54
+ const char *replace_name, const char *replace_email);
55
+
56
+ /**
57
+ * Create a new mailmap instance containing a single mailmap file
58
+ *
59
+ * @param out pointer to store the new mailmap
60
+ * @param buf buffer to parse the mailmap from
61
+ * @param len the length of the input buffer
62
+ * @return 0 on success, or an error code
63
+ */
64
+ GIT_EXTERN(int) git_mailmap_from_buffer(
65
+ git_mailmap **out, const char *buf, size_t len);
66
+
67
+ /**
68
+ * Create a new mailmap instance from a repository, loading mailmap files based
69
+ * on the repository's configuration.
70
+ *
71
+ * Mailmaps are loaded in the following order:
72
+ * 1. '.mailmap' in the root of the repository's working directory, if present.
73
+ * 2. The blob object identified by the 'mailmap.blob' config entry, if set.
74
+ * [NOTE: 'mailmap.blob' defaults to 'HEAD:.mailmap' in bare repositories]
75
+ * 3. The path in the 'mailmap.file' config entry, if set.
76
+ *
77
+ * @param out pointer to store the new mailmap
78
+ * @param repo repository to load mailmap information from
79
+ * @return 0 on success, or an error code
80
+ */
81
+ GIT_EXTERN(int) git_mailmap_from_repository(
82
+ git_mailmap **out, git_repository *repo);
83
+
84
+ /**
85
+ * Resolve a name and email to the corresponding real name and email.
86
+ *
87
+ * The lifetime of the strings are tied to `mm`, `name`, and `email` parameters.
88
+ *
89
+ * @param real_name pointer to store the real name
90
+ * @param real_email pointer to store the real email
91
+ * @param mm the mailmap to perform a lookup with (may be NULL)
92
+ * @param name the name to look up
93
+ * @param email the email to look up
94
+ * @return 0 on success, or an error code
95
+ */
96
+ GIT_EXTERN(int) git_mailmap_resolve(
97
+ const char **real_name, const char **real_email,
98
+ const git_mailmap *mm, const char *name, const char *email);
99
+
100
+ /**
101
+ * Resolve a signature to use real names and emails with a mailmap.
102
+ *
103
+ * Call `git_signature_free()` to free the data.
104
+ *
105
+ * @param out new signature
106
+ * @param mm mailmap to resolve with
107
+ * @param sig signature to resolve
108
+ * @return 0 or an error code
109
+ */
110
+ GIT_EXTERN(int) git_mailmap_resolve_signature(
111
+ git_signature **out, const git_mailmap *mm, const git_signature *sig);
112
+
113
+ /** @} */
114
+ GIT_END_DECL
115
+ #endif