Web lists-archives.com

Re: [PATCH 3/3] interpret-trailers: add options for actions




On Wed, 12 Jul 2017 15:46:46 +0200
Paolo Bonzini <bonzini@xxxxxxx> wrote:

> +static int option_parse_where(const struct option *opt,
> +			      const char *arg, int unset)
> +{
> +	enum action_where *where = opt->value;
> +
> +	if (unset)
> +		return 0;
> +
> +	return set_where(where, arg);
> +}

This means that we have the following:

    $ cat message
    Hello

    a: a

    $ ./git interpret-trailers --trailer a=b message
    Hello

    a: a
    a: b

    $ ./git interpret-trailers --where start --no-where --trailer a=b message
    Hello

    a: b
    a: a

When I would expect the last 2 commands to produce the same output. Maybe
invoke set_where(where, NULL) when "unset" is true? And change set_where()
accordingly. Same for the other two option parsing functions.