Re: [PATCH v5 02/14] trailer: process trailers from file and arguments
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 14, 2014, 23:57 UTC
- Message-ID
- <xmqqtxc1fdsk.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <20140214.224133.484636406629780362.chriscool@tuxfamily.org>
Christian Couder <chriscool@tuxfamily.org> writes:
Show 17 quoted lines
> 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.