git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/9] trailer: read and process config information

From
Christian Couder <christian.couder@gmail.com>
Date
Dec 24, 2013, 13:47 UTC
Message-ID
<CAP8UFD105z8YrgWPAzsaj7=Zx9x+DqfXBK1FUAmcFYY2rdzvBg@mail.gmail.com>
In-Reply-To
<20131224063726.19560.89108.chriscool@tuxfamily.org>

On Tue, Dec 24, 2013 at 7:37 AM, Christian Couder <chriscool@tuxfamily.org> wrote:

Show 32 quoted lines
>
> +static int git_trailer_config(const char *conf_key, const char *value, void *cb)
> +{
> +       if (starts_with(conf_key, "trailer.")) {
> +               const char *orig_conf_key = conf_key;
> +               struct trailer_item *item;
> +               struct conf_info *conf;
> +               char *name;
> +               enum trailer_info_type type;
> +
> +               conf_key += 8;
> +               if (!set_name_and_type(conf_key, ".key", TRAILER_VALUE, &name, &type) &&
> +                   !set_name_and_type(conf_key, ".command", TRAILER_COMMAND, &name, &type) &&
> +                   !set_name_and_type(conf_key, ".where", TRAILER_WHERE, &name, &type) &&
> +                   !set_name_and_type(conf_key, ".ifexist", TRAILER_IF_EXIST, &name, &type) &&
> +                   !set_name_and_type(conf_key, ".ifmissing", TRAILER_IF_MISSING, &name, &type))
> +                       return 0;
> +
> +               item = get_conf_item(name);
> +               conf = item->conf;
> +
> +               if (type == TRAILER_VALUE) {
> +                       if (conf->key)
> +                               warning(_("more than one %s"), orig_conf_key);
> +                       conf->key = xstrdup(value);
> +               } else if (type == TRAILER_COMMAND) {
> +                       if (conf->command)
> +                               warning(_("more than one %s"), orig_conf_key);
> +                       conf->command = xstrdup(value);
> +               } else if (type == TRAILER_WHERE) {
> +                       if (set_where(conf, value))
> +                               warning(_("unknow value '%s' for key '%s'"), value, orig_conf_key);

I realize that I forgot to s/unknow/unknown/. Sorry about that. It will be in the next version.

Show 12 quoted lines
> +               } else if (type == TRAILER_IF_EXIST) {
> +                       if (set_if_exist(conf, value))
> +                               warning(_("unknow value '%s' for key '%s'"), value, orig_conf_key);
> +               } else if (type == TRAILER_IF_MISSING) {
> +                       if (set_if_missing(conf, value))
> +                               warning(_("unknow value '%s' for key '%s'"), value, orig_conf_key);
> +               } else {
> +                       die("internal bug in trailer.c");
> +               }
> +       }
> +       return 0;
> +}
Previous: Christian CouderNext: Christian Couder
Message 5 of 17 in “Add interpret-trailers builtin”
  1. 0/9 Add interpret-trailers builtinChristian Couder, Dec 24, 2013
  2. 1/9 Add data structures and basic functions for commit trailersChristian Couder, Dec 24, 2013
  3. 2/9 trailer: process trailers from file and argumentsChristian Couder, Dec 24, 2013
  4. 3/9 trailer: read and process config informationChristian Couder, Dec 24, 2013
  5. Christian CouderDec 24, 2013
  6. 4/9 trailer: process command line trailer argumentsChristian Couder, Dec 24, 2013
  7. 5/9 strbuf: add strbuf_isspace()Christian Couder, Dec 24, 2013
  8. 6/9 trailer: parse trailers from input fileChristian Couder, Dec 24, 2013
  9. 7/9 trailer: put all the processing together and printChristian Couder, Dec 24, 2013
  10. 8/9 trailer: add interpret-trailers commandChristian Couder, Dec 24, 2013
  11. 9/9 trailer: add tests for "git interpret-trailers"Christian Couder, Dec 24, 2013
  12. Junio C HamanoDec 30, 2013
  13. Josh TriplettDec 30, 2013
  14. Junio C HamanoDec 30, 2013
  15. Josh TriplettDec 30, 2013
  16. Junio C HamanoDec 30, 2013
  17. Josh TriplettDec 30, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.