summaryrefslogtreecommitdiff
path: root/commit-reach.h
diff options
context:
space:
mode:
Diffstat (limited to 'commit-reach.h')
-rw-r--r--commit-reach.h27
1 files changed, 22 insertions, 5 deletions
diff --git a/commit-reach.h b/commit-reach.h
index bf63cc468f..6012402dfc 100644
--- a/commit-reach.h
+++ b/commit-reach.h
@@ -14,12 +14,12 @@ int repo_get_merge_bases(struct repository *r,
struct commit *rev2,
struct commit_list **result);
int repo_get_merge_bases_many(struct repository *r,
- struct commit *one, int n,
+ struct commit *one, size_t n,
struct commit **twos,
struct commit_list **result);
/* To be used only when object flags after this call no longer matter */
int repo_get_merge_bases_many_dirty(struct repository *r,
- struct commit *one, int n,
+ struct commit *one, size_t n,
struct commit **twos,
struct commit_list **result);
@@ -81,7 +81,7 @@ int commit_contains(struct ref_filter *filter, struct commit *commit,
int can_all_from_reach_with_flag(struct object_array *from,
unsigned int with_flag,
unsigned int assign_flag,
- time_t min_commit_date,
+ timestamp_t min_commit_date,
timestamp_t min_generation);
int can_all_from_reach(struct commit_list *from, struct commit_list *to,
int commit_date_cutoff);
@@ -95,8 +95,8 @@ int can_all_from_reach(struct commit_list *from, struct commit_list *to,
* This method uses the PARENT1 and PARENT2 flags during its operation,
* so be sure these flags are not set before calling the method.
*/
-struct commit_list *get_reachable_subset(struct commit **from, int nr_from,
- struct commit **to, int nr_to,
+struct commit_list *get_reachable_subset(struct commit **from, size_t nr_from,
+ struct commit **to, size_t nr_to,
unsigned int reachable_flag);
struct ahead_behind_count {
@@ -139,4 +139,21 @@ void tips_reachable_from_bases(struct repository *r,
struct commit **tips, size_t tips_nr,
int mark);
+/*
+ * Given a 'tip' commit and a list potential 'bases', return the index 'i' that
+ * minimizes the number of commits in the first-parent history of 'tip' and not
+ * in the first-parent history of 'bases[i]'.
+ *
+ * Among a list of long-lived branches that are updated only by merges (with the
+ * first parent being the previous position of the branch), this would inform
+ * which branch was used to create the tip reference.
+ *
+ * Returns -1 if no common point is found in first-parent histories, which is
+ * rare, but possible with multiple root commits.
+ */
+int get_branch_base_for_tip(struct repository *r,
+ struct commit *tip,
+ struct commit **bases,
+ size_t bases_nr);
+
#endif