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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 24, 2013 at 7:37 AM, Christian Couder
<chriscool@xxxxxxxxxxxxx> wrote:
>
> +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.

> +               } 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;
> +}
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]