]> git.ipfire.org Git - thirdparty/git.git/commitdiff
trailer: pass process_trailer_opts to trailer_info_get()
authorJeff King <peff@peff.net>
Thu, 23 Aug 2018 00:46:23 +0000 (20:46 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 23 Aug 2018 17:08:51 +0000 (10:08 -0700)
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 <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c
trailer.c
trailer.h

index b0613c06bbb6028ac45e0cc01e267c5fa22aa0da..849208eb40c3eb122d23e61a9d48eba4178f8e03 100644 (file)
@@ -224,11 +224,12 @@ static const char *get_todo_path(const struct replay_opts *opts)
 static int has_conforming_footer(struct strbuf *sb, struct strbuf *sob,
        int ignore_footer)
 {
+       struct process_trailer_options opts = PROCESS_TRAILER_OPTIONS_INIT;
        struct trailer_info info;
        size_t i;
        int found_sob = 0, found_sob_last = 0;
 
-       trailer_info_get(&info, sb->buf);
+       trailer_info_get(&info, sb->buf, &opts);
 
        if (info.trailer_start == info.trailer_end)
                return 0;
index 40eef8880e7d6796d00674452bdab30635011fb4..e769c5b72c587b4ae48b1f575781682e162c71e8 100644 (file)
--- a/trailer.c
+++ b/trailer.c
@@ -950,7 +950,7 @@ static size_t process_input_file(FILE *outfile,
        struct strbuf val = STRBUF_INIT;
        size_t i;
 
-       trailer_info_get(&info, str);
+       trailer_info_get(&info, str, opts);
 
        /* Print lines before the trailers as is */
        if (!opts->only_trailers)
@@ -1067,7 +1067,8 @@ void process_trailers(const char *file,
        strbuf_release(&sb);
 }
 
-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)
 {
        int patch_start, trailer_end, trailer_start;
        struct strbuf **trailer_lines, **ptr;
@@ -1159,7 +1160,7 @@ void format_trailers_from_commit(struct strbuf *out, const char *msg,
 {
        struct trailer_info info;
 
-       trailer_info_get(&info, msg);
+       trailer_info_get(&info, msg, opts);
        format_trailer_info(out, &info, opts);
        trailer_info_release(&info);
 }
index 6d7f8c2a52305d3d937b69a877f1ae0b7af94363..82a62b33bbe3bbe827f23c8e20fac779bfd79dbc 100644 (file)
--- 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);