mirror of
https://github.com/git/git.git
synced 2024-05-09 16:06:10 +02:00
commit.c: add clear_commit_marks_many()
clear_commit_marks(struct commit *, unsigned) only can clear flag bits starting from a single commit; introduce an API to allow feeding an array of commits, so that flag bits can be cleared from commits reachable from any of them with a single traversal. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
e6363a4992
commit
e895cb5135
19
commit.c
19
commit.c
|
@ -463,14 +463,23 @@ static void clear_commit_marks_1(struct commit_list **plist,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_commit_marks(struct commit *commit, unsigned int mark)
|
void clear_commit_marks_many(int nr, struct commit **commit, unsigned int mark)
|
||||||
{
|
{
|
||||||
struct commit_list *list = NULL;
|
struct commit_list *list = NULL;
|
||||||
commit_list_insert(commit, &list);
|
|
||||||
|
while (nr--) {
|
||||||
|
commit_list_insert(*commit, &list);
|
||||||
|
commit++;
|
||||||
|
}
|
||||||
while (list)
|
while (list)
|
||||||
clear_commit_marks_1(&list, pop_commit(&list), mark);
|
clear_commit_marks_1(&list, pop_commit(&list), mark);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clear_commit_marks(struct commit *commit, unsigned int mark)
|
||||||
|
{
|
||||||
|
clear_commit_marks_many(1, &commit, mark);
|
||||||
|
}
|
||||||
|
|
||||||
void clear_commit_marks_for_object_array(struct object_array *a, unsigned mark)
|
void clear_commit_marks_for_object_array(struct object_array *a, unsigned mark)
|
||||||
{
|
{
|
||||||
struct object *object;
|
struct object *object;
|
||||||
|
@ -797,8 +806,7 @@ struct commit_list *get_merge_bases_many(struct commit *one,
|
||||||
if (!result || !result->next) {
|
if (!result || !result->next) {
|
||||||
if (cleanup) {
|
if (cleanup) {
|
||||||
clear_commit_marks(one, all_flags);
|
clear_commit_marks(one, all_flags);
|
||||||
for (i = 0; i < n; i++)
|
clear_commit_marks_many(n, twos, all_flags);
|
||||||
clear_commit_marks(twos[i], all_flags);
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -816,8 +824,7 @@ struct commit_list *get_merge_bases_many(struct commit *one,
|
||||||
free_commit_list(result);
|
free_commit_list(result);
|
||||||
|
|
||||||
clear_commit_marks(one, all_flags);
|
clear_commit_marks(one, all_flags);
|
||||||
for (i = 0; i < n; i++)
|
clear_commit_marks_many(n, twos, all_flags);
|
||||||
clear_commit_marks(twos[i], all_flags);
|
|
||||||
|
|
||||||
cnt = remove_redundant(rslt, cnt);
|
cnt = remove_redundant(rslt, cnt);
|
||||||
result = NULL;
|
result = NULL;
|
||||||
|
|
1
commit.h
1
commit.h
|
@ -134,6 +134,7 @@ struct commit *pop_most_recent_commit(struct commit_list **list,
|
||||||
struct commit *pop_commit(struct commit_list **stack);
|
struct commit *pop_commit(struct commit_list **stack);
|
||||||
|
|
||||||
void clear_commit_marks(struct commit *commit, unsigned int mark);
|
void clear_commit_marks(struct commit *commit, unsigned int mark);
|
||||||
|
void clear_commit_marks_many(int nr, struct commit **commit, unsigned int mark);
|
||||||
void clear_commit_marks_for_object_array(struct object_array *a, unsigned mark);
|
void clear_commit_marks_for_object_array(struct object_array *a, unsigned mark);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue