git/trailer.c

#define USE_THE_REPOSITORY_VARIABLE

#include "git-compat-util.h"
#include "config.h"
#include "environment.h"
#include "gettext.h"
#include "string-list.h"
#include "run-command.h"
#include "commit.h"
#include "trailer.h"
#include "list.h"
/*
 * Copyright (c) 2013, 2014 Christian Couder <[email protected]>
 */

struct trailer_info {};

struct conf_info {};

static struct conf_info default_conf_info;

struct trailer_item {};

struct arg_item {};

static LIST_HEAD(conf_head);

static const char *separators =;

static int configured;

#define TRAILER_ARG_STRING

static const char *git_generated_prefixes[] =;

/* Iterate over the elements of the list. */
#define list_for_each_dir(pos, head, is_reverse)

static int after_or_end(enum trailer_where where)
{}

/*
 * Return the length of the string not including any final
 * punctuation. E.g., the input "Signed-off-by:" would return
 * 13, stripping the trailing punctuation but retaining
 * internal punctuation.
 */
static size_t token_len_without_separator(const char *token, size_t len)
{}

static int same_token(struct trailer_item *a, struct arg_item *b)
{}

static int same_value(struct trailer_item *a, struct arg_item *b)
{}

static int same_trailer(struct trailer_item *a, struct arg_item *b)
{}

static inline int is_blank_line(const char *str)
{}

static inline void strbuf_replace(struct strbuf *sb, const char *a, const char *b)
{}

static void free_trailer_item(struct trailer_item *item)
{}

static void free_arg_item(struct arg_item *item)
{}

static char last_non_space_char(const char *s)
{}

static struct trailer_item *trailer_from_arg(struct arg_item *arg_tok)
{}

static void add_arg_to_input_list(struct trailer_item *on_tok,
				  struct arg_item *arg_tok)
{}

static int check_if_different(struct trailer_item *in_tok,
			      struct arg_item *arg_tok,
			      int check_all,
			      struct list_head *head)
{}

static char *apply_command(struct conf_info *conf, const char *arg)
{}

static void apply_item_command(struct trailer_item *in_tok, struct arg_item *arg_tok)
{}

static void apply_arg_if_exists(struct trailer_item *in_tok,
				struct arg_item *arg_tok,
				struct trailer_item *on_tok,
				struct list_head *head)
{}

static void apply_arg_if_missing(struct list_head *head,
				 struct arg_item *arg_tok)
{}

static int find_same_and_apply_arg(struct list_head *head,
				   struct arg_item *arg_tok)
{}

void process_trailers_lists(struct list_head *head,
			    struct list_head *arg_head)
{}

int trailer_set_where(enum trailer_where *item, const char *value)
{}

int trailer_set_if_exists(enum trailer_if_exists *item, const char *value)
{}

int trailer_set_if_missing(enum trailer_if_missing *item, const char *value)
{}

static void duplicate_conf(struct conf_info *dst, const struct conf_info *src)
{}

static struct arg_item *get_conf_item(const char *name)
{}

enum trailer_info_type {};

static struct {} trailer_config_items[] =;

static int git_trailer_default_config(const char *conf_key, const char *value,
				      const struct config_context *ctx UNUSED,
				      void *cb UNUSED)
{}

static int git_trailer_config(const char *conf_key, const char *value,
			      const struct config_context *ctx UNUSED,
			      void *cb UNUSED)
{}

void trailer_config_init(void)
{}

static const char *token_from_item(struct arg_item *item, char *tok)
{}

static int token_matches_item(const char *tok, struct arg_item *item, size_t tok_len)
{}

/*
 * If the given line is of the form
 * "<token><optional whitespace><separator>..." or "<separator>...", return the
 * location of the separator. Otherwise, return -1.  The optional whitespace
 * is allowed there primarily to allow things like "Bug #43" where <token> is
 * "Bug" and <separator> is "#".
 *
 * The separator-starts-line case (in which this function returns 0) is
 * distinguished from the non-well-formed-line case (in which this function
 * returns -1) because some callers of this function need such a distinction.
 */
static ssize_t find_separator(const char *line, const char *separators)
{}

/*
 * Obtain the token, value, and conf from the given trailer.
 *
 * separator_pos must not be 0, since the token cannot be an empty string.
 *
 * If separator_pos is -1, interpret the whole trailer as a token.
 */
static void parse_trailer(struct strbuf *tok, struct strbuf *val,
			 const struct conf_info **conf, const char *trailer,
			 ssize_t separator_pos)
{}

static struct trailer_item *add_trailer_item(struct list_head *head, char *tok,
					     char *val)
{}

static void add_arg_item(struct list_head *arg_head, char *tok, char *val,
			 const struct conf_info *conf,
			 const struct new_trailer_item *new_trailer_item)
{}

void parse_trailers_from_config(struct list_head *config_head)
{}

void parse_trailers_from_command_line_args(struct list_head *arg_head,
					   struct list_head *new_trailer_head)
{}

static const char *next_line(const char *str)
{}

/*
 * Return the position of the start of the last line. If len is 0, return -1.
 */
static ssize_t last_line(const char *buf, size_t len)
{}

/*
 * Find the end of the log message as an offset from the start of the input
 * (where callers of this function are interested in looking for a trailers
 * block in the same input). We have to consider two categories of content that
 * can come at the end of the input which we want to ignore (because they don't
 * belong in the log message):
 *
 * (1) the "patch part" which begins with a "---" divider and has patch
 * information (like the output of git-format-patch), and
 *
 * (2) any trailing comment lines, blank lines like in the output of "git
 * commit -v", or stuff below the "cut" (scissor) line.
 *
 * As a formula, the situation looks like this:
 *
 *     INPUT = LOG MESSAGE + IGNORED
 *
 * where IGNORED can be either of the two categories described above. It may be
 * that there is nothing to ignore. Now it may be the case that the LOG MESSAGE
 * contains a trailer block, but that's not the concern of this function.
 */
static size_t find_end_of_log_message(const char *input, int no_divider)
{}

/*
 * Return the position of the first trailer line or len if there are no
 * trailers.
 */
static size_t find_trailer_block_start(const char *buf, size_t len)
{}

static int ends_with_blank_line(const char *buf, size_t len)
{}

static void unfold_value(struct strbuf *val)
{}

static struct trailer_info *trailer_info_new(void)
{}

static struct trailer_info *trailer_info_get(const struct process_trailer_options *opts,
					     const char *str)
{}

/*
 * Parse trailers in "str", populating the trailer info and "trailer_objects"
 * linked list structure.
 */
struct trailer_info *parse_trailers(const struct process_trailer_options *opts,
				    const char *str,
				    struct list_head *trailer_objects)
{}

void free_trailers(struct list_head *trailers)
{}

size_t trailer_block_start(struct trailer_info *info)
{}

size_t trailer_block_end(struct trailer_info *info)
{}

int blank_line_before_trailer_block(struct trailer_info *info)
{}

void trailer_info_release(struct trailer_info *info)
{}

void format_trailers(const struct process_trailer_options *opts,
		     struct list_head *trailers,
		     struct strbuf *out)
{}

void format_trailers_from_commit(const struct process_trailer_options *opts,
				 const char *msg,
				 struct strbuf *out)
{}

void trailer_iterator_init(struct trailer_iterator *iter, const char *msg)
{}

int trailer_iterator_advance(struct trailer_iterator *iter)
{}

void trailer_iterator_release(struct trailer_iterator *iter)
{}

int amend_file_with_trailers(const char *path, const struct strvec *trailer_args)
{}