commit-reach.hon commit pretty: allow %(trailers) options with explicit value (4f732e0)
   1#ifndef COMMIT_REACH_H
   2#define COMMIT_REACH_H
   3
   4#include "commit-slab.h"
   5
   6struct commit;
   7struct commit_list;
   8struct contains_cache;
   9struct ref_filter;
  10
  11struct commit_list *get_merge_bases_many(struct commit *one,
  12                                         int n,
  13                                         struct commit **twos);
  14struct commit_list *get_merge_bases_many_dirty(struct commit *one,
  15                                               int n,
  16                                               struct commit **twos);
  17struct commit_list *get_merge_bases(struct commit *one, struct commit *two);
  18struct 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 */
  21struct commit_list *get_merge_bases_many_dirty(struct commit *one, int n, struct commit **twos);
  22
  23int is_descendant_of(struct commit *commit, struct commit_list *with_commit);
  24int in_merge_bases_many(struct commit *commit, int nr_reference, struct commit **reference);
  25int in_merge_bases(struct commit *commit, struct commit *reference);
  26
  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 */
  37struct 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 */
  43void reduce_heads_replace(struct commit_list **heads);
  44
  45int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid);
  46
  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 */
  51enum contains_result {
  52        CONTAINS_UNKNOWN = 0,
  53        CONTAINS_NO,
  54        CONTAINS_YES
  55};
  56
  57define_commit_slab(contains_cache, enum contains_result);
  58
  59int commit_contains(struct ref_filter *filter, struct commit *commit,
  60                    struct commit_list *list, struct contains_cache *cache);
  61
  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
  66 * commits with date below 'min_commit_date' or generation below
  67 * 'min_generation'.
  68 */
  69int can_all_from_reach_with_flag(struct object_array *from,
  70                                 unsigned int with_flag,
  71                                 unsigned int assign_flag,
  72                                 time_t min_commit_date,
  73                                 uint32_t min_generation);
  74int can_all_from_reach(struct commit_list *from, struct commit_list *to,
  75                       int commit_date_cutoff);
  76
  77#endif