mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
odb: get rid of the_repository in for_each() functions
There are a couple of iterator-style functions that execute a callback for each instance of a given set, all of which currently depend on `the_repository`. Refactor them to instead take an object database as parameter so that we can get rid of this dependency. Rename the functions accordingly. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
c44185f6c1
commit
798c661ce3
23
odb.h
23
odb.h
@@ -73,11 +73,6 @@ struct odb_source {
|
||||
char *path;
|
||||
};
|
||||
|
||||
typedef int alt_odb_fn(struct odb_source *, void *);
|
||||
int foreach_alt_odb(alt_odb_fn, void*);
|
||||
typedef void alternate_ref_fn(const struct object_id *oid, void *);
|
||||
void for_each_alternate_ref(alternate_ref_fn, void *);
|
||||
|
||||
/*
|
||||
* Replace the current writable object directory with the specified temporary
|
||||
* object directory; returns the former primary object directory.
|
||||
@@ -192,6 +187,24 @@ void odb_clear(struct object_database *o);
|
||||
*/
|
||||
struct odb_source *odb_find_source(struct object_database *odb, const char *obj_dir);
|
||||
|
||||
/*
|
||||
* Iterate through all alternates of the database and execute the provided
|
||||
* callback function for each of them. Stop iterating once the callback
|
||||
* function returns a non-zero value, in which case the value is bubbled up
|
||||
* from the callback.
|
||||
*/
|
||||
typedef int odb_for_each_alternate_fn(struct odb_source *, void *);
|
||||
int odb_for_each_alternate(struct object_database *odb,
|
||||
odb_for_each_alternate_fn cb, void *payload);
|
||||
|
||||
/*
|
||||
* Iterate through all alternates of the database and yield their respective
|
||||
* references.
|
||||
*/
|
||||
typedef void odb_for_each_alternate_ref_fn(const struct object_id *oid, void *);
|
||||
void odb_for_each_alternate_ref(struct object_database *odb,
|
||||
odb_for_each_alternate_ref_fn cb, void *payload);
|
||||
|
||||
/*
|
||||
* Create a temporary file rooted in the primary alternate's directory, or die
|
||||
* on failure. The filename is taken from "pattern", which should have the
|
||||
|
||||
Reference in New Issue
Block a user