From 058761f1c19b58afd6906672fc013327eb2096c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Wed, 9 Dec 2020 16:52:08 +0100 Subject: pretty format %(trailers): add a "key_value_separator" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a "key_value_separator" option to the "%(trailers)" pretty format, to go along with the existing "separator" argument. In combination these two options make it trivial to produce machine-readable (e.g. \0 and \0\0-delimited) format output. As elaborated on in a previous commit which added "keyonly" it was needlessly tedious to extract structured data from "%(trailers)" before the addition of this "key_value_separator" option. As seen by the test being added here extracting this data now becomes trivial. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- trailer.h | 1 + 1 file changed, 1 insertion(+) (limited to 'trailer.h') diff --git a/trailer.h b/trailer.h index d2f28776be..795d2fccfd 100644 --- a/trailer.h +++ b/trailer.h @@ -74,6 +74,7 @@ struct process_trailer_options { int key_only; int value_only; const struct strbuf *separator; + const struct strbuf *key_value_separator; int (*filter)(const struct strbuf *, void *); void *filter_data; }; -- cgit v1.2.3