path: root/ref-filter.h
diff options
authorZheNing Hu <>2021-07-26 03:26:50 (GMT)
committerJunio C Hamano <>2021-07-26 19:01:26 (GMT)
commitb9dee075eb07713a49922f7e1f90a6a9de5c5e5f (patch)
tree989e44066bf80856880edf37ea3dbcca3a65e2f1 /ref-filter.h
parente85fcb355a38b5f01493efecdf0150a10ee471da (diff)
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 <>
Diffstat (limited to 'ref-filter.h')
1 files changed, 4 insertions, 1 deletions
diff --git a/ref-filter.h b/ref-filter.h
index 74fb423..c15dee8 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) \