5 #include "commit-slab.h"
12 struct commit_list
*repo_get_merge_bases(struct repository
*r
,
15 struct commit_list
*repo_get_merge_bases_many(struct repository
*r
,
16 struct commit
*one
, int n
,
17 struct commit
**twos
);
18 /* To be used only when object flags after this call no longer matter */
19 struct commit_list
*repo_get_merge_bases_many_dirty(struct repository
*r
,
20 struct commit
*one
, int n
,
21 struct commit
**twos
);
23 struct commit_list
*get_octopus_merge_bases(struct commit_list
*in
);
25 int repo_is_descendant_of(struct repository
*r
,
26 struct commit
*commit
,
27 struct commit_list
*with_commit
);
28 int repo_in_merge_bases(struct repository
*r
,
29 struct commit
*commit
,
30 struct commit
*reference
);
31 int repo_in_merge_bases_many(struct repository
*r
,
32 struct commit
*commit
,
33 int nr_reference
, struct commit
**reference
);
36 * Takes a list of commits and returns a new list where those
37 * have been removed that can be reached from other commits in
38 * the list. It is useful for, e.g., reducing the commits
39 * randomly thrown at the git-merge command and removing
40 * redundant commits that the user shouldn't have given to it.
42 * This function destroys the STALE bit of the commit objects'
45 struct commit_list
*reduce_heads(struct commit_list
*heads
);
48 * Like `reduce_heads()`, except it replaces the list. Use this
49 * instead of `foo = reduce_heads(foo);` to avoid memory leaks.
51 void reduce_heads_replace(struct commit_list
**heads
);
53 int ref_newer(const struct object_id
*new_oid
, const struct object_id
*old_oid
);
56 * Unknown has to be "0" here, because that's the default value for
57 * contains_cache slab entries that have not yet been assigned.
59 enum contains_result
{
65 define_commit_slab(contains_cache
, enum contains_result
);
67 int commit_contains(struct ref_filter
*filter
, struct commit
*commit
,
68 struct commit_list
*list
, struct contains_cache
*cache
);
71 * Determine if every commit in 'from' can reach at least one commit
72 * that is marked with 'with_flag'. As we traverse, use 'assign_flag'
73 * as a marker for commits that are already visited. Do not walk
74 * commits with date below 'min_commit_date' or generation below
77 int can_all_from_reach_with_flag(struct object_array
*from
,
78 unsigned int with_flag
,
79 unsigned int assign_flag
,
80 time_t min_commit_date
,
81 timestamp_t min_generation
);
82 int can_all_from_reach(struct commit_list
*from
, struct commit_list
*to
,
83 int commit_date_cutoff
);
87 * Return a list of commits containing the commits in the 'to' array
88 * that are reachable from at least one commit in the 'from' array.
89 * Also add the given 'flag' to each of the commits in the returned list.
91 * This method uses the PARENT1 and PARENT2 flags during its operation,
92 * so be sure these flags are not set before calling the method.
94 struct commit_list
*get_reachable_subset(struct commit
**from
, int nr_from
,
95 struct commit
**to
, int nr_to
,
96 unsigned int reachable_flag
);