Skip to content

Commit

Permalink
object.c: clear_commit_marks_all() accept 'r' as parameter
Browse files Browse the repository at this point in the history
'clear_commit_marks_all()' and its callers are modified to enable
passing 'r' as an argument to 'clear_commit_marks_all()'.

Signed-off-by: Parth Gala <[email protected]>
  • Loading branch information
ParthGala2k committed Feb 7, 2020
1 parent a8202cc commit 746d9ff
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion builtin/checkout.c
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,7 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)
static void orphaned_commit_warning(struct commit *old_commit, struct commit *new_commit)
{
struct rev_info revs;
struct repository *r = the_repository;
struct object *object = &old_commit->object;

repo_init_revisions(the_repository, &revs, NULL);
Expand All @@ -1011,7 +1012,7 @@ static void orphaned_commit_warning(struct commit *old_commit, struct commit *ne
describe_detached_head(_("Previous HEAD position was"), old_commit);

/* Clean up objects used, as they will be reused. */
clear_commit_marks_all(ALL_REV_FLAGS);
clear_commit_marks_all(r, ALL_REV_FLAGS);
}

static int switch_branches(const struct checkout_opts *opts,
Expand Down
6 changes: 3 additions & 3 deletions object.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,12 +443,12 @@ void clear_object_flags(struct repository *r, unsigned flags)
}
}

void clear_commit_marks_all(unsigned int flags)
void clear_commit_marks_all(struct repository *r, unsigned int 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 < r->parsed_objects->obj_hash_size; i++) {
struct object *obj = r->parsed_objects->obj_hash[i];
if (obj && obj->type == OBJ_COMMIT)
obj->flags &= ~flags;
}
Expand Down
2 changes: 1 addition & 1 deletion object.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,6 @@ void clear_object_flags(struct repository *, unsigned flags);
/*
* Clear the specified object flags from all in-core commit objects.
*/
void clear_commit_marks_all(unsigned int flags);
void clear_commit_marks_all(struct repository *, unsigned int flags);

#endif /* OBJECT_H */

0 comments on commit 746d9ff

Please sign in to comment.