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
@@ -29,7 +29,7 @@
29
29
 
30
30
  typedef struct git_pobject {
31
31
  git_oid id;
32
- git_otype type;
32
+ git_object_t type;
33
33
  git_off_t offset;
34
34
 
35
35
  size_t size;
@@ -52,12 +52,6 @@ typedef struct git_pobject {
52
52
  filled:1;
53
53
  } git_pobject;
54
54
 
55
- typedef struct {
56
- git_oid id;
57
- unsigned int uninteresting:1,
58
- seen:1;
59
- } git_walk_object;
60
-
61
55
  struct git_packbuilder {
62
56
  git_repository *repo; /* associated repository */
63
57
  git_odb *odb; /* associated object database */
@@ -24,7 +24,7 @@ static int packfile_unpack_compressed(
24
24
  git_mwindow **w_curs,
25
25
  git_off_t *curpos,
26
26
  size_t size,
27
- git_otype type);
27
+ git_object_t type);
28
28
 
29
29
  /* Can find the offset of an object given
30
30
  * a prefix of an identifier.
@@ -42,7 +42,7 @@ static int pack_entry_find_offset(
42
42
 
43
43
  static int packfile_error(const char *message)
44
44
  {
45
- giterr_set(GITERR_ODB, "invalid pack file - %s", message);
45
+ git_error_set(GIT_ERROR_ODB, "invalid pack file - %s", message);
46
46
  return -1;
47
47
  }
48
48
 
@@ -90,12 +90,12 @@ static void cache_free(git_pack_cache *cache)
90
90
  static int cache_init(git_pack_cache *cache)
91
91
  {
92
92
  cache->entries = git_offmap_alloc();
93
- GITERR_CHECK_ALLOC(cache->entries);
93
+ GIT_ERROR_CHECK_ALLOC(cache->entries);
94
94
 
95
95
  cache->memory_limit = GIT_PACK_CACHE_MEMORY_LIMIT;
96
96
 
97
97
  if (git_mutex_init(&cache->lock)) {
98
- giterr_set(GITERR_OS, "failed to initialize pack cache mutex");
98
+ git_error_set(GIT_ERROR_OS, "failed to initialize pack cache mutex");
99
99
 
100
100
  git__free(cache->entries);
101
101
  cache->entries = NULL;
@@ -108,8 +108,8 @@ static int cache_init(git_pack_cache *cache)
108
108
 
109
109
  static git_pack_cache_entry *cache_get(git_pack_cache *cache, git_off_t offset)
110
110
  {
111
- khiter_t k;
112
111
  git_pack_cache_entry *entry = NULL;
112
+ size_t k;
113
113
 
114
114
  if (git_mutex_lock(&cache->lock) < 0)
115
115
  return NULL;
@@ -148,7 +148,7 @@ static int cache_add(
148
148
  {
149
149
  git_pack_cache_entry *entry;
150
150
  int error, exists = 0;
151
- khiter_t k;
151
+ size_t k;
152
152
 
153
153
  if (base->len > GIT_PACK_CACHE_SIZE_LIMIT)
154
154
  return -1;
@@ -156,7 +156,7 @@ static int cache_add(
156
156
  entry = new_cache_object(base);
157
157
  if (entry) {
158
158
  if (git_mutex_lock(&cache->lock) < 0) {
159
- giterr_set(GITERR_OS, "failed to lock cache");
159
+ git_error_set(GIT_ERROR_OS, "failed to lock cache");
160
160
  git__free(entry);
161
161
  return -1;
162
162
  }
@@ -217,7 +217,7 @@ static int pack_index_check(const char *path, struct git_pack_file *p)
217
217
 
218
218
  if (p_fstat(fd, &st) < 0) {
219
219
  p_close(fd);
220
- giterr_set(GITERR_OS, "unable to stat pack index '%s'", path);
220
+ git_error_set(GIT_ERROR_OS, "unable to stat pack index '%s'", path);
221
221
  return -1;
222
222
  }
223
223
 
@@ -226,7 +226,7 @@ static int pack_index_check(const char *path, struct git_pack_file *p)
226
226
  (idx_size = (size_t)st.st_size) < 4 * 256 + 20 + 20)
227
227
  {
228
228
  p_close(fd);
229
- giterr_set(GITERR_ODB, "invalid pack index '%s'", path);
229
+ git_error_set(GIT_ERROR_ODB, "invalid pack index '%s'", path);
230
230
  return -1;
231
231
  }
232
232
 
@@ -326,19 +326,19 @@ static int pack_index_open(struct git_pack_file *p)
326
326
  git_buf_put(&idx_name, p->pack_name, name_len - strlen(".pack"));
327
327
  git_buf_puts(&idx_name, ".idx");
328
328
  if (git_buf_oom(&idx_name)) {
329
- git_buf_free(&idx_name);
329
+ git_buf_dispose(&idx_name);
330
330
  return -1;
331
331
  }
332
332
 
333
333
  if ((error = git_mutex_lock(&p->lock)) < 0) {
334
- git_buf_free(&idx_name);
334
+ git_buf_dispose(&idx_name);
335
335
  return error;
336
336
  }
337
337
 
338
338
  if (p->index_version == -1)
339
339
  error = pack_index_check(idx_name.ptr, p);
340
340
 
341
- git_buf_free(&idx_name);
341
+ git_buf_dispose(&idx_name);
342
342
 
343
343
  git_mutex_unlock(&p->lock);
344
344
 
@@ -378,12 +378,12 @@ static unsigned char *pack_window_open(
378
378
  * - each byte afterwards: low seven bits are size continuation,
379
379
  * with the high bit being "size continues"
380
380
  */
381
- size_t git_packfile__object_header(unsigned char *hdr, size_t size, git_otype type)
381
+ size_t git_packfile__object_header(unsigned char *hdr, size_t size, git_object_t type)
382
382
  {
383
383
  unsigned char *hdr_base;
384
384
  unsigned char c;
385
385
 
386
- assert(type >= GIT_OBJ_COMMIT && type <= GIT_OBJ_REF_DELTA);
386
+ assert(type >= GIT_OBJECT_COMMIT && type <= GIT_OBJECT_REF_DELTA);
387
387
 
388
388
  /* TODO: add support for chunked objects; see git.git 6c0d19b1 */
389
389
 
@@ -405,7 +405,7 @@ size_t git_packfile__object_header(unsigned char *hdr, size_t size, git_otype ty
405
405
  static int packfile_unpack_header1(
406
406
  unsigned long *usedp,
407
407
  size_t *sizep,
408
- git_otype *type,
408
+ git_object_t *type,
409
409
  const unsigned char *buf,
410
410
  unsigned long len)
411
411
  {
@@ -419,13 +419,13 @@ static int packfile_unpack_header1(
419
419
  shift = 4;
420
420
  while (c & 0x80) {
421
421
  if (len <= used) {
422
- giterr_set(GITERR_ODB, "buffer too small");
422
+ git_error_set(GIT_ERROR_ODB, "buffer too small");
423
423
  return GIT_EBUFS;
424
424
  }
425
425
 
426
426
  if (bitsizeof(long) <= shift) {
427
427
  *usedp = 0;
428
- giterr_set(GITERR_ODB, "packfile corrupted");
428
+ git_error_set(GIT_ERROR_ODB, "packfile corrupted");
429
429
  return -1;
430
430
  }
431
431
 
@@ -441,7 +441,7 @@ static int packfile_unpack_header1(
441
441
 
442
442
  int git_packfile_unpack_header(
443
443
  size_t *size_p,
444
- git_otype *type_p,
444
+ git_object_t *type_p,
445
445
  git_mwindow_file *mwf,
446
446
  git_mwindow **w_curs,
447
447
  git_off_t *curpos)
@@ -475,14 +475,14 @@ int git_packfile_unpack_header(
475
475
 
476
476
  int git_packfile_resolve_header(
477
477
  size_t *size_p,
478
- git_otype *type_p,
478
+ git_object_t *type_p,
479
479
  struct git_pack_file *p,
480
480
  git_off_t offset)
481
481
  {
482
482
  git_mwindow *w_curs = NULL;
483
483
  git_off_t curpos = offset;
484
484
  size_t size;
485
- git_otype type;
485
+ git_object_t type;
486
486
  git_off_t base_offset;
487
487
  int error;
488
488
 
@@ -490,7 +490,7 @@ int git_packfile_resolve_header(
490
490
  if (error < 0)
491
491
  return error;
492
492
 
493
- if (type == GIT_OBJ_OFS_DELTA || type == GIT_OBJ_REF_DELTA) {
493
+ if (type == GIT_OBJECT_OFS_DELTA || type == GIT_OBJECT_REF_DELTA) {
494
494
  size_t base_size;
495
495
  git_packfile_stream stream;
496
496
 
@@ -499,7 +499,7 @@ int git_packfile_resolve_header(
499
499
  if ((error = git_packfile_stream_open(&stream, p, curpos)) < 0)
500
500
  return error;
501
501
  error = git_delta_read_header_fromstream(&base_size, size_p, &stream);
502
- git_packfile_stream_free(&stream);
502
+ git_packfile_stream_dispose(&stream);
503
503
  if (error < 0)
504
504
  return error;
505
505
  } else {
@@ -507,12 +507,12 @@ int git_packfile_resolve_header(
507
507
  base_offset = 0;
508
508
  }
509
509
 
510
- while (type == GIT_OBJ_OFS_DELTA || type == GIT_OBJ_REF_DELTA) {
510
+ while (type == GIT_OBJECT_OFS_DELTA || type == GIT_OBJECT_REF_DELTA) {
511
511
  curpos = base_offset;
512
512
  error = git_packfile_unpack_header(&size, &type, &p->mwf, &w_curs, &curpos);
513
513
  if (error < 0)
514
514
  return error;
515
- if (type != GIT_OBJ_OFS_DELTA && type != GIT_OBJ_REF_DELTA)
515
+ if (type != GIT_OBJECT_OFS_DELTA && type != GIT_OBJECT_REF_DELTA)
516
516
  break;
517
517
  base_offset = get_delta_base(p, &w_curs, &curpos, type, base_offset);
518
518
  git_mwindow_close(&w_curs);
@@ -540,7 +540,7 @@ static int pack_dependency_chain(git_dependency_chain *chain_out,
540
540
  git_off_t curpos = obj_offset, base_offset;
541
541
  int error = 0, use_heap = 0;
542
542
  size_t size, elem_pos;
543
- git_otype type;
543
+ git_object_t type;
544
544
 
545
545
  elem_pos = 0;
546
546
  while (true) {
@@ -557,7 +557,7 @@ static int pack_dependency_chain(git_dependency_chain *chain_out,
557
557
  /* if we run out of space on the small stack, use the array */
558
558
  if (elem_pos == SMALL_STACK_SIZE) {
559
559
  git_array_init_to_size(chain, elem_pos);
560
- GITERR_CHECK_ARRAY(chain);
560
+ GIT_ERROR_CHECK_ARRAY(chain);
561
561
  memcpy(chain.ptr, small_stack, elem_pos * sizeof(struct pack_chain_elem));
562
562
  chain.size = elem_pos;
563
563
  use_heap = 1;
@@ -586,7 +586,7 @@ static int pack_dependency_chain(git_dependency_chain *chain_out,
586
586
  elem->type = type;
587
587
  elem->base_key = obj_offset;
588
588
 
589
- if (type != GIT_OBJ_OFS_DELTA && type != GIT_OBJ_REF_DELTA)
589
+ if (type != GIT_OBJECT_OFS_DELTA && type != GIT_OBJECT_REF_DELTA)
590
590
  break;
591
591
 
592
592
  base_offset = get_delta_base(p, &w_curs, &curpos, type, obj_offset);
@@ -609,7 +609,7 @@ static int pack_dependency_chain(git_dependency_chain *chain_out,
609
609
  elem_pos++;
610
610
  }
611
611
 
612
-
612
+
613
613
  *stack_sz = elem_pos + 1;
614
614
  *chain_out = chain;
615
615
  return error;
@@ -632,7 +632,7 @@ int git_packfile_unpack(
632
632
  git_pack_cache_entry *cached = NULL;
633
633
  struct pack_chain_elem small_stack[SMALL_STACK_SIZE];
634
634
  size_t stack_size = 0, elem_pos, alloclen;
635
- git_otype base_type;
635
+ git_object_t base_type;
636
636
 
637
637
  /*
638
638
  * TODO: optionally check the CRC on the packfile
@@ -644,7 +644,7 @@ int git_packfile_unpack(
644
644
 
645
645
  obj->data = NULL;
646
646
  obj->len = 0;
647
- obj->type = GIT_OBJ_BAD;
647
+ obj->type = GIT_OBJECT_INVALID;
648
648
 
649
649
  /* let's point to the right stack */
650
650
  stack = chain.ptr ? chain.ptr : small_stack;
@@ -660,10 +660,10 @@ int git_packfile_unpack(
660
660
  }
661
661
 
662
662
  switch (base_type) {
663
- case GIT_OBJ_COMMIT:
664
- case GIT_OBJ_TREE:
665
- case GIT_OBJ_BLOB:
666
- case GIT_OBJ_TAG:
663
+ case GIT_OBJECT_COMMIT:
664
+ case GIT_OBJECT_TREE:
665
+ case GIT_OBJECT_BLOB:
666
+ case GIT_OBJECT_TAG:
667
667
  if (!cached) {
668
668
  curpos = elem->offset;
669
669
  error = packfile_unpack_compressed(obj, p, &w_curs, &curpos, elem->size, elem->type);
@@ -673,8 +673,8 @@ int git_packfile_unpack(
673
673
  if (error < 0)
674
674
  goto cleanup;
675
675
  break;
676
- case GIT_OBJ_OFS_DELTA:
677
- case GIT_OBJ_REF_DELTA:
676
+ case GIT_OBJECT_OFS_DELTA:
677
+ case GIT_OBJECT_REF_DELTA:
678
678
  error = packfile_error("dependency chain ends in a delta");
679
679
  goto cleanup;
680
680
  default:
@@ -691,9 +691,9 @@ int git_packfile_unpack(
691
691
  if (cached && stack_size == 1) {
692
692
  void *data = obj->data;
693
693
 
694
- GITERR_CHECK_ALLOC_ADD(&alloclen, obj->len, 1);
694
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, obj->len, 1);
695
695
  obj->data = git__malloc(alloclen);
696
- GITERR_CHECK_ALLOC(obj->data);
696
+ GIT_ERROR_CHECK_ALLOC(obj->data);
697
697
 
698
698
  memcpy(obj->data, data, obj->len + 1);
699
699
  git_atomic_dec(&cached->refcount);
@@ -726,7 +726,7 @@ int git_packfile_unpack(
726
726
  base = *obj;
727
727
  obj->data = NULL;
728
728
  obj->len = 0;
729
- obj->type = GIT_OBJ_BAD;
729
+ obj->type = GIT_OBJECT_INVALID;
730
730
 
731
731
  error = git_delta_apply(&obj->data, &obj->len, base.data, base.len, delta.data, delta.len);
732
732
  obj->type = base_type;
@@ -793,7 +793,7 @@ int git_packfile_stream_open(git_packfile_stream *obj, struct git_pack_file *p,
793
793
  obj->zstream.next_out = Z_NULL;
794
794
  st = inflateInit(&obj->zstream);
795
795
  if (st != Z_OK) {
796
- giterr_set(GITERR_ZLIB, "failed to init packfile stream");
796
+ git_error_set(GIT_ERROR_ZLIB, "failed to init packfile stream");
797
797
  return -1;
798
798
  }
799
799
 
@@ -824,7 +824,7 @@ ssize_t git_packfile_stream_read(git_packfile_stream *obj, void *buffer, size_t
824
824
  written = len - obj->zstream.avail_out;
825
825
 
826
826
  if (st != Z_OK && st != Z_STREAM_END) {
827
- giterr_set(GITERR_ZLIB, "error reading from the zlib stream");
827
+ git_error_set(GIT_ERROR_ZLIB, "error reading from the zlib stream");
828
828
  return -1;
829
829
  }
830
830
 
@@ -840,7 +840,7 @@ ssize_t git_packfile_stream_read(git_packfile_stream *obj, void *buffer, size_t
840
840
 
841
841
  }
842
842
 
843
- void git_packfile_stream_free(git_packfile_stream *obj)
843
+ void git_packfile_stream_dispose(git_packfile_stream *obj)
844
844
  {
845
845
  inflateEnd(&obj->zstream);
846
846
  }
@@ -851,16 +851,16 @@ static int packfile_unpack_compressed(
851
851
  git_mwindow **w_curs,
852
852
  git_off_t *curpos,
853
853
  size_t size,
854
- git_otype type)
854
+ git_object_t type)
855
855
  {
856
856
  size_t buf_size;
857
857
  int st;
858
858
  z_stream stream;
859
859
  unsigned char *buffer, *in;
860
860
 
861
- GITERR_CHECK_ALLOC_ADD(&buf_size, size, 1);
861
+ GIT_ERROR_CHECK_ALLOC_ADD(&buf_size, size, 1);
862
862
  buffer = git__calloc(1, buf_size);
863
- GITERR_CHECK_ALLOC(buffer);
863
+ GIT_ERROR_CHECK_ALLOC(buffer);
864
864
 
865
865
  memset(&stream, 0, sizeof(stream));
866
866
  stream.next_out = buffer;
@@ -871,7 +871,7 @@ static int packfile_unpack_compressed(
871
871
  st = inflateInit(&stream);
872
872
  if (st != Z_OK) {
873
873
  git__free(buffer);
874
- giterr_set(GITERR_ZLIB, "failed to init zlib stream on unpack");
874
+ git_error_set(GIT_ERROR_ZLIB, "failed to init zlib stream on unpack");
875
875
 
876
876
  return -1;
877
877
  }
@@ -898,7 +898,7 @@ static int packfile_unpack_compressed(
898
898
 
899
899
  if ((st != Z_STREAM_END) || stream.total_out != size) {
900
900
  git__free(buffer);
901
- giterr_set(GITERR_ZLIB, "error inflating zlib stream");
901
+ git_error_set(GIT_ERROR_ZLIB, "error inflating zlib stream");
902
902
  return -1;
903
903
  }
904
904
 
@@ -916,7 +916,7 @@ git_off_t get_delta_base(
916
916
  struct git_pack_file *p,
917
917
  git_mwindow **w_curs,
918
918
  git_off_t *curpos,
919
- git_otype type,
919
+ git_object_t type,
920
920
  git_off_t delta_obj_offset)
921
921
  {
922
922
  unsigned int left = 0;
@@ -934,7 +934,7 @@ git_off_t get_delta_base(
934
934
  * that is assured. An OFS_DELTA longer than the hash size
935
935
  * is stupid, as then a REF_DELTA would be smaller to store.
936
936
  */
937
- if (type == GIT_OBJ_OFS_DELTA) {
937
+ if (type == GIT_OBJECT_OFS_DELTA) {
938
938
  unsigned used = 0;
939
939
  unsigned char c = base_info[used++];
940
940
  size_t unsigned_base_offset = c & 127;
@@ -951,11 +951,11 @@ git_off_t get_delta_base(
951
951
  return 0; /* out of bound */
952
952
  base_offset = delta_obj_offset - unsigned_base_offset;
953
953
  *curpos += used;
954
- } else if (type == GIT_OBJ_REF_DELTA) {
954
+ } else if (type == GIT_OBJECT_REF_DELTA) {
955
955
  /* If we have the cooperative cache, search in it first */
956
956
  if (p->has_cache) {
957
- khiter_t k;
958
957
  git_oid oid;
958
+ size_t k;
959
959
 
960
960
  git_oid_fromraw(&oid, base_info);
961
961
  k = git_oidmap_lookup_index(p->idx_cache, &oid);
@@ -1087,7 +1087,7 @@ static int packfile_open(struct git_pack_file *p)
1087
1087
  return 0;
1088
1088
 
1089
1089
  cleanup:
1090
- giterr_set(GITERR_OS, "invalid packfile '%s'", p->pack_name);
1090
+ git_error_set(GIT_ERROR_OS, "invalid packfile '%s'", p->pack_name);
1091
1091
 
1092
1092
  if (p->mwf.fd >= 0)
1093
1093
  p_close(p->mwf.fd);
@@ -1126,11 +1126,11 @@ int git_packfile_alloc(struct git_pack_file **pack_out, const char *path)
1126
1126
  if (path_len < strlen(".idx"))
1127
1127
  return git_odb__error_notfound("invalid packfile path", NULL, 0);
1128
1128
 
1129
- GITERR_CHECK_ALLOC_ADD(&alloc_len, sizeof(*p), path_len);
1130
- GITERR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 2);
1129
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, sizeof(*p), path_len);
1130
+ GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 2);
1131
1131
 
1132
1132
  p = git__calloc(1, alloc_len);
1133
- GITERR_CHECK_ALLOC(p);
1133
+ GIT_ERROR_CHECK_ALLOC(p);
1134
1134
 
1135
1135
  memcpy(p->pack_name, path, path_len + 1);
1136
1136
 
@@ -1163,7 +1163,7 @@ int git_packfile_alloc(struct git_pack_file **pack_out, const char *path)
1163
1163
  p->index_version = -1;
1164
1164
 
1165
1165
  if (git_mutex_init(&p->lock)) {
1166
- giterr_set(GITERR_OS, "failed to initialize packfile mutex");
1166
+ git_error_set(GIT_ERROR_OS, "failed to initialize packfile mutex");
1167
1167
  git__free(p);
1168
1168
  return -1;
1169
1169
  }
@@ -1266,7 +1266,7 @@ int git_pack_foreach_entry(
1266
1266
 
1267
1267
  for (i = 0; i < p->num_objects; i++)
1268
1268
  if ((error = cb(p->oids[i], data)) != 0)
1269
- return giterr_set_after_callback(error);
1269
+ return git_error_set_after_callback(error);
1270
1270
 
1271
1271
  return error;
1272
1272
  }
@@ -1352,7 +1352,7 @@ static int pack_entry_find_offset(
1352
1352
  return git_odb__error_ambiguous("found multiple offsets for pack entry");
1353
1353
 
1354
1354
  if ((offset = nth_packed_object_offset(p, pos)) < 0) {
1355
- giterr_set(GITERR_ODB, "packfile index is corrupt");
1355
+ git_error_set(GIT_ERROR_ODB, "packfile index is corrupt");
1356
1356
  return -1;
1357
1357
  }
1358
1358