diff options
Diffstat (limited to 'ref-filter.h')
-rw-r--r-- | ref-filter.h | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/ref-filter.h b/ref-filter.h index aa0eea4ecf..430701cfb7 100644 --- a/ref-filter.h +++ b/ref-filter.h @@ -1,10 +1,11 @@ #ifndef REF_FILTER_H #define REF_FILTER_H +#include "gettext.h" #include "oid-array.h" #include "refs.h" #include "commit.h" -#include "parse-options.h" +#include "string-list.h" /* Quoting styles */ #define QUOTE_NONE 0 @@ -24,6 +25,8 @@ struct atom_value; struct ref_sorting; +struct ahead_behind_count; +struct option; enum ref_sorting_order { REF_SORTING_REVERSE = 1<<0, @@ -40,6 +43,8 @@ struct ref_array_item { const char *symref; struct commit *commit; struct atom_value *value; + struct ahead_behind_count **counts; + char refname[FLEX_ARRAY]; }; @@ -47,6 +52,9 @@ struct ref_array { int nr, alloc; struct ref_array_item **items; struct rev_info *revs; + + struct ahead_behind_count *counts; + size_t counts_nr; }; struct ref_filter { @@ -75,14 +83,19 @@ struct ref_format { const char *format; const char *rest; int quote_style; - int use_rest; int use_color; /* Internal state to ref-filter */ int need_color_reset_at_eol; + + /* List of bases for ahead-behind counts. */ + struct string_list bases; }; -#define REF_FORMAT_INIT { .use_color = -1 } +#define REF_FORMAT_INIT { \ + .use_color = -1, \ + .bases = STRING_LIST_INIT_DUP, \ +} /* Macros for checking --merged and --no-merged options */ #define _OPT_MERGED_NO_MERGED(option, filter, h) \ @@ -143,4 +156,15 @@ struct ref_array_item *ref_array_push(struct ref_array *array, const char *refname, const struct object_id *oid); +/* + * If the provided format includes ahead-behind atoms, then compute the + * ahead-behind values for the array of filtered references. Must be + * called after filter_refs() but before outputting the formatted refs. + * + * If this is not called, then any ahead-behind atoms will be blank. + */ +void filter_ahead_behind(struct repository *r, + struct ref_format *format, + struct ref_array *array); + #endif /* REF_FILTER_H */ |