Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictoria Dye <vdye@github.com>2023-11-14 22:53:52 +0300
committerJunio C Hamano <gitster@pobox.com>2023-11-16 08:02:59 +0300
commite7574b0c6b1e0cf2de9e000766a13d23fd9516e6 (patch)
treeeea6d4b3510f6f7d3d60215d67ddcba89a29aa14 /ref-filter.h
parent6d6e5c53b0c3d5566680ee8786d40405db917917 (diff)
ref-filter.h: add functions for filter/format & format-only
Add two new public methods to 'ref-filter.h': * 'print_formatted_ref_array()' which, given a format specification & array of ref items, formats and prints the items to stdout. * 'filter_and_format_refs()' which combines 'filter_refs()', 'ref_array_sort()', and 'print_formatted_ref_array()' into a single function. This consolidates much of the code used to filter and format refs in 'builtin/for-each-ref.c', 'builtin/tag.c', and 'builtin/branch.c', reducing duplication and simplifying the future changes needed to optimize the filter & format process. Signed-off-by: Victoria Dye <vdye@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'ref-filter.h')
-rw-r--r--ref-filter.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/ref-filter.h b/ref-filter.h
index 0db3ff5288..0ce5af58ab 100644
--- a/ref-filter.h
+++ b/ref-filter.h
@@ -137,6 +137,14 @@ struct ref_format {
* filtered refs in the ref_array structure.
*/
int filter_refs(struct ref_array *array, struct ref_filter *filter, unsigned int type);
+/*
+ * Filter refs using the given ref_filter and type, sort the contents
+ * according to the given ref_sorting, format the filtered refs with the
+ * given ref_format, and print them to stdout.
+ */
+void filter_and_format_refs(struct ref_filter *filter, unsigned int type,
+ struct ref_sorting *sorting,
+ struct ref_format *format);
/* Clear all memory allocated to ref_array */
void ref_array_clear(struct ref_array *array);
/* Used to verify if the given format is correct and to parse out the used atoms */
@@ -162,6 +170,12 @@ char *get_head_description(void);
void setup_ref_filter_porcelain_msg(void);
/*
+ * Print up to maxcount ref_array elements to stdout using the given
+ * ref_format.
+ */
+void print_formatted_ref_array(struct ref_array *array, struct ref_format *format);
+
+/*
* Print a single ref, outside of any ref-filter. Note that the
* name must be a fully qualified refname.
*/