]> git.ipfire.org Git - thirdparty/git.git/commitdiff
cocci: apply the "object-store.h" part of "the_repository.pending"
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Tue, 28 Mar 2023 13:58:50 +0000 (15:58 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 28 Mar 2023 14:36:45 +0000 (07:36 -0700)
Apply the part of "the_repository.pending.cocci" pertaining to
"object-store.h".

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
60 files changed:
apply.c
archive.c
bisect.c
blame.c
builtin/cat-file.c
builtin/clone.c
builtin/difftool.c
builtin/fast-export.c
builtin/fast-import.c
builtin/fetch.c
builtin/grep.c
builtin/index-pack.c
builtin/log.c
builtin/merge-tree.c
builtin/mktag.c
builtin/notes.c
builtin/pack-objects.c
builtin/receive-pack.c
builtin/remote.c
builtin/show-ref.c
builtin/tag.c
builtin/unpack-file.c
builtin/unpack-objects.c
bulk-checkin.c
bundle.c
cache-tree.c
combine-diff.c
commit.c
contrib/coccinelle/the_repository.cocci
contrib/coccinelle/the_repository.pending.cocci
dir.c
entry.c
fetch-pack.c
fmt-merge-msg.c
fsck.c
http-push.c
http-walker.c
list-objects.c
mailmap.c
match-trees.c
merge-blobs.c
merge-ort.c
merge-recursive.c
notes-cache.c
notes-merge.c
notes.c
object-file.c
object-store.h
read-cache.c
reflog.c
remote.c
rerere.c
send-pack.c
shallow.c
submodule-config.c
tag.c
tree.c
upload-pack.c
walker.c
xdiff-interface.c

diff --git a/apply.c b/apply.c
index 57f45cedd2b360bf76c4dc7c8c78d833939bde28..eb71586a372e54bcde6c9f691c38da6a42b484ca 100644 (file)
--- a/apply.c
+++ b/apply.c
@@ -3201,7 +3201,8 @@ static int apply_binary(struct apply_state *state,
                unsigned long size;
                char *result;
 
-               result = read_object_file(&oid, &type, &size);
+               result = repo_read_object_file(the_repository, &oid, &type,
+                                              &size);
                if (!result)
                        return error(_("the necessary postimage %s for "
                                       "'%s' cannot be read"),
@@ -3264,7 +3265,8 @@ static int read_blob_object(struct strbuf *buf, const struct object_id *oid, uns
                unsigned long sz;
                char *result;
 
-               result = read_object_file(oid, &type, &sz);
+               result = repo_read_object_file(the_repository, oid, &type,
+                                              &sz);
                if (!result)
                        return -1;
                /* XXX read_sha1_file NUL-terminates */
@@ -3492,7 +3494,8 @@ static int resolve_to(struct image *image, const struct object_id *result_id)
 
        clear_image(image);
 
-       image->buf = read_object_file(result_id, &type, &size);
+       image->buf = repo_read_object_file(the_repository, result_id, &type,
+                                          &size);
        if (!image->buf || type != OBJ_BLOB)
                die("unable to read blob object %s", oid_to_hex(result_id));
        image->len = size;
index 732e2100544ccbf1a1f32bca96008b9bd19a9d6c..0b48de0063491b430f2a9fb84b29f192ddc69a5e 100644 (file)
--- a/archive.c
+++ b/archive.c
@@ -84,7 +84,7 @@ static void *object_file_to_archive(const struct archiver_args *args,
                               (args->tree ? &args->tree->object.oid : NULL), oid);
 
        path += args->baselen;
-       buffer = read_object_file(oid, type, sizep);
+       buffer = repo_read_object_file(the_repository, oid, type, sizep);
        if (buffer && S_ISREG(mode)) {
                struct strbuf buf = STRBUF_INIT;
                size_t size = 0;
index 3088516e174eb666e1ec26503db7fb692d12b7b5..db7aa2032e17d00400a52687e24094879b723002 100644 (file)
--- a/bisect.c
+++ b/bisect.c
@@ -148,8 +148,9 @@ static void show_list(const char *debug, int counted, int nr,
                unsigned commit_flags = commit->object.flags;
                enum object_type type;
                unsigned long size;
-               char *buf = read_object_file(&commit->object.oid, &type,
-                                            &size);
+               char *buf = repo_read_object_file(the_repository,
+                                                 &commit->object.oid, &type,
+                                                 &size);
                const char *subject_start;
                int subject_len;
 
diff --git a/blame.c b/blame.c
index af2b67c08473c23c3bef1985b8647f5a12964d12..7009a3379c514f5c405b4a2a4f267b1a5197af12 100644 (file)
--- a/blame.c
+++ b/blame.c
@@ -1028,8 +1028,9 @@ static void fill_origin_blob(struct diff_options *opt,
                                    &o->blob_oid, 1, &file->ptr, &file_size))
                        ;
                else
-                       file->ptr = read_object_file(&o->blob_oid, &type,
-                                                    &file_size);
+                       file->ptr = repo_read_object_file(the_repository,
+                                                         &o->blob_oid, &type,
+                                                         &file_size);
                file->size = file_size;
 
                if (!file->ptr)
@@ -2838,8 +2839,10 @@ void setup_scoreboard(struct blame_scoreboard *sb,
                                    &sb->final_buf_size))
                        ;
                else
-                       sb->final_buf = read_object_file(&o->blob_oid, &type,
-                                                        &sb->final_buf_size);
+                       sb->final_buf = repo_read_object_file(the_repository,
+                                                             &o->blob_oid,
+                                                             &type,
+                                                             &sb->final_buf_size);
 
                if (!sb->final_buf)
                        die(_("cannot read blob %s for path %s"),
index cc17635e76536471a0a756903a8187eaa01d5733..caf2d2586198adfabf37864acdb035fb40c09ff4 100644 (file)
@@ -60,7 +60,7 @@ static int filter_object(const char *path, unsigned mode,
 {
        enum object_type type;
 
-       *buf = read_object_file(oid, &type, size);
+       *buf = repo_read_object_file(the_repository, oid, &type, size);
        if (!*buf)
                return error(_("cannot read object %s '%s'"),
                             oid_to_hex(oid), path);
@@ -152,7 +152,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
                goto cleanup;
 
        case 'e':
-               return !has_object_file(&oid);
+               return !repo_has_object_file(the_repository, &oid);
 
        case 'w':
 
@@ -187,7 +187,8 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
                        ret = stream_blob(&oid);
                        goto cleanup;
                }
-               buf = read_object_file(&oid, &type, &size);
+               buf = repo_read_object_file(the_repository, &oid, &type,
+                                           &size);
                if (!buf)
                        die("Cannot read object %s", obj_name);
 
@@ -207,8 +208,10 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
                if (exp_type_id == OBJ_BLOB) {
                        struct object_id blob_oid;
                        if (oid_object_info(the_repository, &oid, NULL) == OBJ_TAG) {
-                               char *buffer = read_object_file(&oid, &type,
-                                                               &size);
+                               char *buffer = repo_read_object_file(the_repository,
+                                                                    &oid,
+                                                                    &type,
+                                                                    &size);
                                const char *target;
                                if (!skip_prefix(buffer, "object ", &target) ||
                                    get_oid_hex(target, &blob_oid))
@@ -383,9 +386,10 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d
                                if (!textconv_object(the_repository,
                                                     data->rest, 0100644, oid,
                                                     1, &contents, &size))
-                                       contents = read_object_file(oid,
-                                                                   &type,
-                                                                   &size);
+                                       contents = repo_read_object_file(the_repository,
+                                                                        oid,
+                                                                        &type,
+                                                                        &size);
                                if (!contents)
                                        die("could not convert '%s' %s",
                                            oid_to_hex(oid), data->rest);
@@ -402,7 +406,8 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d
                unsigned long size;
                void *contents;
 
-               contents = read_object_file(oid, &type, &size);
+               contents = repo_read_object_file(the_repository, oid, &type,
+                                                &size);
 
                if (use_mailmap) {
                        size_t s = size;
index 65b5b7db6de5bdac835ad95b6438c1cc548d1599..4de4640ed4550d84513c1c26b0f0220ad7d5debd 100644 (file)
@@ -547,9 +547,9 @@ static void write_followtags(const struct ref *refs, const char *msg)
                        continue;
                if (ends_with(ref->name, "^{}"))
                        continue;
-               if (!has_object_file_with_flags(&ref->old_oid,
-                                               OBJECT_INFO_QUICK |
-                                               OBJECT_INFO_SKIP_FETCH_OBJECT))
+               if (!repo_has_object_file_with_flags(the_repository, &ref->old_oid,
+                                                    OBJECT_INFO_QUICK |
+                                                    OBJECT_INFO_SKIP_FETCH_OBJECT))
                        continue;
                update_ref(msg, ref->name, &ref->old_oid, NULL, 0,
                           UPDATE_REFS_DIE_ON_ERR);
index dbbfb19f1921028f78b499af0ad35a67c9595d59..30daa83bc6b96580b6e9f566b5d23a5114b612a1 100644 (file)
@@ -295,7 +295,8 @@ static char *get_symlink(const struct object_id *oid, const char *path)
        } else {
                enum object_type type;
                unsigned long size;
-               data = read_object_file(oid, &type, &size);
+               data = repo_read_object_file(the_repository, oid, &type,
+                                            &size);
                if (!data)
                        die(_("could not read object %s for symlink %s"),
                                oid_to_hex(oid), path);
index 5fe7c02970e4cfd696da1b8136fff4966d5f2ba6..6515bd2ad8bff1583aa7b911ae95725ebef95a0f 100644 (file)
@@ -296,7 +296,7 @@ static void export_blob(const struct object_id *oid)
                object = (struct object *)lookup_blob(the_repository, oid);
                eaten = 0;
        } else {
-               buf = read_object_file(oid, &type, &size);
+               buf = repo_read_object_file(the_repository, oid, &type, &size);
                if (!buf)
                        die("could not read blob %s", oid_to_hex(oid));
                if (check_object_signature(the_repository, oid, buf, size,
@@ -766,7 +766,8 @@ static void handle_tag(const char *name, struct tag *tag)
                return;
        }
 
-       buf = read_object_file(&tag->object.oid, &type, &size);
+       buf = repo_read_object_file(the_repository, &tag->object.oid, &type,
+                                   &size);
        if (!buf)
                die("could not read tag %s", oid_to_hex(&tag->object.oid));
        message = memmem(buf, size, "\n\n", 2);
index 2098c0c5a3748eec1cecb861343aa95f1f73bf58..20654341782d1e412fcf19fd3c5772b827909d84 100644 (file)
@@ -1265,7 +1265,7 @@ static void load_tree(struct tree_entry *root)
                        die("Can't load tree %s", oid_to_hex(oid));
        } else {
                enum object_type type;
-               buf = read_object_file(oid, &type, &size);
+               buf = repo_read_object_file(the_repository, oid, &type, &size);
                if (!buf || type != OBJ_TREE)
                        die("Can't load tree %s", oid_to_hex(oid));
        }
@@ -2936,7 +2936,7 @@ static void cat_blob(struct object_entry *oe, struct object_id *oid)
        char *buf;
 
        if (!oe || oe->pack_id == MAX_PACK_ID) {
-               buf = read_object_file(oid, &type, &size);
+               buf = repo_read_object_file(the_repository, oid, &type, &size);
        } else {
                type = oe->type;
                buf = gfi_unpack_entry(oe, &size);
@@ -3044,7 +3044,8 @@ static struct object_entry *dereference(struct object_entry *oe,
                buf = gfi_unpack_entry(oe, &size);
        } else {
                enum object_type unused;
-               buf = read_object_file(oid, &unused, &size);
+               buf = repo_read_object_file(the_repository, oid, &unused,
+                                           &size);
        }
        if (!buf)
                die("Can't load object %s", oid_to_hex(oid));
index db8815032fc5b9e5867551e2353bf1cd9ce8f3ea..784e344d2bb89ef2ff285841c142b585aaec7738 100644 (file)
@@ -407,9 +407,9 @@ static void find_non_local_tags(const struct ref *refs,
                 */
                if (ends_with(ref->name, "^{}")) {
                        if (item &&
-                           !has_object_file_with_flags(&ref->old_oid, quick_flags) &&
+                           !repo_has_object_file_with_flags(the_repository, &ref->old_oid, quick_flags) &&
                            !oidset_contains(&fetch_oids, &ref->old_oid) &&
-                           !has_object_file_with_flags(&item->oid, quick_flags) &&
+                           !repo_has_object_file_with_flags(the_repository, &item->oid, quick_flags) &&
                            !oidset_contains(&fetch_oids, &item->oid))
                                clear_item(item);
                        item = NULL;
@@ -423,7 +423,7 @@ static void find_non_local_tags(const struct ref *refs,
                 * fetch.
                 */
                if (item &&
-                   !has_object_file_with_flags(&item->oid, quick_flags) &&
+                   !repo_has_object_file_with_flags(the_repository, &item->oid, quick_flags) &&
                    !oidset_contains(&fetch_oids, &item->oid))
                        clear_item(item);
 
@@ -444,7 +444,7 @@ static void find_non_local_tags(const struct ref *refs,
         * checked to see if it needs fetching.
         */
        if (item &&
-           !has_object_file_with_flags(&item->oid, quick_flags) &&
+           !repo_has_object_file_with_flags(the_repository, &item->oid, quick_flags) &&
            !oidset_contains(&fetch_oids, &item->oid))
                clear_item(item);
 
@@ -1320,8 +1320,8 @@ static int check_exist_and_connected(struct ref *ref_map)
         * we need all direct targets to exist.
         */
        for (r = rm; r; r = r->next) {
-               if (!has_object_file_with_flags(&r->old_oid,
-                                               OBJECT_INFO_SKIP_FETCH_OBJECT))
+               if (!repo_has_object_file_with_flags(the_repository, &r->old_oid,
+                                                    OBJECT_INFO_SKIP_FETCH_OBJECT))
                        return -1;
        }
 
index f7821c5fbbaeda3888f3011ee5215393e1319952..18561b10029818c8a668340565bbc573f5d0e7a4 100644 (file)
@@ -560,7 +560,8 @@ static int grep_cache(struct grep_opt *opt,
                        void *data;
                        unsigned long size;
 
-                       data = read_object_file(&ce->oid, &type, &size);
+                       data = repo_read_object_file(the_repository, &ce->oid,
+                                                    &type, &size);
                        init_tree_desc(&tree, data, size);
 
                        hit |= grep_tree(opt, pathspec, &tree, &name, 0, 0);
@@ -650,7 +651,8 @@ static int grep_tree(struct grep_opt *opt, const struct pathspec *pathspec,
                        void *data;
                        unsigned long size;
 
-                       data = read_object_file(&entry.oid, &type, &size);
+                       data = repo_read_object_file(the_repository,
+                                                    &entry.oid, &type, &size);
                        if (!data)
                                die(_("unable to read tree (%s)"),
                                    oid_to_hex(&entry.oid));
index 6648f2daef5cef38fd59dfba47c048ce72bb4c36..4cf69ee1d97b18c364401c95f2fd28766268e751 100644 (file)
@@ -801,7 +801,8 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
        if (startup_info->have_repository) {
                read_lock();
                collision_test_needed =
-                       has_object_file_with_flags(oid, OBJECT_INFO_QUICK);
+                       repo_has_object_file_with_flags(the_repository, oid,
+                                                       OBJECT_INFO_QUICK);
                read_unlock();
        }
 
@@ -821,7 +822,8 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
                        die(_("cannot read existing object info %s"), oid_to_hex(oid));
                if (has_type != type || has_size != size)
                        die(_("SHA1 COLLISION FOUND WITH %s !"), oid_to_hex(oid));
-               has_data = read_object_file(oid, &has_type, &has_size);
+               has_data = repo_read_object_file(the_repository, oid,
+                                                &has_type, &has_size);
                read_unlock();
                if (!data)
                        data = new_data = get_data_from_pack(obj_entry);
@@ -1414,7 +1416,8 @@ static void fix_unresolved_deltas(struct hashfile *f)
 
                if (objects[d->obj_no].real_type != OBJ_REF_DELTA)
                        continue;
-               data = read_object_file(&d->oid, &type, &size);
+               data = repo_read_object_file(the_repository, &d->oid, &type,
+                                            &size);
                if (!data)
                        continue;
 
index b76a1c82d8f0da4a478f47db0d830d1a751923ec..3dde77bde277a72cb29d0a168129ee7466346d16 100644 (file)
@@ -675,7 +675,7 @@ static int show_tag_object(const struct object_id *oid, struct rev_info *rev)
 {
        unsigned long size;
        enum object_type type;
-       char *buf = read_object_file(oid, &type, &size);
+       char *buf = repo_read_object_file(the_repository, oid, &type, &size);
        int offset = 0;
 
        if (!buf)
index c0acbc6a546eb43e6a8f4263787b781910b64862..d628ad1da9f2fbc52a26324011d4046bfdec17d3 100644 (file)
@@ -69,7 +69,9 @@ static void *result(struct merge_list *entry, unsigned long *size)
        const char *path = entry->path;
 
        if (!entry->stage)
-               return read_object_file(&entry->blob->object.oid, &type, size);
+               return repo_read_object_file(the_repository,
+                                            &entry->blob->object.oid, &type,
+                                            size);
        base = NULL;
        if (entry->stage == 1) {
                base = entry->blob;
@@ -92,8 +94,9 @@ static void *origin(struct merge_list *entry, unsigned long *size)
        enum object_type type;
        while (entry) {
                if (entry->stage == 2)
-                       return read_object_file(&entry->blob->object.oid,
-                                               &type, size);
+                       return repo_read_object_file(the_repository,
+                                                    &entry->blob->object.oid,
+                                                    &type, size);
                entry = entry->link;
        }
        return NULL;
index 5d22909122d195873f2427812084dc8bd4319180..141a2d456933dfd7479055ca54ab76d290fa5901 100644 (file)
@@ -51,7 +51,8 @@ static int verify_object_in_tag(struct object_id *tagged_oid, int *tagged_type)
        void *buffer;
        const struct object_id *repl;
 
-       buffer = read_object_file(tagged_oid, &type, &size);
+       buffer = repo_read_object_file(the_repository, tagged_oid, &type,
+                                      &size);
        if (!buffer)
                die(_("could not read tagged object '%s'"),
                    oid_to_hex(tagged_oid));
index b497eae520e6464941e68cf928f6de04c886007e..ba1daa4ff0f7a68ec2a2693433c54f56c4926c35 100644 (file)
@@ -124,7 +124,7 @@ static void copy_obj_to_fd(int fd, const struct object_id *oid)
 {
        unsigned long size;
        enum object_type type;
-       char *buf = read_object_file(oid, &type, &size);
+       char *buf = repo_read_object_file(the_repository, oid, &type, &size);
        if (buf) {
                if (size)
                        write_or_die(fd, buf, size);
@@ -259,7 +259,7 @@ static int parse_reuse_arg(const struct option *opt, const char *arg, int unset)
 
        if (repo_get_oid(the_repository, arg, &object))
                die(_("failed to resolve '%s' as a valid ref."), arg);
-       if (!(buf = read_object_file(&object, &type, &len)))
+       if (!(buf = repo_read_object_file(the_repository, &object, &type, &len)))
                die(_("failed to read object '%s'."), arg);
        if (type != OBJ_BLOB) {
                free(buf);
@@ -616,7 +616,8 @@ static int append_edit(int argc, const char **argv, const char *prefix)
                /* Append buf to previous note contents */
                unsigned long size;
                enum object_type type;
-               char *prev_buf = read_object_file(note, &type, &size);
+               char *prev_buf = repo_read_object_file(the_repository, note,
+                                                      &type, &size);
 
                strbuf_grow(&d.buf, size + 1);
                if (d.buf.len && prev_buf && size)
index 74a167a180cd4080919d8c3a614c098ad96a2b42..3c9b35642cbf7872630b72ec897f8982644fb035 100644 (file)
@@ -288,11 +288,13 @@ static void *get_delta(struct object_entry *entry)
        void *buf, *base_buf, *delta_buf;
        enum object_type type;
 
-       buf = read_object_file(&entry->idx.oid, &type, &size);
+       buf = repo_read_object_file(the_repository, &entry->idx.oid, &type,
+                                   &size);
        if (!buf)
                die(_("unable to read %s"), oid_to_hex(&entry->idx.oid));
-       base_buf = read_object_file(&DELTA(entry)->idx.oid, &type,
-                                   &base_size);
+       base_buf = repo_read_object_file(the_repository,
+                                        &DELTA(entry)->idx.oid, &type,
+                                        &base_size);
        if (!base_buf)
                die("unable to read %s",
                    oid_to_hex(&DELTA(entry)->idx.oid));
@@ -454,7 +456,9 @@ static unsigned long write_no_reuse_object(struct hashfile *f, struct object_ent
                                       &size, NULL)) != NULL)
                        buf = NULL;
                else {
-                       buf = read_object_file(&entry->idx.oid, &type, &size);
+                       buf = repo_read_object_file(the_repository,
+                                                   &entry->idx.oid, &type,
+                                                   &size);
                        if (!buf)
                                die(_("unable to read %s"),
                                    oid_to_hex(&entry->idx.oid));
@@ -1665,7 +1669,7 @@ static struct pbase_tree_cache *pbase_tree_get(const struct object_id *oid)
        /* Did not find one.  Either we got a bogus request or
         * we need to read and perhaps cache.
         */
-       data = read_object_file(oid, &type, &size);
+       data = repo_read_object_file(the_repository, oid, &type, &size);
        if (!data)
                return NULL;
        if (type != OBJ_TREE) {
@@ -2525,7 +2529,9 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
        /* Load data if not already done */
        if (!trg->data) {
                packing_data_lock(&to_pack);
-               trg->data = read_object_file(&trg_entry->idx.oid, &type, &sz);
+               trg->data = repo_read_object_file(the_repository,
+                                                 &trg_entry->idx.oid, &type,
+                                                 &sz);
                packing_data_unlock(&to_pack);
                if (!trg->data)
                        die(_("object %s cannot be read"),
@@ -2538,7 +2544,9 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
        }
        if (!src->data) {
                packing_data_lock(&to_pack);
-               src->data = read_object_file(&src_entry->idx.oid, &type, &sz);
+               src->data = repo_read_object_file(the_repository,
+                                                 &src_entry->idx.oid, &type,
+                                                 &sz);
                packing_data_unlock(&to_pack);
                if (!src->data) {
                        if (src_entry->preferred_base) {
index 6d4fc1368a4a1ce3196fbed65d07a5982ffa73db..5609206499cb3cdaf9bf16d4e585a268f205fe2e 100644 (file)
@@ -1494,7 +1494,7 @@ static const char *update(struct command *cmd, struct shallow_info *si)
                }
        }
 
-       if (!is_null_oid(new_oid) && !has_object_file(new_oid)) {
+       if (!is_null_oid(new_oid) && !repo_has_object_file(the_repository, new_oid)) {
                error("unpack should have generated %s, "
                      "but I can't find it!", oid_to_hex(new_oid));
                ret = "bad pack";
index 729f6f3643add1819942facaae5175555f9c167b..a6b100dce7f3f6e599fab3116944b56b8c4303c0 100644 (file)
@@ -443,7 +443,7 @@ static int get_push_ref_states(const struct ref *remote_refs,
                        info->status = PUSH_STATUS_UPTODATE;
                else if (is_null_oid(&ref->old_oid))
                        info->status = PUSH_STATUS_CREATE;
-               else if (has_object_file(&ref->old_oid) &&
+               else if (repo_has_object_file(the_repository, &ref->old_oid) &&
                         ref_newer(&ref->new_oid, &ref->old_oid))
                        info->status = PUSH_STATUS_FASTFORWARD;
                else
index eb3ad1688ba3614cb273de27438538bbfeacd1b4..b294ae4164189e5e6dc5875ddcf135ae093b6f77 100644 (file)
@@ -26,7 +26,7 @@ static void show_one(const char *refname, const struct object_id *oid)
        const char *hex;
        struct object_id peeled;
 
-       if (!has_object_file(oid))
+       if (!repo_has_object_file(the_repository, oid))
                die("git show-ref: bad ref %s (%s)", refname,
                    oid_to_hex(oid));
 
index e6cbf6e5a8d2740d39b944ddab67746abbd8fec0..cd97a141faf143c05af530547dee13897ca363b5 100644 (file)
@@ -215,7 +215,7 @@ static void write_tag_body(int fd, const struct object_id *oid)
        struct strbuf payload = STRBUF_INIT;
        struct strbuf signature = STRBUF_INIT;
 
-       orig = buf = read_object_file(oid, &type, &size);
+       orig = buf = repo_read_object_file(the_repository, oid, &type, &size);
        if (!buf)
                return;
        if (parse_signature(buf, size, &payload, &signature)) {
@@ -366,7 +366,7 @@ static void create_reflog_msg(const struct object_id *oid, struct strbuf *sb)
                strbuf_addstr(sb, "object of unknown type");
                break;
        case OBJ_COMMIT:
-               if ((buf = read_object_file(oid, &type, &size))) {
+               if ((buf = repo_read_object_file(the_repository, oid, &type, &size))) {
                        subject_len = find_commit_subject(buf, &subject_start);
                        strbuf_insert(sb, sb->len, subject_start, subject_len);
                } else {
index e0d5178acc5fd30aaf78c2218a66cd9d23ff3ed8..9d5c15241978135c48c4d7ff2b8a3b02a6e6f104 100644 (file)
@@ -10,7 +10,7 @@ static char *create_temp_file(struct object_id *oid)
        unsigned long size;
        int fd;
 
-       buf = read_object_file(oid, &type, &size);
+       buf = repo_read_object_file(the_repository, oid, &type, &size);
        if (!buf || type != OBJ_BLOB)
                die("unable to read blob object %s", oid_to_hex(oid));
 
index 43789b8ef294d8aa3fc9517f65712ac90e1fa60c..c07209617436d9e9da536d9ab3ab8df843e5ce04 100644 (file)
@@ -442,7 +442,7 @@ static void unpack_delta_entry(enum object_type type, unsigned long delta_size,
                delta_data = get_data(delta_size);
                if (!delta_data)
                        return;
-               if (has_object_file(&base_oid))
+               if (repo_has_object_file(the_repository, &base_oid))
                        ; /* Ok we have this one */
                else if (resolve_against_held(nr, &base_oid,
                                              delta_data, delta_size))
@@ -508,7 +508,8 @@ static void unpack_delta_entry(enum object_type type, unsigned long delta_size,
        if (resolve_against_held(nr, &base_oid, delta_data, delta_size))
                return;
 
-       base = read_object_file(&base_oid, &type, &base_size);
+       base = repo_read_object_file(the_repository, &base_oid, &type,
+                                    &base_size);
        if (!base) {
                error("failed to read delta-pack base object %s",
                      oid_to_hex(&base_oid));
index 855b68ec23bdb1bdc85c1184a9c144c226f0245c..b44b94e86637dae4e0c69686d1f3a671039875fa 100644 (file)
@@ -124,7 +124,7 @@ static int already_written(struct bulk_checkin_packfile *state, struct object_id
        int i;
 
        /* The object may already exist in the repository */
-       if (has_object_file(oid))
+       if (repo_has_object_file(the_repository, oid))
                return 1;
 
        /* Might want to keep the list sorted */
index 6ab6cd7378d2d633d5d6dc6100e98793799c7f4e..9b57bade7a64921412fc740cb5b7818330e35c82 100644 (file)
--- a/bundle.c
+++ b/bundle.c
@@ -293,7 +293,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_object_file(&tag->oid, &type, &size);
+       buf = repo_read_object_file(the_repository, &tag->oid, &type, &size);
        if (!buf)
                goto out;
        line = memmem(buf, size, "\ntagger ", 8);
index 88c2c04f87fe5fcfce380b47f9d9377f9b59d8ef..59610117d0b00a4b50a8ab311b01cb04978ea79f 100644 (file)
@@ -229,7 +229,7 @@ int cache_tree_fully_valid(struct cache_tree *it)
        int i;
        if (!it)
                return 0;
-       if (it->entry_count < 0 || !has_object_file(&it->oid))
+       if (it->entry_count < 0 || !repo_has_object_file(the_repository, &it->oid))
                return 0;
        for (i = 0; i < it->subtree_nr; i++) {
                if (!cache_tree_fully_valid(it->down[i]->cache_tree))
@@ -280,7 +280,7 @@ static int update_one(struct cache_tree *it,
                }
        }
 
-       if (0 <= it->entry_count && has_object_file(&it->oid))
+       if (0 <= it->entry_count && repo_has_object_file(the_repository, &it->oid))
                return it->entry_count;
 
        /*
@@ -386,7 +386,7 @@ static int update_one(struct cache_tree *it,
                ce_missing_ok = mode == S_IFGITLINK || missing_ok ||
                        !must_check_existence(ce);
                if (is_null_oid(oid) ||
-                   (!ce_missing_ok && !has_object_file(oid))) {
+                   (!ce_missing_ok && !repo_has_object_file(the_repository, oid))) {
                        strbuf_release(&buffer);
                        if (expected_missing)
                                return -1;
@@ -434,7 +434,7 @@ static int update_one(struct cache_tree *it,
                struct object_id oid;
                hash_object_file(the_hash_algo, buffer.buf, buffer.len,
                                 OBJ_TREE, &oid);
-               if (has_object_file_with_flags(&oid, OBJECT_INFO_SKIP_FETCH_OBJECT))
+               if (repo_has_object_file_with_flags(the_repository, &oid, OBJECT_INFO_SKIP_FETCH_OBJECT))
                        oidcpy(&it->oid, &oid);
                else
                        to_invalidate = 1;
index d84ab878b72fd3dcec73af65f9fe421a39be539c..20f8a03924f019de72828831ec14d76b66444f44 100644 (file)
@@ -332,7 +332,7 @@ static char *grab_blob(struct repository *r,
                *size = fill_textconv(r, textconv, df, &blob);
                free_filespec(df);
        } else {
-               blob = read_object_file(oid, &type, size);
+               blob = repo_read_object_file(the_repository, oid, &type, size);
                if (type != OBJ_BLOB)
                        die("object '%s' is not a blob!", oid_to_hex(oid));
        }
index 6036376d05a674dec72759155609366b5db4cfd6..dd22e76c3e16851f3a16476d37fe9d5343a6797d 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -1212,7 +1212,8 @@ static void handle_signed_tag(struct commit *parent, struct commit_extra_header
        desc = merge_remote_util(parent);
        if (!desc || !desc->obj)
                return;
-       buf = read_object_file(&desc->obj->oid, &type, &size);
+       buf = repo_read_object_file(the_repository, &desc->obj->oid, &type,
+                                   &size);
        if (!buf || type != OBJ_TAG)
                goto free_return;
        if (!parse_signature(buf, size, &payload, &signature))
index 3c0bd8781e774a205f9f7cfe2599c61f42834b43..fa159aba5b515218c10d0c97db1ba4790707861b 100644 (file)
 |
 - diff_setup
 + repo_diff_setup
+// object-store.h
+|
+- read_object_file
++ repo_read_object_file
+|
+- has_object_file
++ repo_has_object_file
+|
+- has_object_file_with_flags
++ repo_has_object_file_with_flags
 )
   (
 + the_repository,
index 00461ee86b3c2a4d46554dbf0354fbcbb1caeedd..69e9694111e0e5c6c703660d9bcf37e7a6a1eba3 100644 (file)
@@ -5,17 +5,7 @@
 @@
 @@
 (
-// object-store.h
-- read_object_file
-+ repo_read_object_file
-|
-- has_object_file
-+ repo_has_object_file
-|
-- has_object_file_with_flags
-+ repo_has_object_file_with_flags
 // pretty.h
-|
 - format_commit_message
 + repo_format_commit_message
 // packfile.h
diff --git a/dir.c b/dir.c
index 4e99f0c868f3d7955c4a6f84bf22bbce0d917ae3..6615afe8f131c61983cbf618796a593c7af60921 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -267,7 +267,7 @@ static int do_read_blob(const struct object_id *oid, struct oid_stat *oid_stat,
        *size_out = 0;
        *data_out = NULL;
 
-       data = read_object_file(oid, &type, &sz);
+       data = repo_read_object_file(the_repository, oid, &type, &sz);
        if (!data || type != OBJ_BLOB) {
                free(data);
                return -1;
diff --git a/entry.c b/entry.c
index 971ab268714b96cdaa179ae7589c8377ff728e74..7c50220a782553f2676b1594f6db173cd458386b 100644 (file)
--- a/entry.c
+++ b/entry.c
@@ -86,7 +86,8 @@ void *read_blob_entry(const struct cache_entry *ce, size_t *size)
 {
        enum object_type type;
        unsigned long ul;
-       void *blob_data = read_object_file(&ce->oid, &type, &ul);
+       void *blob_data = repo_read_object_file(the_repository, &ce->oid,
+                                               &type, &ul);
 
        *size = ul;
        if (blob_data) {
index 04016d1e3250f28ae6cd53a784913f02879769d8..8c497b48219033f3c3c5f8bdc9ae0ef2f0299b2f 100644 (file)
@@ -762,9 +762,9 @@ static void mark_complete_and_common_ref(struct fetch_negotiator *negotiator,
                if (!commit) {
                        struct object *o;
 
-                       if (!has_object_file_with_flags(&ref->old_oid,
-                                               OBJECT_INFO_QUICK |
-                                               OBJECT_INFO_SKIP_FETCH_OBJECT))
+                       if (!repo_has_object_file_with_flags(the_repository, &ref->old_oid,
+                                                            OBJECT_INFO_QUICK |
+                                                            OBJECT_INFO_SKIP_FETCH_OBJECT))
                                continue;
                        o = parse_object(the_repository, &ref->old_oid);
                        if (!o || o->type != OBJ_COMMIT)
@@ -1963,7 +1963,7 @@ static void update_shallow(struct fetch_pack_args *args,
                struct oid_array extra = OID_ARRAY_INIT;
                struct object_id *oid = si->shallow->oid;
                for (i = 0; i < si->shallow->nr; i++)
-                       if (has_object_file(&oid[i]))
+                       if (repo_has_object_file(the_repository, &oid[i]))
                                oid_array_append(&extra, &oid[i]);
                if (extra.nr) {
                        setup_alternate_shallow(&shallow_lock,
index a5de91ba22cd5fc93820b105236d261e9043ca0c..e9c6623647d56f5548f022a50f9af31928da2320 100644 (file)
@@ -520,7 +520,8 @@ static void fmt_merge_msg_sigs(struct strbuf *out)
                struct object_id *oid = origins.items[i].util;
                enum object_type type;
                unsigned long size;
-               char *buf = read_object_file(oid, &type, &size);
+               char *buf = repo_read_object_file(the_repository, oid, &type,
+                                                 &size);
                char *origbuf = buf;
                unsigned long len = size;
                struct signature_check sigc = { NULL };
diff --git a/fsck.c b/fsck.c
index 807a84971a29bbac6c8e0f7811f6db20b3075df2..0343fb7a8870ef3d6eb313281e53c0d06d5f70c8 100644 (file)
--- a/fsck.c
+++ b/fsck.c
@@ -1332,7 +1332,7 @@ static int fsck_blobs(struct oidset *blobs_found, struct oidset *blobs_done,
                if (oidset_contains(blobs_done, oid))
                        continue;
 
-               buf = read_object_file(oid, &type, &size);
+               buf = repo_read_object_file(the_repository, oid, &type, &size);
                if (!buf) {
                        if (is_promisor_object(oid))
                                continue;
index 45d5cc0972fe1bd76a2e0dbf9c0f10fd4113b7ac..6776f3f2758a3ebb8075def25ed02c48298f6e90 100644 (file)
@@ -362,7 +362,8 @@ static void start_put(struct transfer_request *request)
        ssize_t size;
        git_zstream stream;
 
-       unpacked = read_object_file(&request->obj->oid, &type, &len);
+       unpacked = repo_read_object_file(the_repository, &request->obj->oid,
+                                        &type, &len);
        hdrlen = format_object_header(hdr, sizeof(hdr), type, len);
 
        /* Set it up */
@@ -1427,7 +1428,7 @@ static void one_remote_ref(const char *refname)
         * Fetch a copy of the object if it doesn't exist locally - it
         * may be required for updating server info later.
         */
-       if (repo->can_update_info_refs && !has_object_file(&ref->old_oid)) {
+       if (repo->can_update_info_refs && !repo_has_object_file(the_repository, &ref->old_oid)) {
                obj = lookup_unknown_object(the_repository, &ref->old_oid);
                fprintf(stderr, "  fetch %s for %s\n",
                        oid_to_hex(&ref->old_oid), refname);
@@ -1628,14 +1629,14 @@ static int delete_remote_branch(const char *pattern, int force)
                        return error("Remote HEAD symrefs too deep");
                if (is_null_oid(&head_oid))
                        return error("Unable to resolve remote HEAD");
-               if (!has_object_file(&head_oid))
+               if (!repo_has_object_file(the_repository, &head_oid))
                        return error("Remote HEAD resolves to object %s\nwhich does not exist locally, perhaps you need to fetch?", oid_to_hex(&head_oid));
 
                /* Remote branch must resolve to a known object */
                if (is_null_oid(&remote_ref->old_oid))
                        return error("Unable to resolve remote branch %s",
                                     remote_ref->name);
-               if (!has_object_file(&remote_ref->old_oid))
+               if (!repo_has_object_file(the_repository, &remote_ref->old_oid))
                        return error("Remote branch %s resolves to object %s\nwhich does not exist locally, perhaps you need to fetch?", remote_ref->name, oid_to_hex(&remote_ref->old_oid));
 
                /* Remote branch must be an ancestor of remote HEAD */
@@ -1855,7 +1856,7 @@ int cmd_main(int argc, const char **argv)
                if (!force_all &&
                    !is_null_oid(&ref->old_oid) &&
                    !ref->force) {
-                       if (!has_object_file(&ref->old_oid) ||
+                       if (!repo_has_object_file(the_repository, &ref->old_oid) ||
                            !ref_newer(&ref->peer_ref->new_oid,
                                       &ref->old_oid)) {
                                /*
index b8f0f98ae146999adf3770cc7338cbacbbbf8cb3..da1b6b6421005fe8ed14732602ee12a02cd4d9c6 100644 (file)
@@ -135,7 +135,7 @@ static int fill_active_slot(struct walker *walker)
        list_for_each_safe(pos, tmp, head) {
                obj_req = list_entry(pos, struct object_request, node);
                if (obj_req->state == WAITING) {
-                       if (has_object_file(&obj_req->oid))
+                       if (repo_has_object_file(the_repository, &obj_req->oid))
                                obj_req->state = COMPLETE;
                        else {
                                start_object_request(walker, obj_req);
@@ -492,7 +492,7 @@ static int fetch_object(struct walker *walker, unsigned char *hash)
        if (!obj_req)
                return error("Couldn't find request for %s in the queue", hex);
 
-       if (has_object_file(&obj_req->oid)) {
+       if (repo_has_object_file(the_repository, &obj_req->oid)) {
                if (obj_req->req)
                        abort_http_object_request(obj_req->req);
                abort_object_request(obj_req);
index 5550b3aafeb880c0daad7b52777eba942599d11c..ccad7304dfa76b71412c7d3f57cd9f8b3606a3f0 100644 (file)
@@ -64,7 +64,7 @@ static void process_blob(struct traversal_context *ctx,
         * of missing objects.
         */
        if (ctx->revs->exclude_promisor_objects &&
-           !has_object_file(&obj->oid) &&
+           !repo_has_object_file(the_repository, &obj->oid) &&
            is_promisor_object(&obj->oid))
                return;
 
index ed8289aea58bb434156ead76152b48c2a817fcd8..f68f664bb1b45490e045602735bab229b4f991df 100644 (file)
--- a/mailmap.c
+++ b/mailmap.c
@@ -216,7 +216,7 @@ static int read_mailmap_blob(struct string_list *map, const char *name)
        if (repo_get_oid(the_repository, name, &oid) < 0)
                return 0;
 
-       buf = read_object_file(&oid, &type, &size);
+       buf = repo_read_object_file(the_repository, &oid, &type, &size);
        if (!buf)
                return error("unable to read mailmap object at %s", name);
        if (type != OBJ_BLOB)
index 49398e599fe3afdc88f481608fb58b0887b019e3..dfc4093425e5314526d324ea0bee2159a7cf4b12 100644 (file)
@@ -55,7 +55,7 @@ static void *fill_tree_desc_strict(struct tree_desc *desc,
        enum object_type type;
        unsigned long size;
 
-       buffer = read_object_file(hash, &type, &size);
+       buffer = repo_read_object_file(the_repository, hash, &type, &size);
        if (!buffer)
                die("unable to read tree (%s)", oid_to_hex(hash));
        if (type != OBJ_TREE)
@@ -188,7 +188,7 @@ static int splice_tree(const struct object_id *oid1, const char *prefix,
        if (*subpath)
                subpath++;
 
-       buf = read_object_file(oid1, &type, &sz);
+       buf = repo_read_object_file(the_repository, oid1, &type, &sz);
        if (!buf)
                die("cannot read tree %s", oid_to_hex(oid1));
        init_tree_desc(&desc, buf, sz);
index 8138090f81cf726ee9834daa7edbfc5b542aec44..f13246406c284baabe3a7538bb5eab4850ff787f 100644 (file)
@@ -12,7 +12,8 @@ static int fill_mmfile_blob(mmfile_t *f, struct blob *obj)
        unsigned long size;
        enum object_type type;
 
-       buf = read_object_file(&obj->object.oid, &type, &size);
+       buf = repo_read_object_file(the_repository, &obj->object.oid, &type,
+                                   &size);
        if (!buf)
                return -1;
        if (type != OBJ_BLOB) {
@@ -78,7 +79,8 @@ void *merge_blobs(struct index_state *istate, const char *path,
                        return NULL;
                if (!our)
                        our = their;
-               return read_object_file(&our->object.oid, &type, size);
+               return repo_read_object_file(the_repository, &our->object.oid,
+                                            &type, size);
        }
 
        if (fill_mmfile_blob(&f1, our) < 0)
index e9f8bd1598288264cf10df8c64c8f7d5050d4ac9..979e8b057b165f71ae539d8aefc537989a422ba1 100644 (file)
@@ -3505,7 +3505,7 @@ static int read_oid_strbuf(struct merge_options *opt,
        void *buf;
        enum object_type type;
        unsigned long size;
-       buf = read_object_file(oid, &type, &size);
+       buf = repo_read_object_file(the_repository, oid, &type, &size);
        if (!buf)
                return err(opt, _("cannot read object %s"), oid_to_hex(oid));
        if (type != OBJ_BLOB) {
index 75fa0ef318365425de7ca3e0c38cb95fbbdd7b7b..d83ce19bb1f8d55c5ac5ae3bca43cc42519d01b5 100644 (file)
@@ -951,7 +951,8 @@ static int update_file_flags(struct merge_options *opt,
                        goto update_index;
                }
 
-               buf = read_object_file(&contents->oid, &type, &size);
+               buf = repo_read_object_file(the_repository, &contents->oid,
+                                           &type, &size);
                if (!buf) {
                        ret = err(opt, _("cannot read object %s '%s'"),
                                  oid_to_hex(&contents->oid), path);
@@ -3021,7 +3022,7 @@ static int read_oid_strbuf(struct merge_options *opt,
        void *buf;
        enum object_type type;
        unsigned long size;
-       buf = read_object_file(oid, &type, &size);
+       buf = repo_read_object_file(the_repository, oid, &type, &size);
        if (!buf)
                return err(opt, _("cannot read object %s"), oid_to_hex(oid));
        if (type != OBJ_BLOB) {
index 9dfd251a8151d4205297b5c27064a01acf448f69..3846609136022296baabbec45fc3064fef42b696 100644 (file)
@@ -81,7 +81,7 @@ char *notes_cache_get(struct notes_cache *c, struct object_id *key_oid,
        value_oid = get_note(&c->tree, key_oid);
        if (!value_oid)
                return NULL;
-       value = read_object_file(value_oid, &type, &size);
+       value = repo_read_object_file(the_repository, value_oid, &type, &size);
 
        *outsize = size;
        return value;
index df1a16ac66c43bdf2f375953a258fb58483aa198..8a09cd9f77c0f4f5689dc6c147b0e9c68edf9854 100644 (file)
@@ -326,7 +326,7 @@ static void write_note_to_worktree(const struct object_id *obj,
 {
        enum object_type type;
        unsigned long size;
-       void *buf = read_object_file(note, &type, &size);
+       void *buf = repo_read_object_file(the_repository, note, &type, &size);
 
        if (!buf)
                die("cannot read note %s for object %s",
diff --git a/notes.c b/notes.c
index 750e18c4004d454fc02358034c51129d24bed685..e4dab62cad3b552d6a8b2b2432acf77bec1497c8 100644 (file)
--- a/notes.c
+++ b/notes.c
@@ -786,7 +786,7 @@ static int prune_notes_helper(const struct object_id *object_oid,
        struct note_delete_list **l = (struct note_delete_list **) cb_data;
        struct note_delete_list *n;
 
-       if (has_object_file(object_oid))
+       if (repo_has_object_file(the_repository, object_oid))
                return 0; /* nothing to do for this note */
 
        /* failed to find object => prune this note */
@@ -807,13 +807,15 @@ int combine_notes_concatenate(struct object_id *cur_oid,
 
        /* read in both note blob objects */
        if (!is_null_oid(new_oid))
-               new_msg = read_object_file(new_oid, &new_type, &new_len);
+               new_msg = repo_read_object_file(the_repository, new_oid,
+                                               &new_type, &new_len);
        if (!new_msg || !new_len || new_type != OBJ_BLOB) {
                free(new_msg);
                return 0;
        }
        if (!is_null_oid(cur_oid))
-               cur_msg = read_object_file(cur_oid, &cur_type, &cur_len);
+               cur_msg = repo_read_object_file(the_repository, cur_oid,
+                                               &cur_type, &cur_len);
        if (!cur_msg || !cur_len || cur_type != OBJ_BLOB) {
                free(cur_msg);
                free(new_msg);
@@ -869,7 +871,7 @@ static int string_list_add_note_lines(struct string_list *list,
                return 0;
 
        /* read_sha1_file NUL-terminates */
-       data = read_object_file(oid, &t, &len);
+       data = repo_read_object_file(the_repository, oid, &t, &len);
        if (t != OBJ_BLOB || !data || !len) {
                free(data);
                return t != OBJ_BLOB || !data;
@@ -1264,7 +1266,7 @@ static void format_note(struct notes_tree *t, const struct object_id *object_oid
        if (!oid)
                return;
 
-       if (!(msg = read_object_file(oid, &type, &msglen)) || type != OBJ_BLOB) {
+       if (!(msg = repo_read_object_file(the_repository, oid, &type, &msglen)) || type != OBJ_BLOB) {
                free(msg);
                return;
        }
index 939865c1ae0566ba577861505f2ecf2e9fd19eeb..141cf85f25bd1b9601384cbff65505ca1586a0f8 100644 (file)
@@ -1678,7 +1678,7 @@ int pretend_object_file(void *buf, unsigned long len, enum object_type type,
        struct cached_object *co;
 
        hash_object_file(the_hash_algo, buf, len, type, oid);
-       if (has_object_file_with_flags(oid, OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT) ||
+       if (repo_has_object_file_with_flags(the_repository, oid, OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT) ||
            find_cached_object(oid))
                return 0;
        ALLOC_GROW(cached_objects, cached_object_nr + 1, cached_object_alloc);
index 1a713d89d7c872bfd253c4a88bec6efa8ed597f8..b47849d4e7e22281b6cf243a698aa6def5b9b166 100644 (file)
@@ -245,9 +245,6 @@ void *repo_read_object_file(struct repository *r,
                            const struct object_id *oid,
                            enum object_type *type,
                            unsigned long *size);
-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
-#define read_object_file(oid, type, size) repo_read_object_file(the_repository, oid, type, size)
-#endif
 
 /* Read and unpack an object file into memory, write memory to an object file */
 int oid_object_info(struct repository *r, const struct object_id *, unsigned long *);
@@ -324,10 +321,6 @@ int has_object(struct repository *r, const struct object_id *oid,
 int repo_has_object_file(struct repository *r, const struct object_id *oid);
 int repo_has_object_file_with_flags(struct repository *r,
                                    const struct object_id *oid, int flags);
-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
-#define has_object_file(oid) repo_has_object_file(the_repository, oid)
-#define has_object_file_with_flags(oid, flags) repo_has_object_file_with_flags(the_repository, oid, flags)
-#endif
 
 /*
  * Return true iff an alternate object database has a loose object
index d6c69164d0fbf24484cd18445587d208a63a899e..1548e886684d9b005cd12fb66d209c242927582d 100644 (file)
@@ -263,7 +263,7 @@ static int ce_compare_link(const struct cache_entry *ce, size_t expected_size)
        if (strbuf_readlink(&sb, ce->name, expected_size))
                return -1;
 
-       buffer = read_object_file(&ce->oid, &type, &size);
+       buffer = repo_read_object_file(the_repository, &ce->oid, &type, &size);
        if (buffer) {
                if (size == sb.len)
                        match = memcmp(buffer, sb.buf, size);
@@ -3553,7 +3553,8 @@ void *read_blob_data_from_index(struct index_state *istate,
        }
        if (pos < 0)
                return NULL;
-       data = read_object_file(&istate->cache[pos]->oid, &type, &sz);
+       data = repo_read_object_file(the_repository, &istate->cache[pos]->oid,
+                                    &type, &sz);
        if (!data || type != OBJ_BLOB) {
                free(data);
                return NULL;
index 6e8362e7a2f4df9d471c8ccdc38bf01c813ca874..510663e1e5176768ab7721eae885dda678eb2451 100644 (file)
--- a/reflog.c
+++ b/reflog.c
@@ -28,7 +28,8 @@ static int tree_is_complete(const struct object_id *oid)
        if (!tree->buffer) {
                enum object_type type;
                unsigned long size;
-               void *data = read_object_file(oid, &type, &size);
+               void *data = repo_read_object_file(the_repository, oid, &type,
+                                                  &size);
                if (!data) {
                        tree->object.flags |= INCOMPLETE;
                        return 0;
@@ -39,7 +40,7 @@ static int tree_is_complete(const struct object_id *oid)
        init_tree_desc(&desc, tree->buffer, tree->size);
        complete = 1;
        while (tree_entry(&desc, &entry)) {
-               if (!has_object_file(&entry.oid) ||
+               if (!repo_has_object_file(the_repository, &entry.oid) ||
                    (S_ISDIR(entry.mode) && !tree_is_complete(&entry.oid))) {
                        tree->object.flags |= INCOMPLETE;
                        complete = 0;
index 71b1ae2db05d731d693ff9cc700125a29aac39b9..12f6bea62524ad43bbb7eb4a08faacfc3b6c98d9 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -1759,7 +1759,7 @@ void set_ref_status_for_push(struct ref *remote_refs, int send_mirror,
                if (!reject_reason && !ref->deletion && !is_null_oid(&ref->old_oid)) {
                        if (starts_with(ref->name, "refs/tags/"))
                                reject_reason = REF_STATUS_REJECT_ALREADY_EXISTS;
-                       else if (!has_object_file(&ref->old_oid))
+                       else if (!repo_has_object_file(the_repository, &ref->old_oid))
                                reject_reason = REF_STATUS_REJECT_FETCH_FIRST;
                        else if (!lookup_commit_reference_gently(the_repository, &ref->old_oid, 1) ||
                                 !lookup_commit_reference_gently(the_repository, &ref->new_oid, 1))
index 876ab435da949c8359c315636225d9fd7fd962ab..dfbc1d555ec8ebad1f9b9a2f72eaaa00f07ca055 100644 (file)
--- a/rerere.c
+++ b/rerere.c
@@ -965,8 +965,9 @@ static int handle_cache(struct index_state *istate,
                        break;
                i = ce_stage(ce) - 1;
                if (!mmfile[i].ptr) {
-                       mmfile[i].ptr = read_object_file(&ce->oid, &type,
-                                                        &size);
+                       mmfile[i].ptr = repo_read_object_file(the_repository,
+                                                             &ce->oid, &type,
+                                                             &size);
                        mmfile[i].size = size;
                }
        }
index f2e19838c9c342b3b9d6df5e9bf24d0add0d47d1..8f8b3d986c7cd8dc3a7b38173011873f3fb5904b 100644 (file)
@@ -42,9 +42,9 @@ int option_parse_push_signed(const struct option *opt,
 static void feed_object(const struct object_id *oid, FILE *fh, int negative)
 {
        if (negative &&
-           !has_object_file_with_flags(oid,
-                                       OBJECT_INFO_SKIP_FETCH_OBJECT |
-                                       OBJECT_INFO_QUICK))
+           !repo_has_object_file_with_flags(the_repository, oid,
+                                            OBJECT_INFO_SKIP_FETCH_OBJECT |
+                                            OBJECT_INFO_QUICK))
                return;
 
        if (negative)
index 1a2b159fd4eb26517a5499b1d3e78cc278d7e965..07278467e47f11118dae147c664630329461bc17 100644 (file)
--- a/shallow.c
+++ b/shallow.c
@@ -301,7 +301,7 @@ static int write_one_shallow(const struct commit_graft *graft, void *cb_data)
        if (graft->nr_parent != -1)
                return 0;
        if (data->flags & QUICK) {
-               if (!has_object_file(&graft->oid))
+               if (!repo_has_object_file(the_repository, &graft->oid))
                        return 0;
        } else if (data->flags & SEEN_ONLY) {
                struct commit *c = lookup_commit(the_repository, &graft->oid);
@@ -466,7 +466,7 @@ void prepare_shallow_info(struct shallow_info *info, struct oid_array *sa)
        ALLOC_ARRAY(info->ours, sa->nr);
        ALLOC_ARRAY(info->theirs, sa->nr);
        for (i = 0; i < sa->nr; i++) {
-               if (has_object_file(sa->oid + i)) {
+               if (repo_has_object_file(the_repository, sa->oid + i)) {
                        struct commit_graft *graft;
                        graft = lookup_commit_graft(the_repository,
                                                    &sa->oid[i]);
@@ -494,7 +494,7 @@ void remove_nonexistent_theirs_shallow(struct shallow_info *info)
        for (i = dst = 0; i < info->nr_theirs; i++) {
                if (i != dst)
                        info->theirs[dst] = info->theirs[i];
-               if (has_object_file(oid + info->theirs[i]))
+               if (repo_has_object_file(the_repository, oid + info->theirs[i]))
                        dst++;
        }
        info->nr_theirs = dst;
index 336732ed785dc99292ac29457f6fce8922454586..4245bc5975c288eba5ed3779cc524b7591881754 100644 (file)
@@ -588,7 +588,8 @@ static const struct submodule *config_from(struct submodule_cache *cache,
        if (submodule)
                goto out;
 
-       config = read_object_file(&oid, &type, &config_size);
+       config = repo_read_object_file(the_repository, &oid, &type,
+                                      &config_size);
        if (!config || type != OBJ_BLOB)
                goto out;
 
diff --git a/tag.c b/tag.c
index dfc900e62e0ecead865488a5008468867d83f1b8..d62084842f2dcb5562553e49e9c331400223b6f2 100644 (file)
--- a/tag.c
+++ b/tag.c
@@ -54,7 +54,7 @@ int gpg_verify_tag(const struct object_id *oid, const char *name_to_report,
                                repo_find_unique_abbrev(the_repository, oid, DEFAULT_ABBREV),
                                type_name(type));
 
-       buf = read_object_file(oid, &type, &size);
+       buf = repo_read_object_file(the_repository, oid, &type, &size);
        if (!buf)
                return error("%s: unable to read file.",
                                name_to_report ?
@@ -216,7 +216,8 @@ int parse_tag(struct tag *item)
 
        if (item->object.parsed)
                return 0;
-       data = read_object_file(&item->object.oid, &type, &size);
+       data = repo_read_object_file(the_repository, &item->object.oid, &type,
+                                    &size);
        if (!data)
                return error("Could not read %s",
                             oid_to_hex(&item->object.oid));
diff --git a/tree.c b/tree.c
index f0742f4167b6783c81cff180de474ad1120e4094..1b403c4b5ce8db0a3481fe554ba44859aee8d59d 100644 (file)
--- a/tree.c
+++ b/tree.c
@@ -129,7 +129,8 @@ int parse_tree_gently(struct tree *item, int quiet_on_missing)
 
        if (item->object.parsed)
                return 0;
-       buffer = read_object_file(&item->object.oid, &type, &size);
+       buffer = repo_read_object_file(the_repository, &item->object.oid,
+                                      &type, &size);
        if (!buffer)
                return quiet_on_missing ? -1 :
                        error("Could not read %s",
index 551f22ffa5d63ceabbf5909ee1926b8471722920..4ef27ed47fb7b16bb01c90e4e7b50f748a97d338 100644 (file)
@@ -499,8 +499,8 @@ static int got_oid(struct upload_pack_data *data,
 {
        if (get_oid_hex(hex, oid))
                die("git upload-pack: expected SHA1 object, got '%s'", hex);
-       if (!has_object_file_with_flags(oid,
-                                       OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT))
+       if (!repo_has_object_file_with_flags(the_repository, oid,
+                                            OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT))
                return -1;
        return do_got_oid(data, oid);
 }
@@ -1600,8 +1600,8 @@ static int process_haves(struct upload_pack_data *data, struct oid_array *common
        for (i = 0; i < data->haves.nr; i++) {
                const struct object_id *oid = &data->haves.oid[i];
 
-               if (!has_object_file_with_flags(oid,
-                                               OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT))
+               if (!repo_has_object_file_with_flags(the_repository, oid,
+                                                    OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT))
                        continue;
 
                oid_array_append(common, oid);
index 98d65a559b41b038629b8e76dd74454d42f98436..8418066e50969afb4b110babfe621d3c29d54302 100644 (file)
--- a/walker.c
+++ b/walker.c
@@ -145,7 +145,7 @@ static int process(struct walker *walker, struct object *obj)
                return 0;
        obj->flags |= SEEN;
 
-       if (has_object_file(&obj->oid)) {
+       if (repo_has_object_file(the_repository, &obj->oid)) {
                /* We already have it, so we should scan it now. */
                obj->flags |= TO_SCAN;
        }
index e87950de32e5602765de26953ce7ec812ef30925..c6f244116ceed8cdca4962ea26ef18ab281f1675 100644 (file)
@@ -183,7 +183,7 @@ void read_mmblob(mmfile_t *ptr, const struct object_id *oid)
                return;
        }
 
-       ptr->ptr = read_object_file(oid, &type, &size);
+       ptr->ptr = repo_read_object_file(the_repository, oid, &type, &size);
        if (!ptr->ptr || type != OBJ_BLOB)
                die("unable to read blob object %s", oid_to_hex(oid));
        ptr->size = size;