]>
Commit | Line | Data |
---|---|---|
5227c385 DS |
1 | #ifndef __COMMIT_REACH_H__ |
2 | #define __COMMIT_REACH_H__ | |
3 | ||
920f93ca DS |
4 | #include "commit-slab.h" |
5 | ||
5227c385 DS |
6 | struct commit; |
7 | struct commit_list; | |
920f93ca DS |
8 | struct contains_cache; |
9 | struct ref_filter; | |
5227c385 DS |
10 | |
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); | |
19 | ||
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); | |
22 | ||
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); | |
26 | ||
5227c385 DS |
27 | /* |
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. | |
33 | * | |
34 | * This function destroys the STALE bit of the commit objects' | |
35 | * flags. | |
36 | */ | |
37 | struct commit_list *reduce_heads(struct commit_list *heads); | |
38 | ||
39 | /* | |
40 | * Like `reduce_heads()`, except it replaces the list. Use this | |
41 | * instead of `foo = reduce_heads(foo);` to avoid memory leaks. | |
42 | */ | |
43 | void reduce_heads_replace(struct commit_list **heads); | |
44 | ||
1d614d41 DS |
45 | int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid); |
46 | ||
920f93ca DS |
47 | /* |
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. | |
50 | */ | |
51 | enum contains_result { | |
52 | CONTAINS_UNKNOWN = 0, | |
53 | CONTAINS_NO, | |
54 | CONTAINS_YES | |
55 | }; | |
56 | ||
57 | define_commit_slab(contains_cache, enum contains_result); | |
58 | ||
59 | int commit_contains(struct ref_filter *filter, struct commit *commit, | |
60 | struct commit_list *list, struct contains_cache *cache); | |
61 | ||
ba3ca1ed DS |
62 | /* |
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 | |
4fbcca4e DS |
66 | * commits with date below 'min_commit_date' or generation below |
67 | * 'min_generation'. | |
ba3ca1ed DS |
68 | */ |
69 | int can_all_from_reach_with_flag(struct object_array *from, | |
70 | unsigned int with_flag, | |
71 | unsigned int assign_flag, | |
4fbcca4e DS |
72 | time_t min_commit_date, |
73 | uint32_t min_generation); | |
1792bc12 DS |
74 | int can_all_from_reach(struct commit_list *from, struct commit_list *to, |
75 | int commit_date_cutoff); | |
ba3ca1ed | 76 | |
5227c385 | 77 | #endif |