summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-04-15 13:50:14 -0700
committerJunio C Hamano <gitster@pobox.com>2025-04-15 13:50:15 -0700
commitee847e0034dbfde11f901fbfb74d210c1edad496 (patch)
tree3baa54bf940d7f0506b9160127fcc2b88ad4764b /object.c
parentf3f00d93a10ac3f000c56e73d646e34fe7b456d1 (diff)
parent7d70b29c4f0b2fd3c6698956d9fb4026632d9c6e (diff)
Merge branch 'ps/object-wo-the-repository'
The object layer has been updated to take an explicit repository instance as a parameter in more code paths. * ps/object-wo-the-repository: hash: stop depending on `the_repository` in `null_oid()` hash: fix "-Wsign-compare" warnings object-file: split out logic regarding hash algorithms delta-islands: stop depending on `the_repository` object-file-convert: stop depending on `the_repository` pack-bitmap-write: stop depending on `the_repository` pack-revindex: stop depending on `the_repository` pack-check: stop depending on `the_repository` environment: move access to "core.bigFileThreshold" into repo settings pack-write: stop depending on `the_repository` and `the_hash_algo` object: stop depending on `the_repository` csum-file: stop depending on `the_repository`
Diffstat (limited to 'object.c')
-rw-r--r--object.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/object.c b/object.c
index 100bf9b8d1..154525a497 100644
--- a/object.c
+++ b/object.c
@@ -1,4 +1,3 @@
-#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
@@ -18,14 +17,15 @@
#include "commit-graph.h"
#include "loose.h"
-unsigned int get_max_object_index(void)
+unsigned int get_max_object_index(const struct repository *repo)
{
- return the_repository->parsed_objects->obj_hash_size;
+ return repo->parsed_objects->obj_hash_size;
}
-struct object *get_indexed_object(unsigned int idx)
+struct object *get_indexed_object(const struct repository *repo,
+ unsigned int idx)
{
- return the_repository->parsed_objects->obj_hash[idx];
+ return repo->parsed_objects->obj_hash[idx];
}
static const char *object_type_strings[] = {
@@ -283,10 +283,11 @@ struct object *parse_object_buffer(struct repository *r, const struct object_id
return obj;
}
-struct object *parse_object_or_die(const struct object_id *oid,
+struct object *parse_object_or_die(struct repository *repo,
+ const struct object_id *oid,
const char *name)
{
- struct object *o = parse_object(the_repository, oid);
+ struct object *o = parse_object(repo, oid);
if (o)
return o;
@@ -524,12 +525,12 @@ void object_array_remove_duplicates(struct object_array *array)
}
}
-void clear_object_flags(unsigned flags)
+void clear_object_flags(struct repository *repo, unsigned flags)
{
int i;
- for (i=0; i < the_repository->parsed_objects->obj_hash_size; i++) {
- struct object *obj = the_repository->parsed_objects->obj_hash[i];
+ for (i=0; i < repo->parsed_objects->obj_hash_size; i++) {
+ struct object *obj = repo->parsed_objects->obj_hash[i];
if (obj)
obj->flags &= ~flags;
}