config.txt: move clean.* to a separate file
[git.git] / commit-reach.h
blob7d313e2975a28ef79b2ccf6dea965d4f139eda58
1 #ifndef __COMMIT_REACH_H__
2 #define __COMMIT_REACH_H__
4 #include "commit-slab.h"
6 struct commit;
7 struct commit_list;
8 struct contains_cache;
9 struct ref_filter;
11 struct commit_list *get_merge_bases_many(struct commit *one,
12 int n,
13 struct commit **twos);
14 struct commit_list *get_merge_bases_many_dirty(struct commit *one,
15 int n,
16 struct commit **twos);
17 struct commit_list *get_merge_bases(struct commit *one, struct commit *two);
18 struct commit_list *get_octopus_merge_bases(struct commit_list *in);
20 /* To be used only when object flags after this call no longer matter */
21 struct commit_list *get_merge_bases_many_dirty(struct commit *one, int n, struct commit **twos);
23 int is_descendant_of(struct commit *commit, struct commit_list *with_commit);
24 int in_merge_bases_many(struct commit *commit, int nr_reference, struct commit **reference);
25 int in_merge_bases(struct commit *commit, struct commit *reference);
28 * Takes a list of commits and returns a new list where those
29 * have been removed that can be reached from other commits in
30 * the list. It is useful for, e.g., reducing the commits
31 * randomly thrown at the git-merge command and removing
32 * redundant commits that the user shouldn't have given to it.
34 * This function destroys the STALE bit of the commit objects'
35 * flags.
37 struct commit_list *reduce_heads(struct commit_list *heads);
40 * Like `reduce_heads()`, except it replaces the list. Use this
41 * instead of `foo = reduce_heads(foo);` to avoid memory leaks.
43 void reduce_heads_replace(struct commit_list **heads);
45 int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid);
48 * Unknown has to be "0" here, because that's the default value for
49 * contains_cache slab entries that have not yet been assigned.
51 enum contains_result {
52 CONTAINS_UNKNOWN = 0,
53 CONTAINS_NO,
54 CONTAINS_YES
57 define_commit_slab(contains_cache, enum contains_result);
59 int commit_contains(struct ref_filter *filter, struct commit *commit,
60 struct commit_list *list, struct contains_cache *cache);
63 * Determine if every commit in 'from' can reach at least one commit
64 * that is marked with 'with_flag'. As we traverse, use 'assign_flag'
65 * as a marker for commits that are already visited. Do not walk
66 * commits with date below 'min_commit_date' or generation below
67 * 'min_generation'.
69 int can_all_from_reach_with_flag(struct object_array *from,
70 unsigned int with_flag,
71 unsigned int assign_flag,
72 time_t min_commit_date,
73 uint32_t min_generation);
74 int can_all_from_reach(struct commit_list *from, struct commit_list *to,
75 int commit_date_cutoff);
77 #endif