summaryrefslogtreecommitdiff
path: root/object-store.h
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2018-11-14 00:12:47 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-11-14 08:22:40 (GMT)
commitafd69dcc21972d766211ac253af2c18384e93056 (patch)
tree7ead2fbeba246f9c50a191d1797dcad11ca33eb4 /object-store.h
parenta3b72c89bdd10f8b22d7dae382f0ce9833e5d179 (diff)
downloadgit-afd69dcc21972d766211ac253af2c18384e93056.zip
git-afd69dcc21972d766211ac253af2c18384e93056.tar.gz
git-afd69dcc21972d766211ac253af2c18384e93056.tar.bz2
object-store: prepare read_object_file to deal with any repo
As read_object_file is a widely used function (which is also regularly used in new code in flight between master..pu), changing its signature is painful is hard, as other series in flight rely on the original signature. It would burden the maintainer if we'd just change the signature. Introduce repo_read_object_file which takes the repository argument, and hide the original read_object_file as a macro behind NO_THE_REPOSITORY_COMPATIBILITY_MACROS, similar to e675765235 (diff.c: remove implicit dependency on the_index, 2018-09-21) Add a coccinelle patch to convert existing callers, but do not apply the resulting patch to keep the diff of this patch small. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'object-store.h')
-rw-r--r--object-store.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/object-store.h b/object-store.h
index 3d98a68..00a6462 100644
--- a/object-store.h
+++ b/object-store.h
@@ -165,10 +165,16 @@ extern void *read_object_file_extended(struct repository *r,
const struct object_id *oid,
enum object_type *type,
unsigned long *size, int lookup_replace);
-static inline void *read_object_file(const struct object_id *oid, enum object_type *type, unsigned long *size)
+static inline void *repo_read_object_file(struct repository *r,
+ const struct object_id *oid,
+ enum object_type *type,
+ unsigned long *size)
{
- return read_object_file_extended(the_repository, oid, type, size, 1);
+ return read_object_file_extended(r, oid, type, size, 1);
}
+#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 *);