vendor/libgit2/src/odb_pack.c in rugged-0.27.9 vs vendor/libgit2/src/odb_pack.c in rugged-0.27.10

- old
+ new

@@ -9,11 +9,11 @@ #include <zlib.h> #include "git2/repository.h" #include "git2/indexer.h" #include "git2/sys/odb_backend.h" -#include "fileops.h" +#include "futils.h" #include "hash.h" #include "odb.h" #include "delta.h" #include "sha1_lookup.h" #include "mwindow.h" @@ -216,11 +216,11 @@ error = git_mwindow_get_pack(&pack, path->ptr); /* ignore missing .pack file as git does */ if (error == GIT_ENOTFOUND) { - giterr_clear(); + git_error_clear(); return 0; } if (!error) error = git_vector_insert(&backend->packs, pack); @@ -344,18 +344,18 @@ git_buf_sets(&path, backend->pack_folder); /* reload all packs */ error = git_path_direach(&path, 0, packfile_load__cb, backend); - git_buf_free(&path); + git_buf_dispose(&path); git_vector_sort(&backend->packs); return error; } static int pack_backend__read_header( - size_t *len_p, git_otype *type_p, + size_t *len_p, git_object_t *type_p, struct git_odb_backend *backend, const git_oid *oid) { struct git_pack_entry e; int error; @@ -388,11 +388,11 @@ e.p->last_freshen = now; return 0; } static int pack_backend__read( - void **buffer_p, size_t *len_p, git_otype *type_p, + void **buffer_p, size_t *len_p, git_object_t *type_p, git_odb_backend *backend, const git_oid *oid) { struct git_pack_entry e; git_rawobj raw = {NULL}; int error; @@ -410,11 +410,11 @@ static int pack_backend__read_prefix( git_oid *out_oid, void **buffer_p, size_t *len_p, - git_otype *type_p, + git_object_t *type_p, git_odb_backend *backend, const git_oid *short_oid, size_t len) { int error = 0; @@ -476,27 +476,27 @@ /* Make sure we know about the packfiles */ if ((error = pack_backend__refresh(_backend)) < 0) return error; git_vector_foreach(&backend->packs, i, p) { - if ((error = git_pack_foreach_entry(p, cb, data)) < 0) + if ((error = git_pack_foreach_entry(p, cb, data)) != 0) return error; } return 0; } -static int pack_backend__writepack_append(struct git_odb_writepack *_writepack, const void *data, size_t size, git_transfer_progress *stats) +static int pack_backend__writepack_append(struct git_odb_writepack *_writepack, const void *data, size_t size, git_indexer_progress *stats) { struct pack_writepack *writepack = (struct pack_writepack *)_writepack; assert(writepack); return git_indexer_append(writepack->indexer, data, size, stats); } -static int pack_backend__writepack_commit(struct git_odb_writepack *_writepack, git_transfer_progress *stats) +static int pack_backend__writepack_commit(struct git_odb_writepack *_writepack, git_indexer_progress *stats) { struct pack_writepack *writepack = (struct pack_writepack *)_writepack; assert(writepack); @@ -514,27 +514,31 @@ } static int pack_backend__writepack(struct git_odb_writepack **out, git_odb_backend *_backend, git_odb *odb, - git_transfer_progress_cb progress_cb, + git_indexer_progress_cb progress_cb, void *progress_payload) { + git_indexer_options opts = GIT_INDEXER_OPTIONS_INIT; struct pack_backend *backend; struct pack_writepack *writepack; assert(out && _backend); *out = NULL; + opts.progress_cb = progress_cb; + opts.progress_cb_payload = progress_payload; + backend = (struct pack_backend *)_backend; writepack = git__calloc(1, sizeof(struct pack_writepack)); - GITERR_CHECK_ALLOC(writepack); + GIT_ERROR_CHECK_ALLOC(writepack); if (git_indexer_new(&writepack->indexer, - backend->pack_folder, 0, odb, progress_cb, progress_payload) < 0) { + backend->pack_folder, 0, odb, &opts) < 0) { git__free(writepack); return -1; } writepack->parent.backend = _backend; @@ -567,11 +571,11 @@ } static int pack_backend__alloc(struct pack_backend **out, size_t initial_size) { struct pack_backend *backend = git__calloc(1, sizeof(struct pack_backend)); - GITERR_CHECK_ALLOC(backend); + GIT_ERROR_CHECK_ALLOC(backend); if (git_vector_init(&backend->packs, initial_size, packfile_sort__cb) < 0) { git__free(backend); return -1; } @@ -633,9 +637,9 @@ backend = NULL; } *backend_out = (git_odb_backend *)backend; - git_buf_free(&path); + git_buf_dispose(&path); return error; }