From 00a21f5cbda35eb5d355b453849b625eeca7eac4 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Wed, 22 Aug 2018 20:46:23 -0400 Subject: trailer: pass process_trailer_opts to trailer_info_get() Most of the trailer code has an "opts" struct which is filled in by the caller. We don't pass it down to trailer_info_get(), which does the initial parsing, because there hasn't yet been a need to do so. Let's start passing it down in preparation for adding new options. Note that there's a single caller which doesn't otherwise have such an options struct. Since it's just one caller (that we'd have to modify anyway), let's not bother with any special treatment like accepting a NULL options struct, and just have it allocate one with the defaults. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- trailer.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'trailer.h') diff --git a/trailer.h b/trailer.h index 6d7f8c2a52..82a62b33bb 100644 --- a/trailer.h +++ b/trailer.h @@ -77,7 +77,8 @@ void process_trailers(const char *file, const struct process_trailer_options *opts, struct list_head *new_trailer_head); -void trailer_info_get(struct trailer_info *info, const char *str); +void trailer_info_get(struct trailer_info *info, const char *str, + const struct process_trailer_options *opts); void trailer_info_release(struct trailer_info *info); -- cgit v1.2.3 From 1688c9a4894df517241026c7a3848bdc84607986 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Wed, 22 Aug 2018 20:49:56 -0400 Subject: interpret-trailers: allow suppressing "---" divider Even with the newly-tightened "---" parser, it's still possible for a commit message to trigger a false positive if it contains something like "--- foo". If the caller knows that it has only a single commit message, it can now tell us with the "--no-divider" option, eliminating any false positives. If we were designing this from scratch, I'd probably make this the default. But we've advertised the "---" behavior in the documentation since interpret-trailers has existed. Since it's meant to be scripted, breaking that would be a bad idea. Note that the logic is in the underlying trailer.c code, which is used elsewhere. The default there will keep the current behavior, but many callers will benefit from setting this new option. That's left for future patches. Signed-off-by: Jeff King 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 82a62b33bb..f47b16e2c4 100644 --- a/trailer.h +++ b/trailer.h @@ -69,6 +69,7 @@ struct process_trailer_options { int only_trailers; int only_input; int unfold; + int no_divider; }; #define PROCESS_TRAILER_OPTIONS_INIT {0} -- cgit v1.2.3