Re: [PATCH v4 2/7] ref-filter: add function to print single ref_array_item
From: Jeff King <hidden>
Date: 2016-10-19 15:46:41
On Fri, Oct 07, 2016 at 05:07:16PM -0400, santiago@nyu.edu wrote:
From: Lukas Puehringer <redacted> ref-filter functions are useful for printing git object information using a format specifier. However, some other modules may not want to use this functionality on a ref-array but only print a single item. Expose a pretty_print_ref function to create, pretty print and free individual ref-items.
Makes sense.
quoted hunk ↗ jump to hunk
diff --git a/ref-filter.h b/ref-filter.h index 14d435e..3d23090 100644 --- a/ref-filter.h +++ b/ref-filter.h@@ -107,4 +107,7 @@ struct ref_sorting *ref_default_sorting(void); /* Function to parse --merged and --no-merged options */ int parse_opt_merge_filter(const struct option *opt, const char *arg, int unset); +void pretty_print_ref(const char *name, const unsigned char *sha1, + const char *format, unsigned kind); +
What are the possible values for "kind"? I guess these should come from FILTER_REFS_TAGS, BRANCHES, etc. It's probably worth documenting that. Alternatively, is it possible to just determine this from the name? It looks like filter_ref_kind() is how it happens for a normal ref-filter. -Peff