Skip to content

Commit d91d6fb

Browse files
derrickstoleegitster
authored andcommitted
commit-reach: create repo_is_descendant_of()
The next change will make repo_in_merge_bases() depend on the logic in is_descendant_of(), but we need to make the method independent of the_repository first. Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent eebb51b commit d91d6fb

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

commit-reach.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,9 @@ struct commit_list *repo_get_merge_bases(struct repository *r,
283283
/*
284284
* Is "commit" a descendant of one of the elements on the "with_commit" list?
285285
*/
286-
int is_descendant_of(struct commit *commit, struct commit_list *with_commit)
286+
static int repo_is_descendant_of(struct repository *r,
287+
struct commit *commit,
288+
struct commit_list *with_commit)
287289
{
288290
if (!with_commit)
289291
return 1;
@@ -301,13 +303,18 @@ int is_descendant_of(struct commit *commit, struct commit_list *with_commit)
301303

302304
other = with_commit->item;
303305
with_commit = with_commit->next;
304-
if (in_merge_bases(other, commit))
306+
if (repo_in_merge_bases(r, other, commit))
305307
return 1;
306308
}
307309
return 0;
308310
}
309311
}
310312

313+
int is_descendant_of(struct commit *commit, struct commit_list *with_commit)
314+
{
315+
return repo_is_descendant_of(the_repository, commit, with_commit);
316+
}
317+
311318
/*
312319
* Is "commit" an ancestor of one of the "references"?
313320
*/

0 commit comments

Comments
 (0)