Skip to content

Commit 902f358

Browse files
committed
Merge branch 'rs/clear-commit-marks-in-repo'
Code clean-up. * rs/clear-commit-marks-in-repo: bisect: clear flags in passed repository object: allow clear_commit_marks_all to handle any repo
2 parents c5a802f + 0795df4 commit 902f358

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(r, 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
@@ -1042,7 +1042,7 @@ static void orphaned_commit_warning(struct commit *old_commit, struct commit *ne
10421042
describe_detached_head(_("Previous HEAD position was"), old_commit);
10431043

10441044
/* Clean up objects used, as they will be reused. */
1045-
clear_commit_marks_all(ALL_REV_FLAGS);
1045+
repo_clear_commit_marks(the_repository, ALL_REV_FLAGS);
10461046
}
10471047

10481048
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
@@ -794,7 +794,7 @@ static int should_write_commit_graph(void)
794794

795795
result = for_each_ref(dfs_on_ref, &data);
796796

797-
clear_commit_marks_all(SEEN);
797+
repo_clear_commit_marks(the_repository, SEEN);
798798

799799
return result;
800800
}

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)