Thread (1 message) 1 message, 1 author, 2016-06-15

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:59:55

Christian Couder [off-list ref] 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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help