commit-reach: move ref_newer from remote.c
[git/git.git] / commit-reach.h
1 #ifndef __COMMIT_REACH_H__
2 #define __COMMIT_REACH_H__
3
4 struct commit;
5 struct commit_list;
6
7 struct commit_list *get_merge_bases_many(struct commit *one,
8 int n,
9 struct commit **twos);
10 struct commit_list *get_merge_bases_many_dirty(struct commit *one,
11 int n,
12 struct commit **twos);
13 struct commit_list *get_merge_bases(struct commit *one, struct commit *two);
14 struct 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 */
17 struct commit_list *get_merge_bases_many_dirty(struct commit *one, int n, struct commit **twos);
18
19 int is_descendant_of(struct commit *commit, struct commit_list *with_commit);
20 int in_merge_bases_many(struct commit *commit, int nr_reference, struct commit **reference);
21 int 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 */
34 struct 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 */
40 void reduce_heads_replace(struct commit_list **heads);
41
42 int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid);
43
44 #endif