commit-reach: move ref_newer from remote.c
[git/git.git] / commit-reach.h
CommitLineData
5227c385
DS
1#ifndef __COMMIT_REACH_H__
2#define __COMMIT_REACH_H__
3
4struct commit;
5struct commit_list;
6
7struct commit_list *get_merge_bases_many(struct commit *one,
8 int n,
9 struct commit **twos);
10struct commit_list *get_merge_bases_many_dirty(struct commit *one,
11 int n,
12 struct commit **twos);
13struct commit_list *get_merge_bases(struct commit *one, struct commit *two);
14struct commit_list *get_octopus_merge_bases(struct commit_list *in);
15
16/* To be used only when object flags after this call no longer matter */
17struct commit_list *get_merge_bases_many_dirty(struct commit *one, int n, struct commit **twos);
18
19int is_descendant_of(struct commit *commit, struct commit_list *with_commit);
20int in_merge_bases_many(struct commit *commit, int nr_reference, struct commit **reference);
21int in_merge_bases(struct commit *commit, struct commit *reference);
22
23
24/*
25 * Takes a list of commits and returns a new list where those
26 * have been removed that can be reached from other commits in
27 * the list. It is useful for, e.g., reducing the commits
28 * randomly thrown at the git-merge command and removing
29 * redundant commits that the user shouldn't have given to it.
30 *
31 * This function destroys the STALE bit of the commit objects'
32 * flags.
33 */
34struct commit_list *reduce_heads(struct commit_list *heads);
35
36/*
37 * Like `reduce_heads()`, except it replaces the list. Use this
38 * instead of `foo = reduce_heads(foo);` to avoid memory leaks.
39 */
40void reduce_heads_replace(struct commit_list **heads);
41
1d614d41
DS
42int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid);
43
5227c385 44#endif