Subject: Re: [PATCH v5 02/14] trailer: process trailers from file and arguments

From: Junio C Hamano <[email-masked]>
Date: Fri, 14 Feb 2014 15:57:31 -0800

Christian Couder <[email-masked]> writes:

> but we also want to say:
>
>     action = do_Y_if_X_and_Z AND do_U_if_V
>
> For example some people might want:
>
>     if_exists = overwrite
>     if_missing = add
>
> while others might want:
>
>     if_exists = overwrite
>     if_missing = do_nothing
>
> and I don't see how we can say that with just:
>
>     action = do_Y_if_X_and_Z

That is a very relevant illustration that makes me realize why I
found your "if-exists/if-missing = do-Y-if-Z" somewhat distasteful.

Your

     if_exists = add_if_different

says "if the same key is there, add it if the value is different",
but it also implicitly says "donothing if the value is the same".

That is, you are saying with the above

     if_exists = add_if_different AND ignore_if_same

So you already have to support more than one actions depending on
the condition, unless you want to limit the actions for all the
cases other than X to be only "ignore" when you invent your next
"do_Y_if_X", X being "different" in this case, but you support (and
need to support) "different-neighbour" and other random collections
of conditions, I think.  Which is essentially the same as saying
that you need this:

>     action = do_Y_if_X_and_Z AND do_U_if_V

Again, unless all the U's are limited to "ignore", that is.