1 #ifndef __COMMIT_REACH_H__
2 #define __COMMIT_REACH_H__
4 #include "commit-slab.h"
11 struct commit_list
*repo_get_merge_bases(struct repository
*r
,
14 struct commit_list
*repo_get_merge_bases_many(struct repository
*r
,
15 struct commit
*one
, int n
,
16 struct commit
**twos
);
17 /* To be used only when object flags after this call no longer matter */
18 struct commit_list
*repo_get_merge_bases_many_dirty(struct repository
*r
,
19 struct commit
*one
, int n
,
20 struct commit
**twos
);
21 #ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
22 #define get_merge_bases(r1, r2) repo_get_merge_bases(the_repository, r1, r2)
23 #define get_merge_bases_many(one, n, two) repo_get_merge_bases_many(the_repository, one, n, two)
24 #define get_merge_bases_many_dirty(one, n, twos) repo_get_merge_bases_many_dirty(the_repository, one, n, twos)
27 struct commit_list
*get_octopus_merge_bases(struct commit_list
*in
);
29 int is_descendant_of(struct commit
*commit
, struct commit_list
*with_commit
);
30 int repo_in_merge_bases(struct repository
*r
,
31 struct commit
*commit
,
32 struct commit
*reference
);
33 int repo_in_merge_bases_many(struct repository
*r
,
34 struct commit
*commit
,
35 int nr_reference
, struct commit
**reference
);
36 #ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
37 #define in_merge_bases(c1, c2) repo_in_merge_bases(the_repository, c1, c2)
38 #define in_merge_bases_many(c1, n, cs) repo_in_merge_bases_many(the_repository, c1, n, cs)
42 * Takes a list of commits and returns a new list where those
43 * have been removed that can be reached from other commits in
44 * the list. It is useful for, e.g., reducing the commits
45 * randomly thrown at the git-merge command and removing
46 * redundant commits that the user shouldn't have given to it.
48 * This function destroys the STALE bit of the commit objects'
51 struct commit_list
*reduce_heads(struct commit_list
*heads
);
54 * Like `reduce_heads()`, except it replaces the list. Use this
55 * instead of `foo = reduce_heads(foo);` to avoid memory leaks.
57 void reduce_heads_replace(struct commit_list
**heads
);
59 int ref_newer(const struct object_id
*new_oid
, const struct object_id
*old_oid
);
62 * Unknown has to be "0" here, because that's the default value for
63 * contains_cache slab entries that have not yet been assigned.
65 enum contains_result
{
71 define_commit_slab(contains_cache
, enum contains_result
);
73 int commit_contains(struct ref_filter
*filter
, struct commit
*commit
,
74 struct commit_list
*list
, struct contains_cache
*cache
);
77 * Determine if every commit in 'from' can reach at least one commit
78 * that is marked with 'with_flag'. As we traverse, use 'assign_flag'
79 * as a marker for commits that are already visited. Do not walk
80 * commits with date below 'min_commit_date' or generation below
83 int can_all_from_reach_with_flag(struct object_array
*from
,
84 unsigned int with_flag
,
85 unsigned int assign_flag
,
86 time_t min_commit_date
,
87 uint32_t min_generation
);
88 int can_all_from_reach(struct commit_list
*from
, struct commit_list
*to
,
89 int commit_date_cutoff
);