diff options
author | Derrick Stolee <dstolee@microsoft.com> | 2018-07-20 18:33:13 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-07-21 00:38:55 +0200 |
commit | ba3ca1edce70d9d2d0eea1ac69377ae786e9413a (patch) | |
tree | 9175b28af67b595a275d0613b4fb9a7c3efa9a0e /commit-reach.h | |
parent | upload-pack: generalize commit date cutoff (diff) | |
download | git-ba3ca1edce70d9d2d0eea1ac69377ae786e9413a.tar.xz git-ba3ca1edce70d9d2d0eea1ac69377ae786e9413a.zip |
commit-reach: move can_all_from_reach_with_flags
There are several commit walks in the codebase. Group them together into
a new commit-reach.c file and corresponding header. After we group these
walks into one place, we can reduce duplicate logic by calling
equivalent methods.
The can_all_from_reach_with_flags method is used in a stateful way by
upload-pack.c. The parameters are very flexible, so we will be able to
use its commit walking logic for many other callers.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-reach.h')
-rw-r--r-- | commit-reach.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/commit-reach.h b/commit-reach.h index 13dec25cee..b28bc22fcd 100644 --- a/commit-reach.h +++ b/commit-reach.h @@ -59,4 +59,18 @@ define_commit_slab(contains_cache, enum contains_result); int commit_contains(struct ref_filter *filter, struct commit *commit, struct commit_list *list, struct contains_cache *cache); +int reachable(struct commit *from, unsigned int with_flag, + unsigned int assign_flag, time_t min_commit_date); + +/* + * Determine if every commit in 'from' can reach at least one commit + * that is marked with 'with_flag'. As we traverse, use 'assign_flag' + * as a marker for commits that are already visited. Do not walk + * commits with date below 'min_commit_date'. + */ +int can_all_from_reach_with_flag(struct object_array *from, + unsigned int with_flag, + unsigned int assign_flag, + time_t min_commit_date); + #endif |