From b9dee075eb07713a49922f7e1f90a6a9de5c5e5f Mon Sep 17 00:00:00 2001 From: ZheNing Hu Date: Mon, 26 Jul 2021 03:26:50 +0000 Subject: ref-filter: add %(rest) atom %(rest) is a atom used for cat-file batch mode, which can split the input lines at the first whitespace boundary, all characters before that whitespace are considered to be the object name; characters after that first run of whitespace (i.e., the "rest" of the line) are output in place of the %(rest) atom. In order to let "cat-file --batch=%(rest)" use the ref-filter interface, add %(rest) atom for ref-filter. Introduce the reject_atom() to reject the atom %(rest) for "git for-each-ref", "git branch", "git tag" and "git verify-tag". Reviewed-by: Jacob Keller Suggected-by: Jacob Keller Mentored-by: Christian Couder Mentored-by: Hariom Verma Signed-off-by: ZheNing Hu Signed-off-by: Junio C Hamano --- ref-filter.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ref-filter.h') diff --git a/ref-filter.h b/ref-filter.h index 74fb423fc8..c15dee8d6b 100644 --- a/ref-filter.h +++ b/ref-filter.h @@ -38,6 +38,7 @@ struct ref_sorting { struct ref_array_item { struct object_id objectname; + const char *rest; int flag; unsigned int kind; const char *symref; @@ -76,14 +77,16 @@ struct ref_format { * verify_ref_format() afterwards to finalize. */ 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; }; -#define REF_FORMAT_INIT { NULL, 0, -1 } +#define REF_FORMAT_INIT { .use_color = -1 } /* Macros for checking --merged and --no-merged options */ #define _OPT_MERGED_NO_MERGED(option, filter, h) \ -- cgit v1.2.1