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
@@ -218,7 +218,7 @@ static int packfile_load__cb(void *data, git_buf *path)
218
218
 
219
219
  /* ignore missing .pack file as git does */
220
220
  if (error == GIT_ENOTFOUND) {
221
- giterr_clear();
221
+ git_error_clear();
222
222
  return 0;
223
223
  }
224
224
 
@@ -346,14 +346,14 @@ static int pack_backend__refresh(git_odb_backend *backend_)
346
346
  /* reload all packs */
347
347
  error = git_path_direach(&path, 0, packfile_load__cb, backend);
348
348
 
349
- git_buf_free(&path);
349
+ git_buf_dispose(&path);
350
350
  git_vector_sort(&backend->packs);
351
351
 
352
352
  return error;
353
353
  }
354
354
 
355
355
  static int pack_backend__read_header(
356
- size_t *len_p, git_otype *type_p,
356
+ size_t *len_p, git_object_t *type_p,
357
357
  struct git_odb_backend *backend, const git_oid *oid)
358
358
  {
359
359
  struct git_pack_entry e;
@@ -390,7 +390,7 @@ static int pack_backend__freshen(
390
390
  }
391
391
 
392
392
  static int pack_backend__read(
393
- void **buffer_p, size_t *len_p, git_otype *type_p,
393
+ void **buffer_p, size_t *len_p, git_object_t *type_p,
394
394
  git_odb_backend *backend, const git_oid *oid)
395
395
  {
396
396
  struct git_pack_entry e;
@@ -412,7 +412,7 @@ static int pack_backend__read_prefix(
412
412
  git_oid *out_oid,
413
413
  void **buffer_p,
414
414
  size_t *len_p,
415
- git_otype *type_p,
415
+ git_object_t *type_p,
416
416
  git_odb_backend *backend,
417
417
  const git_oid *short_oid,
418
418
  size_t len)
@@ -478,7 +478,7 @@ static int pack_backend__foreach(git_odb_backend *_backend, git_odb_foreach_cb c
478
478
  return error;
479
479
 
480
480
  git_vector_foreach(&backend->packs, i, p) {
481
- if ((error = git_pack_foreach_entry(p, cb, data)) < 0)
481
+ if ((error = git_pack_foreach_entry(p, cb, data)) != 0)
482
482
  return error;
483
483
  }
484
484
 
@@ -519,6 +519,7 @@ static int pack_backend__writepack(struct git_odb_writepack **out,
519
519
  git_transfer_progress_cb progress_cb,
520
520
  void *progress_payload)
521
521
  {
522
+ git_indexer_options opts = GIT_INDEXER_OPTIONS_INIT;
522
523
  struct pack_backend *backend;
523
524
  struct pack_writepack *writepack;
524
525
 
@@ -526,13 +527,16 @@ static int pack_backend__writepack(struct git_odb_writepack **out,
526
527
 
527
528
  *out = NULL;
528
529
 
530
+ opts.progress_cb = progress_cb;
531
+ opts.progress_cb_payload = progress_payload;
532
+
529
533
  backend = (struct pack_backend *)_backend;
530
534
 
531
535
  writepack = git__calloc(1, sizeof(struct pack_writepack));
532
- GITERR_CHECK_ALLOC(writepack);
536
+ GIT_ERROR_CHECK_ALLOC(writepack);
533
537
 
534
538
  if (git_indexer_new(&writepack->indexer,
535
- backend->pack_folder, 0, odb, progress_cb, progress_payload) < 0) {
539
+ backend->pack_folder, 0, odb, &opts) < 0) {
536
540
  git__free(writepack);
537
541
  return -1;
538
542
  }
@@ -569,7 +573,7 @@ static void pack_backend__free(git_odb_backend *_backend)
569
573
  static int pack_backend__alloc(struct pack_backend **out, size_t initial_size)
570
574
  {
571
575
  struct pack_backend *backend = git__calloc(1, sizeof(struct pack_backend));
572
- GITERR_CHECK_ALLOC(backend);
576
+ GIT_ERROR_CHECK_ALLOC(backend);
573
577
 
574
578
  if (git_vector_init(&backend->packs, initial_size, packfile_sort__cb) < 0) {
575
579
  git__free(backend);
@@ -635,7 +639,7 @@ int git_odb_backend_pack(git_odb_backend **backend_out, const char *objects_dir)
635
639
 
636
640
  *backend_out = (git_odb_backend *)backend;
637
641
 
638
- git_buf_free(&path);
642
+ git_buf_dispose(&path);
639
643
 
640
644
  return error;
641
645
  }
@@ -7,6 +7,15 @@
7
7
 
8
8
  #include "offmap.h"
9
9
 
10
+ #define kmalloc git__malloc
11
+ #define kcalloc git__calloc
12
+ #define krealloc git__realloc
13
+ #define kreallocarray git__reallocarray
14
+ #define kfree git__free
15
+ #include "khash.h"
16
+
17
+ __KHASH_TYPE(off, git_off_t, void *)
18
+
10
19
  __KHASH_IMPL(off, static kh_inline, git_off_t, void *, 1, kh_int64_hash_func, kh_int64_hash_equal)
11
20
 
12
21
  git_offmap *git_offmap_alloc(void)
@@ -44,6 +53,16 @@ int git_offmap_exists(git_offmap *map, const git_off_t key)
44
53
  return kh_get(off, map, key) != kh_end(map);
45
54
  }
46
55
 
56
+ int git_offmap_has_data(git_offmap *map, size_t idx)
57
+ {
58
+ return kh_exist(map, idx);
59
+ }
60
+
61
+ git_off_t git_offmap_key_at(git_offmap *map, size_t idx)
62
+ {
63
+ return kh_key(map, idx);
64
+ }
65
+
47
66
  void *git_offmap_value_at(git_offmap *map, size_t idx)
48
67
  {
49
68
  return kh_val(map, idx);
@@ -81,3 +100,14 @@ void git_offmap_delete(git_offmap *map, const git_off_t key)
81
100
  if (git_offmap_valid_index(map, idx))
82
101
  git_offmap_delete_at(map, idx);
83
102
  }
103
+
104
+ size_t git_offmap_begin(git_offmap *map)
105
+ {
106
+ GIT_UNUSED(map);
107
+ return 0;
108
+ }
109
+
110
+ size_t git_offmap_end(git_offmap *map)
111
+ {
112
+ return map->n_buckets;
113
+ }
@@ -11,15 +11,7 @@
11
11
 
12
12
  #include "git2/types.h"
13
13
 
14
- #define kmalloc git__malloc
15
- #define kcalloc git__calloc
16
- #define krealloc git__realloc
17
- #define kreallocarray git__reallocarray
18
- #define kfree git__free
19
- #include "khash.h"
20
-
21
- __KHASH_TYPE(off, git_off_t, void *)
22
- typedef khash_t(off) git_offmap;
14
+ typedef struct kh_off_s git_offmap;
23
15
 
24
16
  git_offmap *git_offmap_alloc(void);
25
17
  void git_offmap_free(git_offmap *map);
@@ -31,7 +23,9 @@ size_t git_offmap_lookup_index(git_offmap *map, const git_off_t key);
31
23
  int git_offmap_valid_index(git_offmap *map, size_t idx);
32
24
 
33
25
  int git_offmap_exists(git_offmap *map, const git_off_t key);
26
+ int git_offmap_has_data(git_offmap *map, size_t idx);
34
27
 
28
+ git_off_t git_offmap_key_at(git_offmap *map, size_t idx);
35
29
  void *git_offmap_value_at(git_offmap *map, size_t idx);
36
30
  void git_offmap_set_value_at(git_offmap *map, size_t idx, void *value);
37
31
  void git_offmap_delete_at(git_offmap *map, size_t idx);
@@ -40,7 +34,22 @@ int git_offmap_put(git_offmap *map, const git_off_t key, int *err);
40
34
  void git_offmap_insert(git_offmap *map, const git_off_t key, void *value, int *rval);
41
35
  void git_offmap_delete(git_offmap *map, const git_off_t key);
42
36
 
43
- #define git_offmap_foreach kh_foreach
44
- #define git_offmap_foreach_value kh_foreach_value
37
+ size_t git_offmap_begin(git_offmap *map);
38
+ size_t git_offmap_end(git_offmap *map);
39
+
40
+ #define git_offmap_foreach(h, kvar, vvar, code) { size_t __i; \
41
+ for (__i = git_offmap_begin(h); __i != git_offmap_end(h); ++__i) { \
42
+ if (!git_offmap_has_data(h,__i)) continue; \
43
+ (kvar) = git_offmap_key_at(h,__i); \
44
+ (vvar) = git_offmap_value_at(h,__i); \
45
+ code; \
46
+ } }
47
+
48
+ #define git_offmap_foreach_value(h, vvar, code) { size_t __i; \
49
+ for (__i = git_offmap_begin(h); __i != git_offmap_end(h); ++__i) { \
50
+ if (!git_offmap_has_data(h,__i)) continue; \
51
+ (vvar) = git_offmap_value_at(h,__i); \
52
+ code; \
53
+ } }
45
54
 
46
55
  #endif
@@ -17,7 +17,7 @@ static char to_hex[] = "0123456789abcdef";
17
17
 
18
18
  static int oid_error_invalid(const char *msg)
19
19
  {
20
- giterr_set(GITERR_INVALID, "unable to parse OID - %s", msg);
20
+ git_error_set(GIT_ERROR_INVALID, "unable to parse OID - %s", msg);
21
21
  return -1;
22
22
  }
23
23
 
@@ -263,7 +263,7 @@ struct git_oid_shorten {
263
263
  static int resize_trie(git_oid_shorten *self, size_t new_size)
264
264
  {
265
265
  self->nodes = git__reallocarray(self->nodes, new_size, sizeof(trie_node));
266
- GITERR_CHECK_ALLOC(self->nodes);
266
+ GIT_ERROR_CHECK_ALLOC(self->nodes);
267
267
 
268
268
  if (new_size > self->size) {
269
269
  memset(&self->nodes[self->size], 0x0, (new_size - self->size) * sizeof(trie_node));
@@ -381,7 +381,7 @@ int git_oid_shorten_add(git_oid_shorten *os, const char *text_oid)
381
381
  node_index idx;
382
382
 
383
383
  if (os->full) {
384
- giterr_set(GITERR_INVALID, "unable to shorten OID - OID set full");
384
+ git_error_set(GIT_ERROR_INVALID, "unable to shorten OID - OID set full");
385
385
  return -1;
386
386
  }
387
387
 
@@ -396,7 +396,7 @@ int git_oid_shorten_add(git_oid_shorten *os, const char *text_oid)
396
396
  trie_node *node;
397
397
 
398
398
  if (c == -1) {
399
- giterr_set(GITERR_INVALID, "unable to shorten OID - invalid hex value");
399
+ git_error_set(GIT_ERROR_INVALID, "unable to shorten OID - invalid hex value");
400
400
  return -1;
401
401
  }
402
402
 
@@ -411,7 +411,7 @@ int git_oid_shorten_add(git_oid_shorten *os, const char *text_oid)
411
411
  node = push_leaf(os, idx, git__fromhex(tail[0]), &tail[1]);
412
412
  if (node == NULL) {
413
413
  if (os->full)
414
- giterr_set(GITERR_INVALID, "unable to shorten OID - OID set full");
414
+ git_error_set(GIT_ERROR_INVALID, "unable to shorten OID - OID set full");
415
415
  return -1;
416
416
  }
417
417
  }
@@ -419,7 +419,7 @@ int git_oid_shorten_add(git_oid_shorten *os, const char *text_oid)
419
419
  if (node->children[c] == 0) {
420
420
  if (push_leaf(os, idx, c, &text_oid[i + 1]) == NULL) {
421
421
  if (os->full)
422
- giterr_set(GITERR_INVALID, "unable to shorten OID - OID set full");
422
+ git_error_set(GIT_ERROR_INVALID, "unable to shorten OID - OID set full");
423
423
  return -1;
424
424
  }
425
425
  break;
@@ -7,6 +7,15 @@
7
7
 
8
8
  #include "oidmap.h"
9
9
 
10
+ #define kmalloc git__malloc
11
+ #define kcalloc git__calloc
12
+ #define krealloc git__realloc
13
+ #define kreallocarray git__reallocarray
14
+ #define kfree git__free
15
+ #include "khash.h"
16
+
17
+ __KHASH_TYPE(oid, const git_oid *, void *)
18
+
10
19
  GIT_INLINE(khint_t) git_oidmap_hash(const git_oid *oid)
11
20
  {
12
21
  khint_t h;
@@ -103,3 +112,14 @@ void git_oidmap_delete(git_oidmap *map, const git_oid *key)
103
112
  if (git_oidmap_valid_index(map, idx))
104
113
  git_oidmap_delete_at(map, idx);
105
114
  }
115
+
116
+ size_t git_oidmap_begin(git_oidmap *map)
117
+ {
118
+ GIT_UNUSED(map);
119
+ return 0;
120
+ }
121
+
122
+ size_t git_oidmap_end(git_oidmap *map)
123
+ {
124
+ return map->n_buckets;
125
+ }
@@ -11,15 +11,7 @@
11
11
 
12
12
  #include "git2/oid.h"
13
13
 
14
- #define kmalloc git__malloc
15
- #define kcalloc git__calloc
16
- #define krealloc git__realloc
17
- #define kreallocarray git__reallocarray
18
- #define kfree git__free
19
- #include "khash.h"
20
-
21
- __KHASH_TYPE(oid, const git_oid *, void *)
22
- typedef khash_t(oid) git_oidmap;
14
+ typedef struct kh_oid_s git_oidmap;
23
15
 
24
16
  git_oidmap *git_oidmap_alloc(void);
25
17
  void git_oidmap_free(git_oidmap *map);
@@ -43,9 +35,14 @@ int git_oidmap_put(git_oidmap *map, const git_oid *key, int *err);
43
35
  void git_oidmap_insert(git_oidmap *map, const git_oid *key, void *value, int *rval);
44
36
  void git_oidmap_delete(git_oidmap *map, const git_oid *key);
45
37
 
46
- #define git_oidmap_foreach_value kh_foreach_value
38
+ size_t git_oidmap_begin(git_oidmap *map);
39
+ size_t git_oidmap_end(git_oidmap *map);
47
40
 
48
- #define git_oidmap_begin kh_begin
49
- #define git_oidmap_end kh_end
41
+ #define git_oidmap_foreach_value(h, vvar, code) { size_t __i; \
42
+ for (__i = git_oidmap_begin(h); __i != git_oidmap_end(h); ++__i) { \
43
+ if (!git_oidmap_has_data(h,__i)) continue; \
44
+ (vvar) = git_oidmap_value_at(h,__i); \
45
+ code; \
46
+ } }
50
47
 
51
48
  #endif
@@ -41,6 +41,12 @@ struct pack_write_context {
41
41
  git_transfer_progress *stats;
42
42
  };
43
43
 
44
+ struct walk_object {
45
+ git_oid id;
46
+ unsigned int uninteresting:1,
47
+ seen:1;
48
+ };
49
+
44
50
  #ifdef GIT_THREADS
45
51
 
46
52
  #define GIT_PACKBUILDER__MUTEX_OP(pb, mtx, op) do { \
@@ -99,7 +105,7 @@ static int packbuilder_config(git_packbuilder *pb)
99
105
  ret = git_config_get_int64(&val, config, KEY); \
100
106
  if (!ret) { \
101
107
  if (!git__is_sizet(val)) { \
102
- giterr_set(GITERR_CONFIG, \
108
+ git_error_set(GIT_ERROR_CONFIG, \
103
109
  "configuration value '%s' is too large", KEY); \
104
110
  ret = -1; \
105
111
  goto out; \
@@ -133,7 +139,7 @@ int git_packbuilder_new(git_packbuilder **out, git_repository *repo)
133
139
  *out = NULL;
134
140
 
135
141
  pb = git__calloc(1, sizeof(*pb));
136
- GITERR_CHECK_ALLOC(pb);
142
+ GIT_ERROR_CHECK_ALLOC(pb);
137
143
 
138
144
  pb->object_ix = git_oidmap_alloc();
139
145
  if (!pb->object_ix)
@@ -143,7 +149,7 @@ int git_packbuilder_new(git_packbuilder **out, git_repository *repo)
143
149
  if (!pb->walk_objects)
144
150
  goto on_error;
145
151
 
146
- git_pool_init(&pb->object_pool, sizeof(git_walk_object));
152
+ git_pool_init(&pb->object_pool, sizeof(struct walk_object));
147
153
 
148
154
  pb->repo = repo;
149
155
  pb->nr_threads = 1; /* do not spawn any thread by default */
@@ -160,7 +166,7 @@ int git_packbuilder_new(git_packbuilder **out, git_repository *repo)
160
166
  git_mutex_init(&pb->progress_mutex) ||
161
167
  git_cond_init(&pb->progress_cond))
162
168
  {
163
- giterr_set(GITERR_OS, "failed to initialize packbuilder mutex");
169
+ git_error_set(GIT_ERROR_OS, "failed to initialize packbuilder mutex");
164
170
  goto on_error;
165
171
  }
166
172
 
@@ -191,8 +197,7 @@ unsigned int git_packbuilder_set_threads(git_packbuilder *pb, unsigned int n)
191
197
  static void rehash(git_packbuilder *pb)
192
198
  {
193
199
  git_pobject *po;
194
- khiter_t pos;
195
- size_t i;
200
+ size_t pos, i;
196
201
  int ret;
197
202
 
198
203
  git_oidmap_clear(pb->object_ix);
@@ -206,8 +211,7 @@ int git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
206
211
  const char *name)
207
212
  {
208
213
  git_pobject *po;
209
- khiter_t pos;
210
- size_t newsize;
214
+ size_t newsize, pos;
211
215
  int ret;
212
216
 
213
217
  assert(pb && oid);
@@ -218,11 +222,11 @@ int git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
218
222
  return 0;
219
223
 
220
224
  if (pb->nr_objects >= pb->nr_alloc) {
221
- GITERR_CHECK_ALLOC_ADD(&newsize, pb->nr_alloc, 1024);
222
- GITERR_CHECK_ALLOC_MULTIPLY(&newsize, newsize, 3 / 2);
225
+ GIT_ERROR_CHECK_ALLOC_ADD(&newsize, pb->nr_alloc, 1024);
226
+ GIT_ERROR_CHECK_ALLOC_MULTIPLY(&newsize, newsize, 3 / 2);
223
227
 
224
228
  if (!git__is_uint32(newsize)) {
225
- giterr_set(GITERR_NOMEMORY, "packfile too large to fit in memory.");
229
+ git_error_set(GIT_ERROR_NOMEMORY, "packfile too large to fit in memory.");
226
230
  return -1;
227
231
  }
228
232
 
@@ -230,7 +234,7 @@ int git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
230
234
 
231
235
  pb->object_list = git__reallocarray(pb->object_list,
232
236
  pb->nr_alloc, sizeof(*po));
233
- GITERR_CHECK_ALLOC(pb->object_list);
237
+ GIT_ERROR_CHECK_ALLOC(pb->object_list);
234
238
  rehash(pb);
235
239
  }
236
240
 
@@ -246,7 +250,7 @@ int git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
246
250
 
247
251
  pos = git_oidmap_put(pb->object_ix, &po->id, &ret);
248
252
  if (ret < 0) {
249
- giterr_set_oom();
253
+ git_error_set_oom();
250
254
  return ret;
251
255
  }
252
256
  assert(ret != 0);
@@ -266,7 +270,7 @@ int git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
266
270
  pb->nr_objects, 0, pb->progress_cb_payload);
267
271
 
268
272
  if (ret)
269
- return giterr_set_after_callback(ret);
273
+ return git_error_set_after_callback(ret);
270
274
  }
271
275
  }
272
276
 
@@ -295,7 +299,7 @@ static int get_delta(void **out, git_odb *odb, git_pobject *po)
295
299
  goto on_error;
296
300
 
297
301
  if (error == GIT_EBUFS || delta_size != po->delta_size) {
298
- giterr_set(GITERR_INVALID, "delta size changed");
302
+ git_error_set(GIT_ERROR_INVALID, "delta size changed");
299
303
  goto on_error;
300
304
  }
301
305
 
@@ -318,7 +322,7 @@ static int write_object(
318
322
  void *cb_data)
319
323
  {
320
324
  git_odb_object *obj = NULL;
321
- git_otype type;
325
+ git_object_t type;
322
326
  unsigned char hdr[10], *zbuf = NULL;
323
327
  void *data = NULL;
324
328
  size_t hdr_len, zbuf_len = COMPRESS_BUFLEN, data_len;
@@ -336,7 +340,7 @@ static int write_object(
336
340
  goto done;
337
341
 
338
342
  data_len = po->delta_size;
339
- type = GIT_OBJ_REF_DELTA;
343
+ type = GIT_OBJECT_REF_DELTA;
340
344
  } else {
341
345
  if ((error = git_odb_read(&obj, pb->odb, &po->id)) < 0)
342
346
  goto done;
@@ -353,7 +357,7 @@ static int write_object(
353
357
  (error = git_hash_update(&pb->ctx, hdr, hdr_len)) < 0)
354
358
  goto done;
355
359
 
356
- if (type == GIT_OBJ_REF_DELTA) {
360
+ if (type == GIT_OBJECT_REF_DELTA) {
357
361
  if ((error = write_cb(po->delta->id.id, GIT_OID_RAWSZ, cb_data)) < 0 ||
358
362
  (error = git_hash_update(&pb->ctx, po->delta->id.id, GIT_OID_RAWSZ)) < 0)
359
363
  goto done;
@@ -368,7 +372,7 @@ static int write_object(
368
372
  goto done;
369
373
  } else {
370
374
  zbuf = git__malloc(zbuf_len);
371
- GITERR_CHECK_ALLOC(zbuf);
375
+ GIT_ERROR_CHECK_ALLOC(zbuf);
372
376
 
373
377
  git_zstream_reset(&pb->zstream);
374
378
  git_zstream_set_input(&pb->zstream, data, data_len);
@@ -510,7 +514,7 @@ static int cb_tag_foreach(const char *name, git_oid *oid, void *data)
510
514
  {
511
515
  git_packbuilder *pb = data;
512
516
  git_pobject *po;
513
- khiter_t pos;
517
+ size_t pos;
514
518
 
515
519
  GIT_UNUSED(name);
516
520
 
@@ -590,8 +594,8 @@ static git_pobject **compute_write_order(git_packbuilder *pb)
590
594
  */
591
595
  for (i = last_untagged; i < pb->nr_objects; i++) {
592
596
  git_pobject *po = pb->object_list + i;
593
- if (po->type != GIT_OBJ_COMMIT &&
594
- po->type != GIT_OBJ_TAG)
597
+ if (po->type != GIT_OBJECT_COMMIT &&
598
+ po->type != GIT_OBJECT_TAG)
595
599
  continue;
596
600
  add_to_write_order(wo, &wo_end, po);
597
601
  }
@@ -601,7 +605,7 @@ static git_pobject **compute_write_order(git_packbuilder *pb)
601
605
  */
602
606
  for (i = last_untagged; i < pb->nr_objects; i++) {
603
607
  git_pobject *po = pb->object_list + i;
604
- if (po->type != GIT_OBJ_TREE)
608
+ if (po->type != GIT_OBJECT_TREE)
605
609
  continue;
606
610
  add_to_write_order(wo, &wo_end, po);
607
611
  }
@@ -617,7 +621,7 @@ static git_pobject **compute_write_order(git_packbuilder *pb)
617
621
 
618
622
  if (wo_end != pb->nr_objects) {
619
623
  git__free(wo);
620
- giterr_set(GITERR_INVALID, "invalid write order");
624
+ git_error_set(GIT_ERROR_INVALID, "invalid write order");
621
625
  return NULL;
622
626
  }
623
627
 
@@ -641,7 +645,7 @@ static int write_pack(git_packbuilder *pb,
641
645
  return -1;
642
646
 
643
647
  if (!git__is_uint32(pb->nr_objects)) {
644
- giterr_set(GITERR_INVALID, "too many objects");
648
+ git_error_set(GIT_ERROR_INVALID, "too many objects");
645
649
  return -1;
646
650
  }
647
651
 
@@ -798,13 +802,13 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
798
802
 
799
803
  sz = git_odb_object_size(obj);
800
804
  trg->data = git__malloc(sz);
801
- GITERR_CHECK_ALLOC(trg->data);
805
+ GIT_ERROR_CHECK_ALLOC(trg->data);
802
806
  memcpy(trg->data, git_odb_object_data(obj), sz);
803
807
 
804
808
  git_odb_object_free(obj);
805
809
 
806
810
  if (sz != trg_size) {
807
- giterr_set(GITERR_INVALID,
811
+ git_error_set(GIT_ERROR_INVALID,
808
812
  "inconsistent target object length");
809
813
  return -1;
810
814
  }
@@ -820,13 +824,13 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
820
824
 
821
825
  sz = obj_sz;
822
826
  src->data = git__malloc(sz);
823
- GITERR_CHECK_ALLOC(src->data);
827
+ GIT_ERROR_CHECK_ALLOC(src->data);
824
828
  memcpy(src->data, git_odb_object_data(obj), sz);
825
829
 
826
830
  git_odb_object_free(obj);
827
831
 
828
832
  if (sz != src_size) {
829
- giterr_set(GITERR_INVALID,
833
+ git_error_set(GIT_ERROR_INVALID,
830
834
  "inconsistent source object length");
831
835
  return -1;
832
836
  }
@@ -872,7 +876,7 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
872
876
  }
873
877
 
874
878
  trg_object->delta_data = git__realloc(delta_buf, delta_size);
875
- GITERR_CHECK_ALLOC(trg_object->delta_data);
879
+ GIT_ERROR_CHECK_ALLOC(trg_object->delta_data);
876
880
  } else {
877
881
  /* create delta when writing the pack */
878
882
  git_packbuilder__cache_unlock(pb);
@@ -938,7 +942,7 @@ static int report_delta_progress(
938
942
  count, pb->nr_objects, pb->progress_cb_payload);
939
943
 
940
944
  if (ret)
941
- return giterr_set_after_callback(ret);
945
+ return git_error_set_after_callback(ret);
942
946
  }
943
947
  }
944
948
 
@@ -957,7 +961,7 @@ static int find_deltas(git_packbuilder *pb, git_pobject **list,
957
961
  int error = -1;
958
962
 
959
963
  array = git__calloc(window, sizeof(struct unpacked));
960
- GITERR_CHECK_ALLOC(array);
964
+ GIT_ERROR_CHECK_ALLOC(array);
961
965
 
962
966
  for (;;) {
963
967
  struct unpacked *n = array + idx;
@@ -1043,7 +1047,7 @@ static int find_deltas(git_packbuilder *pb, git_pobject **list,
1043
1047
 
1044
1048
  git__free(po->delta_data);
1045
1049
  po->delta_data = git__malloc(zbuf.size);
1046
- GITERR_CHECK_ALLOC(po->delta_data);
1050
+ GIT_ERROR_CHECK_ALLOC(po->delta_data);
1047
1051
 
1048
1052
  memcpy(po->delta_data, zbuf.ptr, zbuf.size);
1049
1053
  po->z_delta_size = zbuf.size;
@@ -1095,7 +1099,7 @@ on_error:
1095
1099
  git__free(array[i].data);
1096
1100
  }
1097
1101
  git__free(array);
1098
- git_buf_free(&zbuf);
1102
+ git_buf_dispose(&zbuf);
1099
1103
 
1100
1104
  return error;
1101
1105
  }
@@ -1136,7 +1140,7 @@ static void *threaded_find_deltas(void *arg)
1136
1140
  git_packbuilder__progress_unlock(me->pb);
1137
1141
 
1138
1142
  if (git_mutex_lock(&me->mutex)) {
1139
- giterr_set(GITERR_THREAD, "unable to lock packfile condition mutex");
1143
+ git_error_set(GIT_ERROR_THREAD, "unable to lock packfile condition mutex");
1140
1144
  return NULL;
1141
1145
  }
1142
1146
 
@@ -1174,7 +1178,7 @@ static int ll_find_deltas(git_packbuilder *pb, git_pobject **list,
1174
1178
  }
1175
1179
 
1176
1180
  p = git__mallocarray(pb->nr_threads, sizeof(*p));
1177
- GITERR_CHECK_ALLOC(p);
1181
+ GIT_ERROR_CHECK_ALLOC(p);
1178
1182
 
1179
1183
  /* Partition the work among the threads */
1180
1184
  for (i = 0; i < pb->nr_threads; ++i) {
@@ -1215,7 +1219,7 @@ static int ll_find_deltas(git_packbuilder *pb, git_pobject **list,
1215
1219
  ret = git_thread_create(&p[i].thread,
1216
1220
  threaded_find_deltas, &p[i]);
1217
1221
  if (ret) {
1218
- giterr_set(GITERR_THREAD, "unable to create thread");
1222
+ git_error_set(GIT_ERROR_THREAD, "unable to create thread");
1219
1223
  return -1;
1220
1224
  }
1221
1225
  active_threads++;
@@ -1284,7 +1288,7 @@ static int ll_find_deltas(git_packbuilder *pb, git_pobject **list,
1284
1288
  git_packbuilder__progress_unlock(pb);
1285
1289
 
1286
1290
  if (git_mutex_lock(&target->mutex)) {
1287
- giterr_set(GITERR_THREAD, "unable to lock packfile condition mutex");
1291
+ git_error_set(GIT_ERROR_THREAD, "unable to lock packfile condition mutex");
1288
1292
  git__free(p);
1289
1293
  return -1;
1290
1294
  }
@@ -1325,7 +1329,7 @@ static int prepare_pack(git_packbuilder *pb)
1325
1329
  pb->progress_cb(GIT_PACKBUILDER_DELTAFICATION, 0, pb->nr_objects, pb->progress_cb_payload);
1326
1330
 
1327
1331
  delta_list = git__mallocarray(pb->nr_objects, sizeof(*delta_list));
1328
- GITERR_CHECK_ALLOC(delta_list);
1332
+ GIT_ERROR_CHECK_ALLOC(delta_list);
1329
1333
 
1330
1334
  for (i = 0; i < pb->nr_objects; ++i) {
1331
1335
  git_pobject *po = pb->object_list + i;
@@ -1382,6 +1386,7 @@ int git_packbuilder_write(
1382
1386
  git_transfer_progress_cb progress_cb,
1383
1387
  void *progress_cb_payload)
1384
1388
  {
1389
+ git_indexer_options opts = GIT_INDEXER_OPTIONS_INIT;
1385
1390
  git_indexer *indexer;
1386
1391
  git_transfer_progress stats;
1387
1392
  struct pack_write_context ctx;
@@ -1389,8 +1394,11 @@ int git_packbuilder_write(
1389
1394
 
1390
1395
  PREPARE_PACK;
1391
1396
 
1397
+ opts.progress_cb = progress_cb;
1398
+ opts.progress_cb_payload = progress_cb_payload;
1399
+
1392
1400
  if (git_indexer_new(
1393
- &indexer, path, mode, pb->odb, progress_cb, progress_cb_payload) < 0)
1401
+ &indexer, path, mode, pb->odb, &opts) < 0)
1394
1402
  return -1;
1395
1403
 
1396
1404
  if (!git_repository__cvar(&t, pb->repo, GIT_CVAR_FSYNCOBJECTFILES) && t)
@@ -1426,7 +1434,7 @@ static int cb_tree_walk(
1426
1434
  struct tree_walk_context *ctx = payload;
1427
1435
 
1428
1436
  /* A commit inside a tree represents a submodule commit and should be skipped. */
1429
- if (git_tree_entry_type(entry) == GIT_OBJ_COMMIT)
1437
+ if (git_tree_entry_type(entry) == GIT_OBJECT_COMMIT)
1430
1438
  return 0;
1431
1439
 
1432
1440
  if (!(error = git_buf_sets(&ctx->buf, root)) &&
@@ -1463,7 +1471,7 @@ int git_packbuilder_insert_tree(git_packbuilder *pb, const git_oid *oid)
1463
1471
  error = git_tree_walk(tree, GIT_TREEWALK_PRE, cb_tree_walk, &context);
1464
1472
 
1465
1473
  git_tree_free(tree);
1466
- git_buf_free(&context.buf);
1474
+ git_buf_dispose(&context.buf);
1467
1475
  return error;
1468
1476
  }
1469
1477
 
@@ -1474,27 +1482,27 @@ int git_packbuilder_insert_recur(git_packbuilder *pb, const git_oid *id, const c
1474
1482
 
1475
1483
  assert(pb && id);
1476
1484
 
1477
- if ((error = git_object_lookup(&obj, pb->repo, id, GIT_OBJ_ANY)) < 0)
1485
+ if ((error = git_object_lookup(&obj, pb->repo, id, GIT_OBJECT_ANY)) < 0)
1478
1486
  return error;
1479
1487
 
1480
1488
  switch (git_object_type(obj)) {
1481
- case GIT_OBJ_BLOB:
1489
+ case GIT_OBJECT_BLOB:
1482
1490
  error = git_packbuilder_insert(pb, id, name);
1483
1491
  break;
1484
- case GIT_OBJ_TREE:
1492
+ case GIT_OBJECT_TREE:
1485
1493
  error = git_packbuilder_insert_tree(pb, id);
1486
1494
  break;
1487
- case GIT_OBJ_COMMIT:
1495
+ case GIT_OBJECT_COMMIT:
1488
1496
  error = git_packbuilder_insert_commit(pb, id);
1489
1497
  break;
1490
- case GIT_OBJ_TAG:
1498
+ case GIT_OBJECT_TAG:
1491
1499
  if ((error = git_packbuilder_insert(pb, id, name)) < 0)
1492
1500
  goto cleanup;
1493
1501
  error = git_packbuilder_insert_recur(pb, git_tag_target_id((git_tag *) obj), NULL);
1494
1502
  break;
1495
1503
 
1496
1504
  default:
1497
- giterr_set(GITERR_INVALID, "unknown object type");
1505
+ git_error_set(GIT_ERROR_INVALID, "unknown object type");
1498
1506
  error = -1;
1499
1507
  }
1500
1508
 
@@ -1513,13 +1521,13 @@ size_t git_packbuilder_written(git_packbuilder *pb)
1513
1521
  return pb->nr_written;
1514
1522
  }
1515
1523
 
1516
- int lookup_walk_object(git_walk_object **out, git_packbuilder *pb, const git_oid *id)
1524
+ static int lookup_walk_object(struct walk_object **out, git_packbuilder *pb, const git_oid *id)
1517
1525
  {
1518
- git_walk_object *obj;
1526
+ struct walk_object *obj;
1519
1527
 
1520
1528
  obj = git_pool_mallocz(&pb->object_pool, 1);
1521
1529
  if (!obj) {
1522
- giterr_set_oom();
1530
+ git_error_set_oom();
1523
1531
  return -1;
1524
1532
  }
1525
1533
 
@@ -1529,11 +1537,11 @@ int lookup_walk_object(git_walk_object **out, git_packbuilder *pb, const git_oid
1529
1537
  return 0;
1530
1538
  }
1531
1539
 
1532
- static int retrieve_object(git_walk_object **out, git_packbuilder *pb, const git_oid *id)
1540
+ static int retrieve_object(struct walk_object **out, git_packbuilder *pb, const git_oid *id)
1533
1541
  {
1534
1542
  int error;
1535
- khiter_t pos;
1536
- git_walk_object *obj;
1543
+ size_t pos;
1544
+ struct walk_object *obj;
1537
1545
 
1538
1546
  pos = git_oidmap_lookup_index(pb->walk_objects, id);
1539
1547
  if (git_oidmap_valid_index(pb->walk_objects, pos)) {
@@ -1552,7 +1560,7 @@ static int retrieve_object(git_walk_object **out, git_packbuilder *pb, const git
1552
1560
  static int mark_blob_uninteresting(git_packbuilder *pb, const git_oid *id)
1553
1561
  {
1554
1562
  int error;
1555
- git_walk_object *obj;
1563
+ struct walk_object *obj;
1556
1564
 
1557
1565
  if ((error = retrieve_object(&obj, pb, id)) < 0)
1558
1566
  return error;
@@ -1564,7 +1572,7 @@ static int mark_blob_uninteresting(git_packbuilder *pb, const git_oid *id)
1564
1572
 
1565
1573
  static int mark_tree_uninteresting(git_packbuilder *pb, const git_oid *id)
1566
1574
  {
1567
- git_walk_object *obj;
1575
+ struct walk_object *obj;
1568
1576
  git_tree *tree;
1569
1577
  int error;
1570
1578
  size_t i;
@@ -1584,11 +1592,11 @@ static int mark_tree_uninteresting(git_packbuilder *pb, const git_oid *id)
1584
1592
  const git_tree_entry *entry = git_tree_entry_byindex(tree, i);
1585
1593
  const git_oid *entry_id = git_tree_entry_id(entry);
1586
1594
  switch (git_tree_entry_type(entry)) {
1587
- case GIT_OBJ_TREE:
1595
+ case GIT_OBJECT_TREE:
1588
1596
  if ((error = mark_tree_uninteresting(pb, entry_id)) < 0)
1589
1597
  goto cleanup;
1590
1598
  break;
1591
- case GIT_OBJ_BLOB:
1599
+ case GIT_OBJECT_BLOB:
1592
1600
  if ((error = mark_blob_uninteresting(pb, entry_id)) < 0)
1593
1601
  goto cleanup;
1594
1602
  break;
@@ -1636,7 +1644,7 @@ int insert_tree(git_packbuilder *pb, git_tree *tree)
1636
1644
  size_t i;
1637
1645
  int error;
1638
1646
  git_tree *subtree;
1639
- git_walk_object *obj;
1647
+ struct walk_object *obj;
1640
1648
  const char *name;
1641
1649
 
1642
1650
  if ((error = retrieve_object(&obj, pb, git_tree_id(tree))) < 0)
@@ -1654,7 +1662,7 @@ int insert_tree(git_packbuilder *pb, git_tree *tree)
1654
1662
  const git_tree_entry *entry = git_tree_entry_byindex(tree, i);
1655
1663
  const git_oid *entry_id = git_tree_entry_id(entry);
1656
1664
  switch (git_tree_entry_type(entry)) {
1657
- case GIT_OBJ_TREE:
1665
+ case GIT_OBJECT_TREE:
1658
1666
  if ((error = git_tree_lookup(&subtree, pb->repo, entry_id)) < 0)
1659
1667
  return error;
1660
1668
 
@@ -1665,7 +1673,7 @@ int insert_tree(git_packbuilder *pb, git_tree *tree)
1665
1673
  return error;
1666
1674
 
1667
1675
  break;
1668
- case GIT_OBJ_BLOB:
1676
+ case GIT_OBJECT_BLOB:
1669
1677
  if ((error = retrieve_object(&obj, pb, entry_id)) < 0)
1670
1678
  return error;
1671
1679
  if (obj->uninteresting)
@@ -1684,7 +1692,7 @@ int insert_tree(git_packbuilder *pb, git_tree *tree)
1684
1692
  return error;
1685
1693
  }
1686
1694
 
1687
- int insert_commit(git_packbuilder *pb, git_walk_object *obj)
1695
+ int insert_commit(git_packbuilder *pb, struct walk_object *obj)
1688
1696
  {
1689
1697
  int error;
1690
1698
  git_commit *commit = NULL;
@@ -1714,7 +1722,7 @@ int git_packbuilder_insert_walk(git_packbuilder *pb, git_revwalk *walk)
1714
1722
  {
1715
1723
  int error;
1716
1724
  git_oid id;
1717
- git_walk_object *obj;
1725
+ struct walk_object *obj;
1718
1726
 
1719
1727
  assert(pb && walk);
1720
1728