Re: [PATCH v5 02/14] trailer: process trailers from file and arguments
- From
Christian Couder <chriscool@tuxfamily.org>
- Date
- Feb 14, 2014, 21:41 UTC
- Message-ID
- <20140214.224133.484636406629780362.chriscool@tuxfamily.org>
- In-Reply-To
- <xmqqa9dxr09k.fsf@gitster.dls.corp.google.com>
From: Junio C Hamano <gitster@pobox.com>
Show 7 quoted lines
> > These numerous questions you have to ask are indications why > choosing "this condition goes to the left hand side of the equal > sign (e.g. exists)" and "this condition goes to the right hand side > (e.g. do-this-if_neighbor)" is not working well. The user has to > remember which conditions go to the variable name and which > conditions go to the action part.
If we limit it to "if_exists" and "if_missing", the user can remember that without things becoming too complex.
> That is, not splitting the logic into two parts like you did, > i.e. "if_X = do_Y_if_Z", which invites "why is it not if_true = > do_Y_if_X_and_Z, if_X_and_Z = do_Y, if_Z = do_Y_if_X"?
It perhaps invite it, but there are reasons why splitting the logic too much is not a good idea and why limiting the split to "if_exists" and "if_missing" is a good tradeoff.
> One possible way to avoid the confusion is to say "do_Y_if_X_and_Z" > without making the rule split into conditions and actions---I am > NOT saying that is _better_, there may be other solutions to avoid > this two-part logic in a cleaner way.
This has been discussed first last November and I don't think that a solution better than what I implemented has been suggested.
The problem is we not only want to say:
action = do_Y_if_X_and_Z
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 = addwhile others might want:
if_exists = overwrite
if_missing = do_nothingand I don't see how we can say that with just:
action = do_Y_if_X_and_Z
Thanks, Christian.