object: stop depending on the_repository
There are a couple of functions exposed by "object.c" that implicitly depend on `the_repository`. Remove this dependency by injecting the repository via a parameter. Adapt callers accordingly by simply using `the_repository`, except in cases where the subsystem is already free of the repository. In that case, we instead pass the repository provided by the caller's context. 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
228457c9d9
commit
74d414c9f1
10
shallow.c
10
shallow.c
@@ -226,7 +226,7 @@ struct commit_list *get_shallow_commits_by_rev_list(int ac, const char **av,
|
||||
* SHALLOW (excluded) and NOT_SHALLOW (included) should not be
|
||||
* set at this point. But better be safe than sorry.
|
||||
*/
|
||||
clear_object_flags(both_flags);
|
||||
clear_object_flags(the_repository, both_flags);
|
||||
|
||||
is_repository_shallow(the_repository); /* make sure shallows are read */
|
||||
|
||||
@@ -613,9 +613,9 @@ static void paint_down(struct paint_info *info, const struct object_id *oid,
|
||||
}
|
||||
}
|
||||
|
||||
nr = get_max_object_index();
|
||||
nr = get_max_object_index(the_repository);
|
||||
for (i = 0; i < nr; i++) {
|
||||
struct object *o = get_indexed_object(i);
|
||||
struct object *o = get_indexed_object(the_repository, i);
|
||||
if (o && o->type == OBJ_COMMIT)
|
||||
o->flags &= ~SEEN;
|
||||
}
|
||||
@@ -675,9 +675,9 @@ void assign_shallow_commits_to_refs(struct shallow_info *info,
|
||||
* Prepare the commit graph to track what refs can reach what
|
||||
* (new) shallow commits.
|
||||
*/
|
||||
nr = get_max_object_index();
|
||||
nr = get_max_object_index(the_repository);
|
||||
for (i = 0; i < nr; i++) {
|
||||
struct object *o = get_indexed_object(i);
|
||||
struct object *o = get_indexed_object(the_repository, i);
|
||||
if (!o || o->type != OBJ_COMMIT)
|
||||
continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user