diff options
author | Stefan Beller <sbeller@google.com> | 2018-04-25 21:21:06 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-04-26 04:54:28 +0300 |
commit | 9d98354f48997faf8251c566d909957f6ae427d5 (patch) | |
tree | db9184ba03360fb7ccf302ad8de009f1027175aa /cache.h | |
parent | 589de911852cc3ce689fa3702ecb54c0049aeec1 (diff) |
cache.h: allow oid_object_info to handle arbitrary repositories
This involves also adapting oid_object_info_extended and a some
internal functions that are used to implement these. It all has to
happen in one patch, because of a single recursive chain of calls visits
all these functions.
oid_object_info_extended is also used in partial clones, which allow
fetching missing objects. As this series will not add the repository
struct to the transport code and fetch_object(), add a TODO note and
omit fetching if a user tries to use a partial clone in a repository
other than the_repository.
Among the functions modified to handle arbitrary repositories,
unpack_entry() is one of them. Note that it still references the globals
"delta_base_cache" and "delta_base_cached", but those are safe to be
referenced (the former is indexed partly by "struct packed_git *", which
is repo-specific, and the latter is only used to limit the size of the
former as an optimization).
Helped-by: Brandon Williams <bmwill@google.com>
Helped-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r-- | cache.h | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -1192,8 +1192,7 @@ 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 */ -#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 *); +int oid_object_info(struct repository *r, const struct object_id *, unsigned long *); extern int hash_object_file(const void *buf, unsigned long len, const char *type, struct object_id *oid); @@ -1675,9 +1674,9 @@ struct object_info { /* Do not check loose object */ #define OBJECT_INFO_IGNORE_LOOSE 16 -#define oid_object_info_extended(r, oid, oi, flags) \ - oid_object_info_extended_##r(oid, oi, flags) -int oid_object_info_extended_the_repository(const struct object_id *, struct object_info *, unsigned flags); +int oid_object_info_extended(struct repository *r, + const struct object_id *, + struct object_info *, unsigned flags); /* * Set this to 0 to prevent sha1_object_info_extended() from fetching missing |