diff options
Diffstat (limited to 'object-file.c')
-rw-r--r-- | object-file.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/object-file.c b/object-file.c index 939865c1ae..7c1af5c8db 100644 --- a/object-file.c +++ b/object-file.c @@ -6,8 +6,14 @@ * This handles basic git object files - packing, unpacking, * creation etc. */ -#include "cache.h" +#include "git-compat-util.h" +#include "abspath.h" +#include "alloc.h" #include "config.h" +#include "convert.h" +#include "environment.h" +#include "gettext.h" +#include "hex.h" #include "string-list.h" #include "lockfile.h" #include "delta.h" @@ -30,10 +36,14 @@ #include "mergesort.h" #include "quote.h" #include "packfile.h" +#include "object-file.h" #include "object-store.h" +#include "oidtree.h" #include "promisor-remote.h" +#include "setup.h" #include "submodule.h" #include "fsck.h" +#include "wrapper.h" /* The maximum size for an object header. */ #define MAX_HEADER_LEN 32 @@ -267,7 +277,7 @@ int hash_algo_by_length(int len) /* * This is meant to hold a *small* number of objects that you would - * want read_object_file() to be able to return, but yet you do not want + * want repo_read_object_file() to be able to return, but yet you do not want * to write them into the object store (e.g. a browse-only * application). */ @@ -944,6 +954,12 @@ void prepare_alt_odb(struct repository *r) r->objects->loaded_alternates = 1; } +int has_alt_odb(struct repository *r) +{ + prepare_alt_odb(r); + return !!r->objects->odb->next; +} + /* Returns 1 if we have successfully freshened the file, 0 otherwise. */ static int freshen_file(const char *fn) { @@ -1678,7 +1694,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); @@ -2644,7 +2660,8 @@ int for_each_loose_object(each_loose_object_fn cb, void *data, return 0; } -static int append_loose_object(const struct object_id *oid, const char *path, +static int append_loose_object(const struct object_id *oid, + const char *path UNUSED, void *data) { oidtree_insert(data, oid); |