doc: move git-cherry to plumbing
[gitweb.git] / bundle.c
index efe547e25fe2a53bd0ef7954cf3bec6d55218365..24cbe409863a83e8bda453af637c2237504a531d 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"
@@ -141,7 +143,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
        init_revisions(&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);
        }
@@ -222,7 +224,7 @@ static int is_tag_in_date_range(struct object *tag, struct rev_info *revs)
        if (revs->max_age == -1 && revs->min_age == -1)
                goto out;
 
-       buf = read_sha1_file(tag->oid.hash, &type, &size);
+       buf = read_object_file(&tag->oid, &type, &size);
        if (!buf)
                goto out;
        line = memmem(buf, size, "\ntagger ", 8);
@@ -373,7 +375,8 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs)
                         * 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)) {
@@ -409,7 +412,7 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs)
 int create_bundle(struct bundle_header *header, const char *path,
                  int argc, const char **argv)
 {
-       static struct lock_file lock;
+       struct lock_file lock = LOCK_INIT;
        int bundle_fd = -1;
        int bundle_to_stdout;
        int ref_count = 0;