add: speed up cmd_add() by utilizing read_cache_preload()
[gitweb.git] / bundle.c
index 160bbfdc64ec2876bdc685d253bf537d1c739c1f..1ef584b93b87491dca873429f1fbbbadf19622d4 100644 (file)
--- a/bundle.c
+++ b/bundle.c
@@ -1,6 +1,8 @@
 #include "cache.h"
 #include "lockfile.h"
 #include "bundle.h"
+#include "object-store.h"
+#include "repository.h"
 #include "object.h"
 #include "commit.h"
 #include "diff.h"
@@ -138,10 +140,10 @@ int verify_bundle(struct bundle_header *header, int verbose)
        int i, ret = 0, req_nr;
        const char *message = _("Repository lacks these prerequisite commits:");
 
-       init_revisions(&revs, NULL);
+       repo_init_revisions(the_repository, &revs, NULL);
        for (i = 0; i < p->nr; i++) {
                struct ref_list_entry *e = p->list + i;
-               struct object *o = parse_object(&e->oid);
+               struct object *o = parse_object(the_repository, &e->oid);
                if (o) {
                        o->flags |= PREREQ_MARK;
                        add_pending_object(&revs, o, e->name);
@@ -166,7 +168,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
 
        for (i = 0; i < p->nr; i++) {
                struct ref_list_entry *e = p->list + i;
-               struct object *o = parse_object(&e->oid);
+               struct object *o = parse_object(the_repository, &e->oid);
                assert(o); /* otherwise we'd have returned early */
                if (o->flags & SHOWN)
                        continue;
@@ -178,7 +180,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
        /* Clean up objects used, as they will be reused. */
        for (i = 0; i < p->nr; i++) {
                struct ref_list_entry *e = p->list + i;
-               commit = lookup_commit_reference_gently(&e->oid, 1);
+               commit = lookup_commit_reference_gently(the_repository, &e->oid, 1);
                if (commit)
                        clear_commit_marks(commit, ALL_REV_FLAGS);
        }
@@ -367,13 +369,14 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs)
                 * commit that is referenced by the tag, and not the tag
                 * itself.
                 */
-               if (oidcmp(&oid, &e->item->oid)) {
+               if (!oideq(&oid, &e->item->oid)) {
                        /*
                         * Is this the positive end of a range expressed
                         * in terms of a tag (e.g. v2.0 from the range
                         * "v1.0..v2.0")?
                         */
-                       struct commit *one = lookup_commit_reference(&oid);
+                       struct commit *one = lookup_commit_reference(the_repository,
+                                                                    &oid);
                        struct object *obj;
 
                        if (e->item == &(one->object)) {
@@ -438,7 +441,7 @@ int create_bundle(struct bundle_header *header, const char *path,
 
        /* init revs to list objects for pack-objects later */
        save_commit_buffer = 0;
-       init_revisions(&revs, NULL);
+       repo_init_revisions(the_repository, &revs, NULL);
 
        /* write prerequisites */
        if (compute_and_write_prerequisites(bundle_fd, &revs, argc, argv))