diff options
author | Jonathan Tan <jonathantanmy@google.com> | 2017-08-18 15:20:38 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-08-23 15:12:07 -0700 |
commit | 7709f468fdeece2a99d60a581a4ced65cd2844df (patch) | |
tree | 37a26e9a350ec173d24f5578004e0000d3c6170e /sha1_file.c | |
parent | pack: move has_pack_index() (diff) | |
download | tgif-7709f468fdeece2a99d60a581a4ced65cd2844df.tar.xz |
pack: move for_each_packed_object()
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1_file.c')
-rw-r--r-- | sha1_file.c | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/sha1_file.c b/sha1_file.c index 7c81790759..bb0831b4c8 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -2015,46 +2015,6 @@ int for_each_loose_object(each_loose_object_fn cb, void *data, unsigned flags) return foreach_alt_odb(loose_from_alt_odb, &alt); } -static int for_each_object_in_pack(struct packed_git *p, each_packed_object_fn cb, void *data) -{ - uint32_t i; - int r = 0; - - for (i = 0; i < p->num_objects; i++) { - struct object_id oid; - - if (!nth_packed_object_oid(&oid, p, i)) - return error("unable to get sha1 of object %u in %s", - i, p->pack_name); - - r = cb(&oid, p, i, data); - if (r) - break; - } - return r; -} - -int for_each_packed_object(each_packed_object_fn cb, void *data, unsigned flags) -{ - struct packed_git *p; - int r = 0; - int pack_errors = 0; - - prepare_packed_git(); - for (p = packed_git; p; p = p->next) { - if ((flags & FOR_EACH_OBJECT_LOCAL_ONLY) && !p->pack_local) - continue; - if (open_pack_index(p)) { - pack_errors = 1; - continue; - } - r = for_each_object_in_pack(p, cb, data); - if (r) - break; - } - return r ? r : pack_errors; -} - static int check_stream_sha1(git_zstream *stream, const char *hdr, unsigned long size, |