Re: [PATCH v4 2/7] ref-filter: add function to print single ref_array_item
- From
Jeff King <peff@peff.net>
- Date
- Oct 19, 2016, 08:55 UTC
- Message-ID
- <20161019085543.om7v7eowfaushags@sigill.intra.peff.net>
- In-Reply-To
- <20161007210721.20437-3-santiago@nyu.edu>
On Fri, Oct 07, 2016 at 05:07:16PM -0400, santiago@nyu.edu wrote:
Show 8 quoted lines
> From: Lukas Puehringer <luk.puehringer@gmail.com> > > 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.
Show 11 quoted lines
> 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