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
@@ -57,12 +57,12 @@ static int get_passwd_home(git_buf *out, uid_t uid)
57
57
  } while (error == ERANGE && buflen <= 8192);
58
58
 
59
59
  if (error) {
60
- giterr_set(GITERR_OS, "failed to get passwd entry");
60
+ git_error_set(GIT_ERROR_OS, "failed to get passwd entry");
61
61
  goto out;
62
62
  }
63
63
 
64
64
  if (!pwdptr) {
65
- giterr_set(GITERR_OS, "no passwd entry found for user");
65
+ git_error_set(GIT_ERROR_OS, "no passwd entry found for user");
66
66
  goto out;
67
67
  }
68
68
 
@@ -96,7 +96,7 @@ static int git_sysdir_guess_global_dirs(git_buf *out)
96
96
  error = get_passwd_home(out, euid);
97
97
 
98
98
  if (error == GIT_ENOTFOUND) {
99
- giterr_clear();
99
+ git_error_clear();
100
100
  error = 0;
101
101
  }
102
102
 
@@ -132,11 +132,11 @@ static int git_sysdir_guess_xdg_dirs(git_buf *out)
132
132
  }
133
133
 
134
134
  if (error == GIT_ENOTFOUND) {
135
- giterr_clear();
135
+ git_error_clear();
136
136
  error = 0;
137
137
  }
138
138
 
139
- git_buf_free(&env);
139
+ git_buf_dispose(&env);
140
140
  return error;
141
141
  #endif
142
142
  }
@@ -168,7 +168,7 @@ static void git_sysdir_global_shutdown(void)
168
168
  size_t i;
169
169
 
170
170
  for (i = 0; i < ARRAY_SIZE(git_sysdir__dirs); ++i)
171
- git_buf_free(&git_sysdir__dirs[i].buf);
171
+ git_buf_dispose(&git_sysdir__dirs[i].buf);
172
172
  }
173
173
 
174
174
  int git_sysdir_global_init(void)
@@ -189,7 +189,7 @@ static int git_sysdir_check_selector(git_sysdir_t which)
189
189
  if (which < ARRAY_SIZE(git_sysdir__dirs))
190
190
  return 0;
191
191
 
192
- giterr_set(GITERR_INVALID, "config directory selector out of range");
192
+ git_error_set(GIT_ERROR_INVALID, "config directory selector out of range");
193
193
  return -1;
194
194
  }
195
195
 
@@ -200,7 +200,7 @@ int git_sysdir_get(const git_buf **out, git_sysdir_t which)
200
200
 
201
201
  *out = NULL;
202
202
 
203
- GITERR_CHECK_ERROR(git_sysdir_check_selector(which));
203
+ GIT_ERROR_CHECK_ERROR(git_sysdir_check_selector(which));
204
204
 
205
205
  *out = &git_sysdir__dirs[which].buf;
206
206
  return 0;
@@ -213,11 +213,11 @@ int git_sysdir_get_str(
213
213
  {
214
214
  const git_buf *path = NULL;
215
215
 
216
- GITERR_CHECK_ERROR(git_sysdir_check_selector(which));
217
- GITERR_CHECK_ERROR(git_sysdir_get(&path, which));
216
+ GIT_ERROR_CHECK_ERROR(git_sysdir_check_selector(which));
217
+ GIT_ERROR_CHECK_ERROR(git_sysdir_get(&path, which));
218
218
 
219
219
  if (!out || path->size >= outlen) {
220
- giterr_set(GITERR_NOMEMORY, "buffer is too short for the path");
220
+ git_error_set(GIT_ERROR_NOMEMORY, "buffer is too short for the path");
221
221
  return GIT_EBUFS;
222
222
  }
223
223
 
@@ -232,7 +232,7 @@ int git_sysdir_set(git_sysdir_t which, const char *search_path)
232
232
  const char *expand_path = NULL;
233
233
  git_buf merge = GIT_BUF_INIT;
234
234
 
235
- GITERR_CHECK_ERROR(git_sysdir_check_selector(which));
235
+ GIT_ERROR_CHECK_ERROR(git_sysdir_check_selector(which));
236
236
 
237
237
  if (search_path != NULL)
238
238
  expand_path = strstr(search_path, PATH_MAGIC);
@@ -262,7 +262,7 @@ int git_sysdir_set(git_sysdir_t which, const char *search_path)
262
262
  git_buf_join(&merge, GIT_PATH_LIST_SEPARATOR, merge.ptr, expand_path);
263
263
 
264
264
  git_buf_swap(&git_sysdir__dirs[which].buf, &merge);
265
- git_buf_free(&merge);
265
+ git_buf_dispose(&merge);
266
266
 
267
267
  done:
268
268
  if (git_buf_oom(&git_sysdir__dirs[which].buf))
@@ -281,7 +281,7 @@ static int git_sysdir_find_in_dirlist(
281
281
  const char *scan, *next = NULL;
282
282
  const git_buf *syspath;
283
283
 
284
- GITERR_CHECK_ERROR(git_sysdir_get(&syspath, which));
284
+ GIT_ERROR_CHECK_ERROR(git_sysdir_get(&syspath, which));
285
285
  if (!syspath || !git_buf_len(syspath))
286
286
  goto done;
287
287
 
@@ -298,17 +298,17 @@ static int git_sysdir_find_in_dirlist(
298
298
  if (!len)
299
299
  continue;
300
300
 
301
- GITERR_CHECK_ERROR(git_buf_set(path, scan, len));
301
+ GIT_ERROR_CHECK_ERROR(git_buf_set(path, scan, len));
302
302
  if (name)
303
- GITERR_CHECK_ERROR(git_buf_joinpath(path, path->ptr, name));
303
+ GIT_ERROR_CHECK_ERROR(git_buf_joinpath(path, path->ptr, name));
304
304
 
305
305
  if (git_path_exists(path->ptr))
306
306
  return 0;
307
307
  }
308
308
 
309
309
  done:
310
- git_buf_free(path);
311
- giterr_set(GITERR_OS, "the %s file '%s' doesn't exist", label, name);
310
+ git_buf_dispose(path);
311
+ git_error_set(GIT_ERROR_OS, "the %s file '%s' doesn't exist", label, name);
312
312
  return GIT_ENOTFOUND;
313
313
  }
314
314
 
@@ -36,7 +36,7 @@ const git_oid *git_tag_target_id(const git_tag *t)
36
36
  return &t->target;
37
37
  }
38
38
 
39
- git_otype git_tag_target_type(const git_tag *t)
39
+ git_object_t git_tag_target_type(const git_tag *t)
40
40
  {
41
41
  assert(t);
42
42
  return t->type;
@@ -61,7 +61,7 @@ const char *git_tag_message(const git_tag *t)
61
61
 
62
62
  static int tag_error(const char *str)
63
63
  {
64
- giterr_set(GITERR_TAG, "failed to parse tag: %s", str);
64
+ git_error_set(GIT_ERROR_TAG, "failed to parse tag: %s", str);
65
65
  return -1;
66
66
  }
67
67
 
@@ -84,7 +84,7 @@ static int tag_parse(git_tag *tag, const char *buffer, const char *buffer_end)
84
84
  return tag_error("type field not found");
85
85
  buffer += 5;
86
86
 
87
- tag->type = GIT_OBJ_BAD;
87
+ tag->type = GIT_OBJECT_INVALID;
88
88
 
89
89
  for (i = 1; i < ARRAY_SIZE(tag_types); ++i) {
90
90
  size_t type_length = strlen(tag_types[i]);
@@ -99,7 +99,7 @@ static int tag_parse(git_tag *tag, const char *buffer, const char *buffer_end)
99
99
  }
100
100
  }
101
101
 
102
- if (tag->type == GIT_OBJ_BAD)
102
+ if (tag->type == GIT_OBJECT_INVALID)
103
103
  return tag_error("invalid object type");
104
104
 
105
105
  if (buffer + 4 >= buffer_end)
@@ -116,9 +116,9 @@ static int tag_parse(git_tag *tag, const char *buffer, const char *buffer_end)
116
116
 
117
117
  text_len = search - buffer;
118
118
 
119
- GITERR_CHECK_ALLOC_ADD(&alloc_len, text_len, 1);
119
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, text_len, 1);
120
120
  tag->tag_name = git__malloc(alloc_len);
121
- GITERR_CHECK_ALLOC(tag->tag_name);
121
+ GIT_ERROR_CHECK_ALLOC(tag->tag_name);
122
122
 
123
123
  memcpy(tag->tag_name, buffer, text_len);
124
124
  tag->tag_name[text_len] = '\0';
@@ -128,7 +128,7 @@ static int tag_parse(git_tag *tag, const char *buffer, const char *buffer_end)
128
128
  tag->tagger = NULL;
129
129
  if (buffer < buffer_end && *buffer != '\n') {
130
130
  tag->tagger = git__malloc(sizeof(git_signature));
131
- GITERR_CHECK_ALLOC(tag->tagger);
131
+ GIT_ERROR_CHECK_ALLOC(tag->tagger);
132
132
 
133
133
  if (git_signature__parse(tag->tagger, &buffer, buffer_end, "tagger ", '\n') < 0)
134
134
  return -1;
@@ -148,9 +148,9 @@ static int tag_parse(git_tag *tag, const char *buffer, const char *buffer_end)
148
148
 
149
149
  text_len = buffer_end - ++buffer;
150
150
 
151
- GITERR_CHECK_ALLOC_ADD(&alloc_len, text_len, 1);
151
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, text_len, 1);
152
152
  tag->message = git__malloc(alloc_len);
153
- GITERR_CHECK_ALLOC(tag->message);
153
+ GIT_ERROR_CHECK_ALLOC(tag->message);
154
154
 
155
155
  memcpy(tag->message, buffer, text_len);
156
156
  tag->message[text_len] = '\0';
@@ -159,6 +159,11 @@ static int tag_parse(git_tag *tag, const char *buffer, const char *buffer_end)
159
159
  return 0;
160
160
  }
161
161
 
162
+ int git_tag__parse_raw(void *_tag, const char *data, size_t size)
163
+ {
164
+ return tag_parse(_tag, data, data + size);
165
+ }
166
+
162
167
  int git_tag__parse(void *_tag, git_odb_object *odb_obj)
163
168
  {
164
169
  git_tag *tag = _tag;
@@ -226,15 +231,15 @@ static int write_tag_annotation(
226
231
  if (git_repository_odb__weakptr(&odb, repo) < 0)
227
232
  goto on_error;
228
233
 
229
- if (git_odb_write(oid, odb, tag.ptr, tag.size, GIT_OBJ_TAG) < 0)
234
+ if (git_odb_write(oid, odb, tag.ptr, tag.size, GIT_OBJECT_TAG) < 0)
230
235
  goto on_error;
231
236
 
232
- git_buf_free(&tag);
237
+ git_buf_dispose(&tag);
233
238
  return 0;
234
239
 
235
240
  on_error:
236
- git_buf_free(&tag);
237
- giterr_set(GITERR_OBJECT, "failed to create tag annotation");
241
+ git_buf_dispose(&tag);
242
+ git_error_set(GIT_ERROR_OBJECT, "failed to create tag annotation");
238
243
  return -1;
239
244
  }
240
245
 
@@ -257,7 +262,7 @@ static int git_tag_create__internal(
257
262
  assert(!create_tag_annotation || (tagger && message));
258
263
 
259
264
  if (git_object_owner(target) != repo) {
260
- giterr_set(GITERR_INVALID, "the given target does not belong to this repository");
265
+ git_error_set(GIT_ERROR_INVALID, "the given target does not belong to this repository");
261
266
  return -1;
262
267
  }
263
268
 
@@ -268,8 +273,8 @@ static int git_tag_create__internal(
268
273
  /** Ensure the tag name doesn't conflict with an already existing
269
274
  * reference unless overwriting has explicitly been requested **/
270
275
  if (error == 0 && !allow_ref_overwrite) {
271
- git_buf_free(&ref_name);
272
- giterr_set(GITERR_TAG, "tag already exists");
276
+ git_buf_dispose(&ref_name);
277
+ git_error_set(GIT_ERROR_TAG, "tag already exists");
273
278
  return GIT_EEXISTS;
274
279
  }
275
280
 
@@ -283,7 +288,7 @@ static int git_tag_create__internal(
283
288
 
284
289
  cleanup:
285
290
  git_reference_free(new_ref);
286
- git_buf_free(&ref_name);
291
+ git_buf_dispose(&ref_name);
287
292
  return error;
288
293
  }
289
294
 
@@ -349,7 +354,7 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
349
354
  goto on_error;
350
355
 
351
356
  if (tag.type != target_obj->cached.type) {
352
- giterr_set(GITERR_TAG, "the type for the given target is invalid");
357
+ git_error_set(GIT_ERROR_TAG, "the type for the given target is invalid");
353
358
  goto on_error;
354
359
  }
355
360
 
@@ -366,13 +371,13 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
366
371
  /** Ensure the tag name doesn't conflict with an already existing
367
372
  * reference unless overwriting has explicitly been requested **/
368
373
  if (error == 0 && !allow_ref_overwrite) {
369
- giterr_set(GITERR_TAG, "tag already exists");
374
+ git_error_set(GIT_ERROR_TAG, "tag already exists");
370
375
  return GIT_EEXISTS;
371
376
  }
372
377
 
373
378
  /* write the buffer */
374
379
  if ((error = git_odb_open_wstream(
375
- &stream, odb, strlen(buffer), GIT_OBJ_TAG)) < 0)
380
+ &stream, odb, strlen(buffer), GIT_OBJECT_TAG)) < 0)
376
381
  return error;
377
382
 
378
383
  if (!(error = git_odb_stream_write(stream, buffer, strlen(buffer))))
@@ -381,7 +386,7 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
381
386
  git_odb_stream_free(stream);
382
387
 
383
388
  if (error < 0) {
384
- git_buf_free(&ref_name);
389
+ git_buf_dispose(&ref_name);
385
390
  return error;
386
391
  }
387
392
 
@@ -389,7 +394,7 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
389
394
  &new_ref, repo, ref_name.ptr, oid, allow_ref_overwrite, NULL);
390
395
 
391
396
  git_reference_free(new_ref);
392
- git_buf_free(&ref_name);
397
+ git_buf_dispose(&ref_name);
393
398
 
394
399
  return error;
395
400
 
@@ -409,7 +414,7 @@ int git_tag_delete(git_repository *repo, const char *tag_name)
409
414
 
410
415
  error = retrieve_tag_reference(&tag_ref, &ref_name, repo, tag_name);
411
416
 
412
- git_buf_free(&ref_name);
417
+ git_buf_dispose(&ref_name);
413
418
 
414
419
  if (error < 0)
415
420
  return error;
@@ -438,7 +443,7 @@ static int tags_cb(const char *ref, void *data)
438
443
 
439
444
  if (!(error = git_reference_name_to_id(&oid, d->repo, ref))) {
440
445
  if ((error = d->cb(ref, &oid, d->cb_data)) != 0)
441
- giterr_set_after_callback_function(error, "git_tag_foreach");
446
+ git_error_set_after_callback_function(error, "git_tag_foreach");
442
447
  }
443
448
 
444
449
  return error;
@@ -473,7 +478,7 @@ static int tag_list_cb(const char *tag_name, git_oid *oid, void *data)
473
478
  p_fnmatch(filter->pattern, tag_name + GIT_REFS_TAGS_DIR_LEN, 0) == 0)
474
479
  {
475
480
  char *matched = git__strdup(tag_name + GIT_REFS_TAGS_DIR_LEN);
476
- GITERR_CHECK_ALLOC(matched);
481
+ GIT_ERROR_CHECK_ALLOC(matched);
477
482
 
478
483
  return git_vector_insert(filter->taglist, matched);
479
484
  }
@@ -513,5 +518,5 @@ int git_tag_list(git_strarray *tag_names, git_repository *repo)
513
518
 
514
519
  int git_tag_peel(git_object **tag_target, const git_tag *tag)
515
520
  {
516
- return git_object_peel(tag_target, (const git_object *)tag, GIT_OBJ_ANY);
521
+ return git_object_peel(tag_target, (const git_object *)tag, GIT_OBJECT_ANY);
517
522
  }
@@ -17,7 +17,7 @@ struct git_tag {
17
17
  git_object object;
18
18
 
19
19
  git_oid target;
20
- git_otype type;
20
+ git_object_t type;
21
21
 
22
22
  char *tag_name;
23
23
  git_signature *tagger;
@@ -26,5 +26,6 @@ struct git_tag {
26
26
 
27
27
  void git_tag__free(void *tag);
28
28
  int git_tag__parse(void *tag, git_odb_object *obj);
29
+ int git_tag__parse_raw(void *tag, const char *data, size_t size);
29
30
 
30
31
  #endif
@@ -31,7 +31,7 @@ int git_trace_set(git_trace_level_t level, git_trace_callback callback)
31
31
  GIT_UNUSED(level);
32
32
  GIT_UNUSED(callback);
33
33
 
34
- giterr_set(GITERR_INVALID,
34
+ git_error_set(GIT_ERROR_INVALID,
35
35
  "this version of libgit2 was not built with tracing.");
36
36
  return -1;
37
37
  #endif
@@ -35,7 +35,7 @@ GIT_INLINE(void) git_trace__write_fmt(
35
35
 
36
36
  callback(level, git_buf_cstr(&message));
37
37
 
38
- git_buf_free(&message);
38
+ git_buf_dispose(&message);
39
39
  }
40
40
 
41
41
  #define git_trace_level() (git_trace__data.level)
@@ -36,7 +36,7 @@ static const char *next_line(const char *str)
36
36
  if (nl) {
37
37
  return nl + 1;
38
38
  } else {
39
- // return pointer to the NUL terminator:
39
+ /* return pointer to the NUL terminator: */
40
40
  return str + strlen(str);
41
41
  }
42
42
  }
@@ -310,12 +310,12 @@ int git_message_trailers(git_message_trailer_array *trailer_arr, const char *mes
310
310
  }
311
311
 
312
312
  if (isalnum(*ptr) || *ptr == '-') {
313
- // legal key character
313
+ /* legal key character */
314
314
  NEXT(S_KEY);
315
315
  }
316
316
 
317
317
  if (*ptr == ' ' || *ptr == '\t') {
318
- // optional whitespace before separator
318
+ /* optional whitespace before separator */
319
319
  *ptr = 0;
320
320
  NEXT(S_KEY_WS);
321
321
  }
@@ -325,7 +325,7 @@ int git_message_trailers(git_message_trailer_array *trailer_arr, const char *mes
325
325
  NEXT(S_SEP_WS);
326
326
  }
327
327
 
328
- // illegal character
328
+ /* illegal character */
329
329
  GOTO(S_IGNORE);
330
330
  }
331
331
  case S_KEY_WS: {
@@ -341,7 +341,7 @@ int git_message_trailers(git_message_trailer_array *trailer_arr, const char *mes
341
341
  NEXT(S_SEP_WS);
342
342
  }
343
343
 
344
- // illegal character
344
+ /* illegal character */
345
345
  GOTO(S_IGNORE);
346
346
  }
347
347
  case S_SEP_WS: {
@@ -369,7 +369,7 @@ int git_message_trailers(git_message_trailer_array *trailer_arr, const char *mes
369
369
  }
370
370
  case S_VALUE_NL: {
371
371
  if (*ptr == ' ') {
372
- // continuation;
372
+ /* continuation; */
373
373
  NEXT(S_VALUE);
374
374
  }
375
375
 
@@ -30,7 +30,7 @@ typedef struct {
30
30
  const char *name;
31
31
  void *payload;
32
32
 
33
- git_ref_t ref_type;
33
+ git_reference_t ref_type;
34
34
  union {
35
35
  git_oid id;
36
36
  char *symbolic;
@@ -60,7 +60,7 @@ int git_transaction_config_new(git_transaction **out, git_config *cfg)
60
60
  assert(out && cfg);
61
61
 
62
62
  tx = git__calloc(1, sizeof(git_transaction));
63
- GITERR_CHECK_ALLOC(tx);
63
+ GIT_ERROR_CHECK_ALLOC(tx);
64
64
 
65
65
  tx->type = TRANSACTION_CONFIG;
66
66
  tx->cfg = cfg;
@@ -111,16 +111,16 @@ int git_transaction_lock_ref(git_transaction *tx, const char *refname)
111
111
  assert(tx && refname);
112
112
 
113
113
  node = git_pool_mallocz(&tx->pool, sizeof(transaction_node));
114
- GITERR_CHECK_ALLOC(node);
114
+ GIT_ERROR_CHECK_ALLOC(node);
115
115
 
116
116
  node->name = git_pool_strdup(&tx->pool, refname);
117
- GITERR_CHECK_ALLOC(node->name);
117
+ GIT_ERROR_CHECK_ALLOC(node->name);
118
118
 
119
119
  if ((error = git_refdb_lock(&node->payload, tx->db, refname)) < 0)
120
120
  return error;
121
121
 
122
122
  git_strmap_insert(tx->locks, node->name, node, &error);
123
- if (error < 0)
123
+ if (error < 0)
124
124
  goto cleanup;
125
125
 
126
126
  return 0;
@@ -133,12 +133,12 @@ cleanup:
133
133
 
134
134
  static int find_locked(transaction_node **out, git_transaction *tx, const char *refname)
135
135
  {
136
- git_strmap_iter pos;
137
136
  transaction_node *node;
137
+ size_t pos;
138
138
 
139
139
  pos = git_strmap_lookup_index(tx->locks, refname);
140
140
  if (!git_strmap_valid_index(tx->locks, pos)) {
141
- giterr_set(GITERR_REFERENCE, "the specified reference is not locked");
141
+ git_error_set(GIT_ERROR_REFERENCE, "the specified reference is not locked");
142
142
  return GIT_ENOTFOUND;
143
143
  }
144
144
 
@@ -169,7 +169,7 @@ static int copy_common(transaction_node *node, git_transaction *tx, const git_si
169
169
 
170
170
  if (msg) {
171
171
  node->message = git_pool_strdup(&tx->pool, msg);
172
- GITERR_CHECK_ALLOC(node->message);
172
+ GIT_ERROR_CHECK_ALLOC(node->message);
173
173
  }
174
174
 
175
175
  return 0;
@@ -189,7 +189,7 @@ int git_transaction_set_target(git_transaction *tx, const char *refname, const g
189
189
  return error;
190
190
 
191
191
  git_oid_cpy(&node->target.id, target);
192
- node->ref_type = GIT_REF_OID;
192
+ node->ref_type = GIT_REFERENCE_DIRECT;
193
193
 
194
194
  return 0;
195
195
  }
@@ -208,8 +208,8 @@ int git_transaction_set_symbolic_target(git_transaction *tx, const char *refname
208
208
  return error;
209
209
 
210
210
  node->target.symbolic = git_pool_strdup(&tx->pool, target);
211
- GITERR_CHECK_ALLOC(node->target.symbolic);
212
- node->ref_type = GIT_REF_SYMBOLIC;
211
+ GIT_ERROR_CHECK_ALLOC(node->target.symbolic);
212
+ node->ref_type = GIT_REFERENCE_SYMBOLIC;
213
213
 
214
214
  return 0;
215
215
  }
@@ -223,7 +223,7 @@ int git_transaction_remove(git_transaction *tx, const char *refname)
223
223
  return error;
224
224
 
225
225
  node->remove = true;
226
- node->ref_type = GIT_REF_OID; /* the id will be ignored */
226
+ node->ref_type = GIT_REFERENCE_DIRECT; /* the id will be ignored */
227
227
 
228
228
  return 0;
229
229
  }
@@ -235,18 +235,18 @@ static int dup_reflog(git_reflog **out, const git_reflog *in, git_pool *pool)
235
235
  size_t len, i;
236
236
 
237
237
  reflog = git_pool_mallocz(pool, sizeof(git_reflog));
238
- GITERR_CHECK_ALLOC(reflog);
238
+ GIT_ERROR_CHECK_ALLOC(reflog);
239
239
 
240
240
  reflog->ref_name = git_pool_strdup(pool, in->ref_name);
241
- GITERR_CHECK_ALLOC(reflog->ref_name);
241
+ GIT_ERROR_CHECK_ALLOC(reflog->ref_name);
242
242
 
243
243
  len = in->entries.length;
244
244
  reflog->entries.length = len;
245
245
  reflog->entries.contents = git_pool_mallocz(pool, len * sizeof(void *));
246
- GITERR_CHECK_ALLOC(reflog->entries.contents);
246
+ GIT_ERROR_CHECK_ALLOC(reflog->entries.contents);
247
247
 
248
248
  entries = git_pool_mallocz(pool, len * sizeof(git_reflog_entry));
249
- GITERR_CHECK_ALLOC(entries);
249
+ GIT_ERROR_CHECK_ALLOC(entries);
250
250
 
251
251
  for (i = 0; i < len; i++) {
252
252
  const git_reflog_entry *src;
@@ -260,7 +260,7 @@ static int dup_reflog(git_reflog **out, const git_reflog *in, git_pool *pool)
260
260
  git_oid_cpy(&tgt->oid_cur, &src->oid_cur);
261
261
 
262
262
  tgt->msg = git_pool_strdup(pool, src->msg);
263
- GITERR_CHECK_ALLOC(tgt->msg);
263
+ GIT_ERROR_CHECK_ALLOC(tgt->msg);
264
264
 
265
265
  if (git_signature__pdup(&tgt->committer, src->committer, pool) < 0)
266
266
  return -1;
@@ -292,22 +292,22 @@ static int update_target(git_refdb *db, transaction_node *node)
292
292
  git_reference *ref;
293
293
  int error, update_reflog;
294
294
 
295
- if (node->ref_type == GIT_REF_OID) {
295
+ if (node->ref_type == GIT_REFERENCE_DIRECT) {
296
296
  ref = git_reference__alloc(node->name, &node->target.id, NULL);
297
- } else if (node->ref_type == GIT_REF_SYMBOLIC) {
297
+ } else if (node->ref_type == GIT_REFERENCE_SYMBOLIC) {
298
298
  ref = git_reference__alloc_symbolic(node->name, node->target.symbolic);
299
299
  } else {
300
300
  abort();
301
301
  }
302
302
 
303
- GITERR_CHECK_ALLOC(ref);
303
+ GIT_ERROR_CHECK_ALLOC(ref);
304
304
  update_reflog = node->reflog == NULL;
305
305
 
306
306
  if (node->remove) {
307
307
  error = git_refdb_unlock(db, node->payload, 2, false, ref, NULL, NULL);
308
- } else if (node->ref_type == GIT_REF_OID) {
308
+ } else if (node->ref_type == GIT_REFERENCE_DIRECT) {
309
309
  error = git_refdb_unlock(db, node->payload, true, update_reflog, ref, node->sig, node->message);
310
- } else if (node->ref_type == GIT_REF_SYMBOLIC) {
310
+ } else if (node->ref_type == GIT_REFERENCE_SYMBOLIC) {
311
311
  error = git_refdb_unlock(db, node->payload, true, update_reflog, ref, node->sig, node->message);
312
312
  } else {
313
313
  abort();
@@ -339,7 +339,7 @@ int git_transaction_commit(git_transaction *tx)
339
339
  return error;
340
340
  }
341
341
 
342
- if (node->ref_type != GIT_REF_INVALID) {
342
+ if (node->ref_type != GIT_REFERENCE_INVALID) {
343
343
  if ((error = update_target(tx->db, node)) < 0)
344
344
  return error;
345
345
  }