cache.h: add repository argument to oid_object_info
authorStefan Beller <sbeller@google.com>
Wed, 25 Apr 2018 18:20:59 +0000 (11:20 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 26 Apr 2018 01:54:27 +0000 (10:54 +0900)
Add a repository argument to allow the callers of oid_object_info
to be more specific about which repository to handle. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

Signed-off-by: Stefan Beller <sbeller@google.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
32 files changed:
archive-tar.c
archive-zip.c
blame.c
builtin/blame.c
builtin/cat-file.c
builtin/describe.c
builtin/fast-export.c
builtin/fetch.c
builtin/fsck.c
builtin/index-pack.c
builtin/ls-tree.c
builtin/mktree.c
builtin/pack-objects.c
builtin/prune.c
builtin/replace.c
builtin/tag.c
builtin/unpack-objects.c
cache.h
diff.c
fast-import.c
list-objects-filter.c
object.c
pack-bitmap-write.c
packfile.c
reachable.c
refs.c
remote.c
sequencer.c
sha1_file.c
sha1_name.c
submodule.c
tag.c
index 3563bcb9f263f7782a77c679bf9be32af6bd13df..f93409324f9d4f18a4b44b35eb4b2cf3514234fb 100644 (file)
@@ -276,7 +276,7 @@ static int write_tar_entry(struct archiver_args *args,
                memcpy(header.name, path, pathlen);
 
        if (S_ISREG(mode) && !args->convert &&
                memcpy(header.name, path, pathlen);
 
        if (S_ISREG(mode) && !args->convert &&
-           oid_object_info(oid, &size) == OBJ_BLOB &&
+           oid_object_info(the_repository, oid, &size) == OBJ_BLOB &&
            size > big_file_threshold)
                buffer = NULL;
        else if (S_ISLNK(mode) || S_ISREG(mode)) {
            size > big_file_threshold)
                buffer = NULL;
        else if (S_ISLNK(mode) || S_ISREG(mode)) {
index 6b20bce4d1cd78563037c8658dd8bd8f7690c47b..74f3fe9103420571c9f22273ae44ebb9d5715c78 100644 (file)
@@ -325,7 +325,8 @@ static int write_zip_entry(struct archiver_args *args,
                compressed_size = 0;
                buffer = NULL;
        } else if (S_ISREG(mode) || S_ISLNK(mode)) {
                compressed_size = 0;
                buffer = NULL;
        } else if (S_ISREG(mode) || S_ISLNK(mode)) {
-               enum object_type type = oid_object_info(oid, &size);
+               enum object_type type = oid_object_info(the_repository, oid,
+                                                       &size);
 
                method = 0;
                attr2 = S_ISLNK(mode) ? ((mode | 0777) << 16) :
 
                method = 0;
                attr2 = S_ISLNK(mode) ? ((mode | 0777) << 16) :
diff --git a/blame.c b/blame.c
index 78c9808bd1a04a4c641b0f5f853540ea7618a522..dfa24473dc6e3d3d6428ca0fcdff75861d0c1aec 100644 (file)
--- a/blame.c
+++ b/blame.c
@@ -81,7 +81,7 @@ static void verify_working_tree_path(struct commit *work_tree, const char *path)
                unsigned mode;
 
                if (!get_tree_entry(commit_oid, path, &blob_oid, &mode) &&
                unsigned mode;
 
                if (!get_tree_entry(commit_oid, path, &blob_oid, &mode) &&
-                   oid_object_info(&blob_oid, NULL) == OBJ_BLOB)
+                   oid_object_info(the_repository, &blob_oid, NULL) == OBJ_BLOB)
                        return;
        }
 
                        return;
        }
 
@@ -504,7 +504,7 @@ static int fill_blob_sha1_and_mode(struct blame_origin *origin)
                return 0;
        if (get_tree_entry(&origin->commit->object.oid, origin->path, &origin->blob_oid, &origin->mode))
                goto error_out;
                return 0;
        if (get_tree_entry(&origin->commit->object.oid, origin->path, &origin->blob_oid, &origin->mode))
                goto error_out;
-       if (oid_object_info(&origin->blob_oid, NULL) != OBJ_BLOB)
+       if (oid_object_info(the_repository, &origin->blob_oid, NULL) != OBJ_BLOB)
                goto error_out;
        return 0;
  error_out:
                goto error_out;
        return 0;
  error_out:
index db38c0b307c5719ab3bd5e6b8597ec8810c0de3d..bfdf7cc1325826d6b7a41520b52a07f2fa1cb042 100644 (file)
@@ -655,7 +655,7 @@ static int is_a_rev(const char *name)
 
        if (get_oid(name, &oid))
                return 0;
 
        if (get_oid(name, &oid))
                return 0;
-       return OBJ_NONE < oid_object_info(&oid, NULL);
+       return OBJ_NONE < oid_object_info(the_repository, &oid, NULL);
 }
 
 int cmd_blame(int argc, const char **argv, const char *prefix)
 }
 
 int cmd_blame(int argc, const char **argv, const char *prefix)
index 4ecdb9ff54a4e6deb3877b18046438e4c5fef23d..b8ecbea98e966f00004d85cdb1b9f43f2fb444a2 100644 (file)
@@ -116,7 +116,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
                /* else fallthrough */
 
        case 'p':
                /* else fallthrough */
 
        case 'p':
-               type = oid_object_info(&oid, NULL);
+               type = oid_object_info(the_repository, &oid, NULL);
                if (type < 0)
                        die("Not a valid object name %s", obj_name);
 
                if (type < 0)
                        die("Not a valid object name %s", obj_name);
 
@@ -140,7 +140,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
        case 0:
                if (type_from_string(exp_type) == OBJ_BLOB) {
                        struct object_id blob_oid;
        case 0:
                if (type_from_string(exp_type) == OBJ_BLOB) {
                        struct object_id blob_oid;
-                       if (oid_object_info(&oid, NULL) == OBJ_TAG) {
+                       if (oid_object_info(the_repository, &oid, NULL) == OBJ_TAG) {
                                char *buffer = read_object_file(&oid, &type,
                                                                &size);
                                const char *target;
                                char *buffer = read_object_file(&oid, &type,
                                                                &size);
                                const char *target;
@@ -151,7 +151,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
                        } else
                                oidcpy(&blob_oid, &oid);
 
                        } else
                                oidcpy(&blob_oid, &oid);
 
-                       if (oid_object_info(&blob_oid, NULL) == OBJ_BLOB)
+                       if (oid_object_info(the_repository, &blob_oid, NULL) == OBJ_BLOB)
                                return stream_blob_to_fd(1, &blob_oid, NULL, 0);
                        /*
                         * we attempted to dereference a tag to a blob
                                return stream_blob_to_fd(1, &blob_oid, NULL, 0);
                        /*
                         * we attempted to dereference a tag to a blob
index de840f96a4ba0135667261cfd74c674672f4c6b4..66c497f7896b597974e1c0fb2db7ff22e051d894 100644 (file)
@@ -502,7 +502,7 @@ static void describe(const char *arg, int last_one)
 
        if (cmit)
                describe_commit(&oid, &sb);
 
        if (cmit)
                describe_commit(&oid, &sb);
-       else if (oid_object_info(&oid, NULL) == OBJ_BLOB)
+       else if (oid_object_info(the_repository, &oid, NULL) == OBJ_BLOB)
                describe_blob(oid, &sb);
        else
                die(_("%s is neither a commit nor blob"), arg);
                describe_blob(oid, &sb);
        else
                die(_("%s is neither a commit nor blob"), arg);
index a15898d64177b380ea021e3bc63fb91446bc02b3..373c794873efd8f771afc7a750aabf067d83411c 100644 (file)
@@ -947,7 +947,7 @@ static void import_marks(char *input_file)
                if (last_idnum < mark)
                        last_idnum = mark;
 
                if (last_idnum < mark)
                        last_idnum = mark;
 
-               type = oid_object_info(&oid, NULL);
+               type = oid_object_info(the_repository, &oid, NULL);
                if (type < 0)
                        die("object not found: %s", oid_to_hex(&oid));
 
                if (type < 0)
                        die("object not found: %s", oid_to_hex(&oid));
 
index dcdfc66f09af70c4b8e3c08a99c80202be7b4e68..73be393b2eaa37aa0831b7c5b767569b6deb3cc0 100644 (file)
@@ -637,7 +637,7 @@ static int update_local_ref(struct ref *ref,
        struct branch *current_branch = branch_get(NULL);
        const char *pretty_ref = prettify_refname(ref->name);
 
        struct branch *current_branch = branch_get(NULL);
        const char *pretty_ref = prettify_refname(ref->name);
 
-       type = oid_object_info(&ref->new_oid, NULL);
+       type = oid_object_info(the_repository, &ref->new_oid, NULL);
        if (type < 0)
                die(_("object %s not found"), oid_to_hex(&ref->new_oid));
 
        if (type < 0)
                die(_("object %s not found"), oid_to_hex(&ref->new_oid));
 
index 087360a6757c607c4b38cce5fafad3bbb0822fc0..9d59d7d5a215379b221b02ac34277b542e757df1 100644 (file)
@@ -67,7 +67,8 @@ static const char *printable_type(struct object *obj)
        const char *ret;
 
        if (obj->type == OBJ_NONE) {
        const char *ret;
 
        if (obj->type == OBJ_NONE) {
-               enum object_type type = oid_object_info(&obj->oid, NULL);
+               enum object_type type = oid_object_info(the_repository,
+                                                       &obj->oid, NULL);
                if (type > 0)
                        object_as_type(obj, type, 0);
        }
                if (type > 0)
                        object_as_type(obj, type, 0);
        }
index d81473e722e7c99b9b05b34506fa4925196ff6d7..2d04a596f508196d185e04899f9f3066ad94f57a 100644 (file)
@@ -223,7 +223,7 @@ static unsigned check_object(struct object *obj)
 
        if (!(obj->flags & FLAG_CHECKED)) {
                unsigned long size;
 
        if (!(obj->flags & FLAG_CHECKED)) {
                unsigned long size;
-               int type = oid_object_info(&obj->oid, &size);
+               int type = oid_object_info(the_repository, &obj->oid, &size);
                if (type <= 0)
                        die(_("did not receive expected object %s"),
                              oid_to_hex(&obj->oid));
                if (type <= 0)
                        die(_("did not receive expected object %s"),
                              oid_to_hex(&obj->oid));
@@ -812,7 +812,7 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
                enum object_type has_type;
                unsigned long has_size;
                read_lock();
                enum object_type has_type;
                unsigned long has_size;
                read_lock();
-               has_type = oid_object_info(oid, &has_size);
+               has_type = oid_object_info(the_repository, oid, &has_size);
                if (has_type < 0)
                        die(_("cannot read existing object info %s"), oid_to_hex(oid));
                if (has_type != type || has_size != size)
                if (has_type < 0)
                        die(_("cannot read existing object info %s"), oid_to_hex(oid));
                if (has_type != type || has_size != size)
index d44b4f9c27d31cfa331ccef7ae538d8a6e6c38c6..409da4e8351f6d8719671d3176f0ea34fe9b756c 100644 (file)
@@ -94,7 +94,7 @@ static int show_tree(const struct object_id *oid, struct strbuf *base,
                        char size_text[24];
                        if (!strcmp(type, blob_type)) {
                                unsigned long size;
                        char size_text[24];
                        if (!strcmp(type, blob_type)) {
                                unsigned long size;
-                               if (oid_object_info(oid, &size) == OBJ_BAD)
+                               if (oid_object_info(the_repository, oid, &size) == OBJ_BAD)
                                        xsnprintf(size_text, sizeof(size_text),
                                                  "BAD");
                                else
                                        xsnprintf(size_text, sizeof(size_text),
                                                  "BAD");
                                else
index 263c530315a4fe435a88f2042c768350f72e837b..bb76b469fd1f57319f3d202c1e2658d77962d698 100644 (file)
@@ -116,7 +116,7 @@ static void mktree_line(char *buf, size_t len, int nul_term_line, int allow_miss
        }
 
        /* Check the type of object identified by sha1 */
        }
 
        /* Check the type of object identified by sha1 */
-       obj_type = oid_object_info(&oid, NULL);
+       obj_type = oid_object_info(the_repository, &oid, NULL);
        if (obj_type < 0) {
                if (allow_missing) {
                        ; /* no problem - missing objects are presumed to be of the right type */
        if (obj_type < 0) {
                if (allow_missing) {
                        ; /* no problem - missing objects are presumed to be of the right type */
index 4bdae5a1d8f4c988064475c0583e19c06dabf101..8d4111f748cad1896556c070f961ca97896f0b8b 100644 (file)
@@ -1516,7 +1516,8 @@ static void check_object(struct object_entry *entry)
                unuse_pack(&w_curs);
        }
 
                unuse_pack(&w_curs);
        }
 
-       entry->type = oid_object_info(&entry->idx.oid, &entry->size);
+       entry->type = oid_object_info(the_repository, &entry->idx.oid,
+                                     &entry->size);
        /*
         * The error condition is checked in prepare_pack().  This is
         * to permit a missing preferred base object to be ignored
        /*
         * The error condition is checked in prepare_pack().  This is
         * to permit a missing preferred base object to be ignored
@@ -1578,7 +1579,8 @@ static void drop_reused_delta(struct object_entry *entry)
                 * And if that fails, the error will be recorded in entry->type
                 * and dealt with in prepare_pack().
                 */
                 * And if that fails, the error will be recorded in entry->type
                 * and dealt with in prepare_pack().
                 */
-               entry->type = oid_object_info(&entry->idx.oid, &entry->size);
+               entry->type = oid_object_info(the_repository, &entry->idx.oid,
+                                             &entry->size);
        }
 }
 
        }
 }
 
@@ -2706,7 +2708,7 @@ static void add_objects_in_unpacked_packs(struct rev_info *revs)
 static int add_loose_object(const struct object_id *oid, const char *path,
                            void *data)
 {
 static int add_loose_object(const struct object_id *oid, const char *path,
                            void *data)
 {
-       enum object_type type = oid_object_info(oid, NULL);
+       enum object_type type = oid_object_info(the_repository, oid, NULL);
 
        if (type < 0) {
                warning("loose object at %s could not be examined", path);
 
        if (type < 0) {
                warning("loose object at %s could not be examined", path);
index 38ced18dadff03836c6bed3fcbdefe8bd528a7c0..518ffbea1397faa35102dc088a3830e40c9b13a6 100644 (file)
@@ -50,7 +50,8 @@ static int prune_object(const struct object_id *oid, const char *fullpath,
        if (st.st_mtime > expire)
                return 0;
        if (show_only || verbose) {
        if (st.st_mtime > expire)
                return 0;
        if (show_only || verbose) {
-               enum object_type type = oid_object_info(oid, NULL);
+               enum object_type type = oid_object_info(the_repository, oid,
+                                                       NULL);
                printf("%s %s\n", oid_to_hex(oid),
                       (type > 0) ? type_name(type) : "unknown");
        }
                printf("%s %s\n", oid_to_hex(oid),
                       (type > 0) ? type_name(type) : "unknown");
        }
index 237ea656cfb6297da175c3d4681edb748883ed55..14e142d5a80044a6e9565db7fcb7b327387fd128 100644 (file)
@@ -55,8 +55,9 @@ static int show_reference(const char *refname, const struct object_id *oid,
                        if (get_oid(refname, &object))
                                return error("Failed to resolve '%s' as a valid ref.", refname);
 
                        if (get_oid(refname, &object))
                                return error("Failed to resolve '%s' as a valid ref.", refname);
 
-                       obj_type = oid_object_info(&object, NULL);
-                       repl_type = oid_object_info(oid, NULL);
+                       obj_type = oid_object_info(the_repository, &object,
+                                                  NULL);
+                       repl_type = oid_object_info(the_repository, oid, NULL);
 
                        printf("%s (%s) -> %s (%s)\n", refname, type_name(obj_type),
                               oid_to_hex(oid), type_name(repl_type));
 
                        printf("%s (%s) -> %s (%s)\n", refname, type_name(obj_type),
                               oid_to_hex(oid), type_name(repl_type));
@@ -164,8 +165,8 @@ static int replace_object_oid(const char *object_ref,
        struct ref_transaction *transaction;
        struct strbuf err = STRBUF_INIT;
 
        struct ref_transaction *transaction;
        struct strbuf err = STRBUF_INIT;
 
-       obj_type = oid_object_info(object, NULL);
-       repl_type = oid_object_info(repl, NULL);
+       obj_type = oid_object_info(the_repository, object, NULL);
+       repl_type = oid_object_info(the_repository, repl, NULL);
        if (!force && obj_type != repl_type)
                die("Objects must be of the same type.\n"
                    "'%s' points to a replaced object of type '%s'\n"
        if (!force && obj_type != repl_type)
                die("Objects must be of the same type.\n"
                    "'%s' points to a replaced object of type '%s'\n"
@@ -292,7 +293,7 @@ static int edit_and_replace(const char *object_ref, int force, int raw)
        if (get_oid(object_ref, &old_oid) < 0)
                die("Not a valid object name: '%s'", object_ref);
 
        if (get_oid(object_ref, &old_oid) < 0)
                die("Not a valid object name: '%s'", object_ref);
 
-       type = oid_object_info(&old_oid, NULL);
+       type = oid_object_info(the_repository, &old_oid, NULL);
        if (type < 0)
                die("unable to get object type for %s", oid_to_hex(&old_oid));
 
        if (type < 0)
                die("unable to get object type for %s", oid_to_hex(&old_oid));
 
index 8cff6d0b727a572a34adcfe72246953b93c79edd..26d7729f57b73a36b0345141b072b840a34e0722 100644 (file)
@@ -212,7 +212,7 @@ static void create_tag(const struct object_id *object, const char *tag,
        struct strbuf header = STRBUF_INIT;
        char *path = NULL;
 
        struct strbuf header = STRBUF_INIT;
        char *path = NULL;
 
-       type = oid_object_info(object, NULL);
+       type = oid_object_info(the_repository, object, NULL);
        if (type <= OBJ_NONE)
            die(_("bad object type."));
 
        if (type <= OBJ_NONE)
            die(_("bad object type."));
 
@@ -298,7 +298,7 @@ static void create_reflog_msg(const struct object_id *oid, struct strbuf *sb)
        }
 
        strbuf_addstr(sb, " (");
        }
 
        strbuf_addstr(sb, " (");
-       type = oid_object_info(oid, NULL);
+       type = oid_object_info(the_repository, oid, NULL);
        switch (type) {
        default:
                strbuf_addstr(sb, "object of unknown type");
        switch (type) {
        default:
                strbuf_addstr(sb, "object of unknown type");
index b7755c6cc5a05a536666d0ae2fd9d0c3171a6cfd..cfe9019f800ad0bd331e31a20a8b7a240dc3fde1 100644 (file)
@@ -199,7 +199,7 @@ static int check_object(struct object *obj, int type, void *data, struct fsck_op
 
        if (!(obj->flags & FLAG_OPEN)) {
                unsigned long size;
 
        if (!(obj->flags & FLAG_OPEN)) {
                unsigned long size;
-               int type = oid_object_info(&obj->oid, &size);
+               int type = oid_object_info(the_repository, &obj->oid, &size);
                if (type != obj->type || type <= 0)
                        die("object of unexpected type");
                obj->flags |= FLAG_WRITTEN;
                if (type != obj->type || type <= 0)
                        die("object of unexpected type");
                obj->flags |= FLAG_WRITTEN;
diff --git a/cache.h b/cache.h
index 588c4fff9a509da0c7aa3b4d68d5183e251423fd..6340b2c5720c0b7a8f8e2e4d6980dde8ebc26bf7 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -1192,7 +1192,8 @@ static inline void *read_object_file(const struct object_id *oid, enum object_ty
 }
 
 /* Read and unpack an object file into memory, write memory to an object file */
 }
 
 /* Read and unpack an object file into memory, write memory to an object file */
-extern int oid_object_info(const struct object_id *, unsigned long *);
+#define oid_object_info(r, o, f) oid_object_info_##r(o, f)
+int oid_object_info_the_repository(const struct object_id *, unsigned long *);
 
 extern int hash_object_file(const void *buf, unsigned long len,
                            const char *type, struct object_id *oid);
 
 extern int hash_object_file(const void *buf, unsigned long len,
                            const char *type, struct object_id *oid);
diff --git a/diff.c b/diff.c
index 1289df4b1f9f395010e475073c2c5e5ce43976a7..4753170fe1296c87579db3376aa5a625b0042f19 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -3638,7 +3638,8 @@ int diff_populate_filespec(struct diff_filespec *s, unsigned int flags)
        else {
                enum object_type type;
                if (size_only || (flags & CHECK_BINARY)) {
        else {
                enum object_type type;
                if (size_only || (flags & CHECK_BINARY)) {
-                       type = oid_object_info(&s->oid, &s->size);
+                       type = oid_object_info(the_repository, &s->oid,
+                                              &s->size);
                        if (type < 0)
                                die("unable to read %s",
                                    oid_to_hex(&s->oid));
                        if (type < 0)
                                die("unable to read %s",
                                    oid_to_hex(&s->oid));
index 99f8f56e8c4fbd20b6e6186e26d89eda1baff0d0..afe06bd7c18b06be95e4eda63ad1b7f5a7d96aa7 100644 (file)
@@ -1917,7 +1917,8 @@ static void read_marks(void)
                        die("corrupt mark line: %s", line);
                e = find_object(&oid);
                if (!e) {
                        die("corrupt mark line: %s", line);
                e = find_object(&oid);
                if (!e) {
-                       enum object_type type = oid_object_info(&oid, NULL);
+                       enum object_type type = oid_object_info(the_repository,
+                                                               &oid, NULL);
                        if (type < 0)
                                die("object not found: %s", oid_to_hex(&oid));
                        e = insert_object(&oid);
                        if (type < 0)
                                die("object not found: %s", oid_to_hex(&oid));
                        e = insert_object(&oid);
@@ -2447,7 +2448,8 @@ static void file_change_m(const char *p, struct branch *b)
                enum object_type expected = S_ISDIR(mode) ?
                                                OBJ_TREE: OBJ_BLOB;
                enum object_type type = oe ? oe->type :
                enum object_type expected = S_ISDIR(mode) ?
                                                OBJ_TREE: OBJ_BLOB;
                enum object_type type = oe ? oe->type :
-                                       oid_object_info(&oid, NULL);
+                                       oid_object_info(the_repository, &oid,
+                                                       NULL);
                if (type < 0)
                        die("%s not found: %s",
                                        S_ISDIR(mode) ?  "Tree" : "Blob",
                if (type < 0)
                        die("%s not found: %s",
                                        S_ISDIR(mode) ?  "Tree" : "Blob",
@@ -2608,7 +2610,8 @@ static void note_change_n(const char *p, struct branch *b, unsigned char *old_fa
                        die("Not a blob (actually a %s): %s",
                                type_name(oe->type), command_buf.buf);
        } else if (!is_null_oid(&oid)) {
                        die("Not a blob (actually a %s): %s",
                                type_name(oe->type), command_buf.buf);
        } else if (!is_null_oid(&oid)) {
-               enum object_type type = oid_object_info(&oid, NULL);
+               enum object_type type = oid_object_info(the_repository, &oid,
+                                                       NULL);
                if (type < 0)
                        die("Blob not found: %s", command_buf.buf);
                if (type != OBJ_BLOB)
                if (type < 0)
                        die("Blob not found: %s", command_buf.buf);
                if (type != OBJ_BLOB)
@@ -2895,7 +2898,7 @@ static void parse_new_tag(const char *arg)
        } else if (!get_oid(from, &oid)) {
                struct object_entry *oe = find_object(&oid);
                if (!oe) {
        } else if (!get_oid(from, &oid)) {
                struct object_entry *oe = find_object(&oid);
                if (!oe) {
-                       type = oid_object_info(&oid, NULL);
+                       type = oid_object_info(the_repository, &oid, NULL);
                        if (type < 0)
                                die("Not a valid object: %s", from);
                } else
                        if (type < 0)
                                die("Not a valid object: %s", from);
                } else
@@ -3053,7 +3056,8 @@ static struct object_entry *dereference(struct object_entry *oe,
        unsigned long size;
        char *buf = NULL;
        if (!oe) {
        unsigned long size;
        char *buf = NULL;
        if (!oe) {
-               enum object_type type = oid_object_info(oid, NULL);
+               enum object_type type = oid_object_info(the_repository, oid,
+                                                       NULL);
                if (type < 0)
                        die("object not found: %s", oid_to_hex(oid));
                /* cache it! */
                if (type < 0)
                        die("object not found: %s", oid_to_hex(oid));
                /* cache it! */
index 0ec83aaf1888903be4f1de38c8a94a594ef2130a..ea94fe8af28d00763f57483e9d8a53dd6197105f 100644 (file)
@@ -117,7 +117,7 @@ static enum list_objects_filter_result filter_blobs_limit(
                assert(obj->type == OBJ_BLOB);
                assert((obj->flags & SEEN) == 0);
 
                assert(obj->type == OBJ_BLOB);
                assert((obj->flags & SEEN) == 0);
 
-               t = oid_object_info(&obj->oid, &object_length);
+               t = oid_object_info(the_repository, &obj->oid, &object_length);
                if (t != OBJ_BLOB) { /* probably OBJ_NONE */
                        /*
                         * We DO NOT have the blob locally, so we cannot
                if (t != OBJ_BLOB) { /* probably OBJ_NONE */
                        /*
                         * We DO NOT have the blob locally, so we cannot
index 66cffaf6e516f181fa391ddab125fdc16cc71cb5..5044d08e96c287b722fcf300dfdf960fe27d2442 100644 (file)
--- a/object.c
+++ b/object.c
@@ -257,7 +257,7 @@ struct object *parse_object(const struct object_id *oid)
 
        if ((obj && obj->type == OBJ_BLOB && has_object_file(oid)) ||
            (!obj && has_object_file(oid) &&
 
        if ((obj && obj->type == OBJ_BLOB && has_object_file(oid)) ||
            (!obj && has_object_file(oid) &&
-            oid_object_info(oid, NULL) == OBJ_BLOB)) {
+            oid_object_info(the_repository, oid, NULL) == OBJ_BLOB)) {
                if (check_object_signature(repl, NULL, 0, NULL) < 0) {
                        error("sha1 mismatch %s", oid_to_hex(oid));
                        return NULL;
                if (check_object_signature(repl, NULL, 0, NULL) < 0) {
                        error("sha1 mismatch %s", oid_to_hex(oid));
                        return NULL;
index 41ae27fb19a94a4c44058d8850a9592c41b82f90..cd1903e717a141a0e8e695dd6750092af27120fe 100644 (file)
@@ -73,7 +73,8 @@ void bitmap_writer_build_type_index(struct pack_idx_entry **index,
                        break;
 
                default:
                        break;
 
                default:
-                       real_type = oid_object_info(&entry->idx.oid, NULL);
+                       real_type = oid_object_info(the_repository,
+                                                   &entry->idx.oid, NULL);
                        break;
                }
 
                        break;
                }
 
index d9914ba7232a0c6c82a09cf0272bffebc8e807f5..80c7fa734f896f22c3b39e28c7e28caf5222fb0c 100644 (file)
@@ -1114,7 +1114,7 @@ static int retry_bad_packed_offset(struct packed_git *p, off_t obj_offset)
                return OBJ_BAD;
        nth_packed_object_oid(&oid, p, revidx->nr);
        mark_bad_packed_object(p, oid.hash);
                return OBJ_BAD;
        nth_packed_object_oid(&oid, p, revidx->nr);
        mark_bad_packed_object(p, oid.hash);
-       type = oid_object_info(&oid, NULL);
+       type = oid_object_info(the_repository, &oid, NULL);
        if (type <= OBJ_NONE)
                return OBJ_BAD;
        return type;
        if (type <= OBJ_NONE)
                return OBJ_BAD;
        return type;
index a6ea33a5db8b616420572cda4b857ac6d7d43cb1..ffb976c33c6936a7b178c7c478bcf4cd2840d472 100644 (file)
@@ -78,7 +78,7 @@ static void add_recent_object(const struct object_id *oid,
         * later processing, and the revision machinery expects
         * commits and tags to have been parsed.
         */
         * later processing, and the revision machinery expects
         * commits and tags to have been parsed.
         */
-       type = oid_object_info(oid, NULL);
+       type = oid_object_info(the_repository, oid, NULL);
        if (type < 0)
                die("unable to get object info for %s", oid_to_hex(oid));
 
        if (type < 0)
                die("unable to get object info for %s", oid_to_hex(oid));
 
diff --git a/refs.c b/refs.c
index 9b56fa9b819fa404bf0528aeb9d84de1cf618ec7..27c88ba7689f781c79f2026aabca00395637b27e 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -302,7 +302,7 @@ enum peel_status peel_object(const struct object_id *name, struct object_id *oid
        struct object *o = lookup_unknown_object(name->hash);
 
        if (o->type == OBJ_NONE) {
        struct object *o = lookup_unknown_object(name->hash);
 
        if (o->type == OBJ_NONE) {
-               int type = oid_object_info(name, NULL);
+               int type = oid_object_info(the_repository, name, NULL);
                if (type < 0 || !object_as_type(o, type, 0))
                        return PEEL_INVALID;
        }
                if (type < 0 || !object_as_type(o, type, 0))
                        return PEEL_INVALID;
        }
index 91eb010ca983c5493bbc17c5652ef31060390226..481bf933f390af28d7ef46b33a53b04d0f000be1 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -1376,7 +1376,7 @@ static void add_missing_tags(struct ref *src, struct ref **dst, struct ref ***ds
                        continue; /* not a tag */
                if (string_list_has_string(&dst_tag, ref->name))
                        continue; /* they already have it */
                        continue; /* not a tag */
                if (string_list_has_string(&dst_tag, ref->name))
                        continue; /* they already have it */
-               if (oid_object_info(&ref->new_oid, NULL) != OBJ_TAG)
+               if (oid_object_info(the_repository, &ref->new_oid, NULL) != OBJ_TAG)
                        continue; /* be conservative */
                item = string_list_append(&src_tag, ref->name);
                item->util = ref;
                        continue; /* be conservative */
                item = string_list_append(&src_tag, ref->name);
                item->util = ref;
index 667f35ebdffbc1ef730e310cbea9b3dbce786e21..44f0518b9c4d5d11dcab3a2177015837c1cdab1c 100644 (file)
@@ -2876,7 +2876,8 @@ int sequencer_pick_revisions(struct replay_opts *opts)
 
                if (!get_oid(name, &oid)) {
                        if (!lookup_commit_reference_gently(&oid, 1)) {
 
                if (!get_oid(name, &oid)) {
                        if (!lookup_commit_reference_gently(&oid, 1)) {
-                               enum object_type type = oid_object_info(&oid,
+                               enum object_type type = oid_object_info(the_repository,
+                                                                       &oid,
                                                                        NULL);
                                return error(_("%s: can't cherry-pick a %s"),
                                        name, type_name(type));
                                                                        NULL);
                                return error(_("%s: can't cherry-pick a %s"),
                                        name, type_name(type));
index 50a2dc5f0a5c36f944e62026561c680390fe0776..93f25c6c6a40d7bb7735ccc184ae3305697938cf 100644 (file)
@@ -1322,7 +1322,7 @@ int oid_object_info_extended_the_repository(const struct object_id *oid, struct
 }
 
 /* returns enum object_type or negative */
 }
 
 /* returns enum object_type or negative */
-int oid_object_info(const struct object_id *oid, unsigned long *sizep)
+int oid_object_info_the_repository(const struct object_id *oid, unsigned long *sizep)
 {
        enum object_type type;
        struct object_info oi = OBJECT_INFO_INIT;
 {
        enum object_type type;
        struct object_info oi = OBJECT_INFO_INIT;
@@ -1988,7 +1988,7 @@ int read_pack_header(int fd, struct pack_header *header)
 
 void assert_oid_type(const struct object_id *oid, enum object_type expect)
 {
 
 void assert_oid_type(const struct object_id *oid, enum object_type expect)
 {
-       enum object_type type = oid_object_info(oid, NULL);
+       enum object_type type = oid_object_info(the_repository, oid, NULL);
        if (type < 0)
                die("%s is not a valid object", oid_to_hex(oid));
        if (type != expect)
        if (type < 0)
                die("%s is not a valid object", oid_to_hex(oid));
        if (type != expect)
index 5b93bf8da36939376b506f96624f568875397969..b5406b6eb21f9b60f313798f7bfccafb64422554 100644 (file)
@@ -223,7 +223,7 @@ static int finish_object_disambiguation(struct disambiguate_state *ds,
 
 static int disambiguate_commit_only(const struct object_id *oid, void *cb_data_unused)
 {
 
 static int disambiguate_commit_only(const struct object_id *oid, void *cb_data_unused)
 {
-       int kind = oid_object_info(oid, NULL);
+       int kind = oid_object_info(the_repository, oid, NULL);
        return kind == OBJ_COMMIT;
 }
 
        return kind == OBJ_COMMIT;
 }
 
@@ -232,7 +232,7 @@ static int disambiguate_committish_only(const struct object_id *oid, void *cb_da
        struct object *obj;
        int kind;
 
        struct object *obj;
        int kind;
 
-       kind = oid_object_info(oid, NULL);
+       kind = oid_object_info(the_repository, oid, NULL);
        if (kind == OBJ_COMMIT)
                return 1;
        if (kind != OBJ_TAG)
        if (kind == OBJ_COMMIT)
                return 1;
        if (kind != OBJ_TAG)
@@ -247,7 +247,7 @@ static int disambiguate_committish_only(const struct object_id *oid, void *cb_da
 
 static int disambiguate_tree_only(const struct object_id *oid, void *cb_data_unused)
 {
 
 static int disambiguate_tree_only(const struct object_id *oid, void *cb_data_unused)
 {
-       int kind = oid_object_info(oid, NULL);
+       int kind = oid_object_info(the_repository, oid, NULL);
        return kind == OBJ_TREE;
 }
 
        return kind == OBJ_TREE;
 }
 
@@ -256,7 +256,7 @@ static int disambiguate_treeish_only(const struct object_id *oid, void *cb_data_
        struct object *obj;
        int kind;
 
        struct object *obj;
        int kind;
 
-       kind = oid_object_info(oid, NULL);
+       kind = oid_object_info(the_repository, oid, NULL);
        if (kind == OBJ_TREE || kind == OBJ_COMMIT)
                return 1;
        if (kind != OBJ_TAG)
        if (kind == OBJ_TREE || kind == OBJ_COMMIT)
                return 1;
        if (kind != OBJ_TAG)
@@ -271,7 +271,7 @@ static int disambiguate_treeish_only(const struct object_id *oid, void *cb_data_
 
 static int disambiguate_blob_only(const struct object_id *oid, void *cb_data_unused)
 {
 
 static int disambiguate_blob_only(const struct object_id *oid, void *cb_data_unused)
 {
-       int kind = oid_object_info(oid, NULL);
+       int kind = oid_object_info(the_repository, oid, NULL);
        return kind == OBJ_BLOB;
 }
 
        return kind == OBJ_BLOB;
 }
 
@@ -350,7 +350,7 @@ static int show_ambiguous_object(const struct object_id *oid, void *data)
        if (ds->fn && !ds->fn(oid, ds->cb_data))
                return 0;
 
        if (ds->fn && !ds->fn(oid, ds->cb_data))
                return 0;
 
-       type = oid_object_info(oid, NULL);
+       type = oid_object_info(the_repository, oid, NULL);
        if (type == OBJ_COMMIT) {
                struct commit *commit = lookup_commit(oid);
                if (commit) {
        if (type == OBJ_COMMIT) {
                struct commit *commit = lookup_commit(oid);
                if (commit) {
index 9a50168b2375d9cac306a22c8be4559dde114d95..bb133e9b932dea4d151afc40eaea0bd6bfed56e2 100644 (file)
@@ -818,7 +818,7 @@ static int check_has_commit(const struct object_id *oid, void *data)
 {
        struct has_commit_data *cb = data;
 
 {
        struct has_commit_data *cb = data;
 
-       enum object_type type = oid_object_info(oid, NULL);
+       enum object_type type = oid_object_info(the_repository, oid, NULL);
 
        switch (type) {
        case OBJ_COMMIT:
 
        switch (type) {
        case OBJ_COMMIT:
diff --git a/tag.c b/tag.c
index 86b1dcbb8270e944ac643a39835d490bbaf35b20..3d37c1bd251c5f8c5eb06ede72ab57b323888709 100644 (file)
--- a/tag.c
+++ b/tag.c
@@ -41,7 +41,7 @@ int gpg_verify_tag(const struct object_id *oid, const char *name_to_report,
        unsigned long size;
        int ret;
 
        unsigned long size;
        int ret;
 
-       type = oid_object_info(oid, NULL);
+       type = oid_object_info(the_repository, oid, NULL);
        if (type != OBJ_TAG)
                return error("%s: cannot verify a non-tag object of type %s.",
                                name_to_report ?
        if (type != OBJ_TAG)
                return error("%s: cannot verify a non-tag object of type %s.",
                                name_to_report ?