Skip to content

Commit cd88884

Browse files
rscharfegitster
authored andcommitted
object: allow clear_commit_marks_all to handle any repo
Allow callers to specify the repository to use. Rename the function to repo_clear_commit_marks to document its new scope. No functional change intended. Signed-off-by: René Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 69986e1 commit cd88884

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

bisect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
10901090
nr), nr, steps_msg);
10911091
free(steps_msg);
10921092
/* Clean up objects used, as they will be reused. */
1093-
clear_commit_marks_all(ALL_REV_FLAGS);
1093+
repo_clear_commit_marks(the_repository, ALL_REV_FLAGS);
10941094

10951095
return bisect_checkout(bisect_rev, no_checkout);
10961096
}

builtin/checkout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ static void orphaned_commit_warning(struct commit *old_commit, struct commit *ne
10291029
describe_detached_head(_("Previous HEAD position was"), old_commit);
10301030

10311031
/* Clean up objects used, as they will be reused. */
1032-
clear_commit_marks_all(ALL_REV_FLAGS);
1032+
repo_clear_commit_marks(the_repository, ALL_REV_FLAGS);
10331033
}
10341034

10351035
static int switch_branches(const struct checkout_opts *opts,

builtin/gc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ static int should_write_commit_graph(void)
786786

787787
result = for_each_ref(dfs_on_ref, &data);
788788

789-
clear_commit_marks_all(SEEN);
789+
repo_clear_commit_marks(the_repository, SEEN);
790790

791791
return result;
792792
}

object.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,12 +453,12 @@ void clear_object_flags(unsigned flags)
453453
}
454454
}
455455

456-
void clear_commit_marks_all(unsigned int flags)
456+
void repo_clear_commit_marks(struct repository *r, unsigned int flags)
457457
{
458458
int i;
459459

460-
for (i = 0; i < the_repository->parsed_objects->obj_hash_size; i++) {
461-
struct object *obj = the_repository->parsed_objects->obj_hash[i];
460+
for (i = 0; i < r->parsed_objects->obj_hash_size; i++) {
461+
struct object *obj = r->parsed_objects->obj_hash[i];
462462
if (obj && obj->type == OBJ_COMMIT)
463463
obj->flags &= ~flags;
464464
}

object.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,9 @@ void object_array_clear(struct object_array *array);
191191
void clear_object_flags(unsigned flags);
192192

193193
/*
194-
* Clear the specified object flags from all in-core commit objects.
194+
* Clear the specified object flags from all in-core commit objects from
195+
* the specified repository.
195196
*/
196-
void clear_commit_marks_all(unsigned int flags);
197+
void repo_clear_commit_marks(struct repository *r, unsigned int flags);
197198

198199
#endif /* OBJECT_H */

0 commit comments

Comments
 (0)