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

2014-02-23 Thread Christian Couder
From: Junio C Hamano > > Junio C Hamano writes: > > Having said all that, it appears that nobody seems to be able to > come up with a saner arrangement that would not paint us into a > tough corner that we would not be able to later escape from without > being backward incompatible---I certainly

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

2014-02-20 Thread Junio C Hamano
Junio C Hamano writes: > Junio C Hamano writes: > > What is the right mental model the end-user needs to form when > understanding these? Conditions on keys go on the left, and any > other random conditions can come as a modifier after action > e.g. add_if_same_value_is_not_at_the_end? Having

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

2014-02-14 Thread Junio C Hamano
Junio C Hamano writes: > 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, ... > of conditions, I think. Which is essentially the same as saying > that you need th

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

2014-02-14 Thread Junio C Hamano
Christian Couder 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

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

2014-02-14 Thread Junio C Hamano
>> For example, how would you express something like this only with >> "if-exists" vs "if-missing"? >> >> if_exists_exactly = ignore >> if_exists_with_different_value = append >> if_missng = prepend_to_the_beginning > > First, previously in the discussion you said that you did

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

2014-02-14 Thread Christian Couder
From: Junio C Hamano > > Christian Couder writes: > >> 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: >>

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

2014-02-14 Thread Junio C Hamano
Christian Couder writes: > 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 Yes, bu

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

2014-02-14 Thread Christian Couder
From: Junio C Hamano > > 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 > remem

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

2014-02-11 Thread Junio C Hamano
Christian Couder writes: >> Even if we assume, for the sake of discussion, that it *is* a good >> idea to separate "under this condition" part and "do this" part, I >> do not think the above is the only or the best way to express >> "distinct values allowed for the same key". How do we argue tha

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

2014-02-11 Thread Christian Couder
On Mon, Feb 10, 2014 at 9:51 PM, Junio C Hamano wrote: > Christian Couder writes: > >> Many entries with the same key but distinct values can be configured >> using: >> >> if_exists = add_if_different >> if_missing = add >> >> Many entries with the same key but values that can be the same can be

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

2014-02-10 Thread Junio C Hamano
Christian Couder writes: > Many entries with the same key but distinct values can be configured > using: > > if_exists = add_if_different > if_missing = add > > Many entries with the same key but values that can be the same can be > configured using: > > if_exists = add > if_missing = add While

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

2014-02-10 Thread Christian Couder
From: Junio C Hamano Subject: Re: [PATCH v5 02/14] trailer: process trailers from file and arguments Date: Mon, 10 Feb 2014 10:14:34 -0800 > Christian Couder writes: > >> This is what "if_exists" and "if_missing" are all about. >> >> Either: >>

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

2014-02-10 Thread Junio C Hamano
Christian Couder writes: > This is what "if_exists" and "if_missing" are all about. > > Either: > > the same key already exists regardless of the value > > and, in this case, what happens depends on what has been specified using > the "if_exists" configuration variable. > > Or: > > th

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

2014-02-09 Thread Christian Couder
From: Junio C Hamano > > Christian Couder writes: > >> +static void apply_arg_if_exist(struct trailer_item *infile_tok, >> + struct trailer_item *arg_tok, >> + int alnum_len) >> +{ >> +switch (arg_tok->conf->if_exist) { >> +case EXIST_D

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

2014-02-06 Thread Junio C Hamano
Christian Couder writes: > This patch implements the logic that process trailers > from file and arguments. > > At the beginning trailers from file are in their own > infile_tok doubly linked list, and trailers from > arguments are in their own arg_tok doubly linked list. > > The lists are traver

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

2014-02-06 Thread Christian Couder
This patch implements the logic that process trailers from file and arguments. At the beginning trailers from file are in their own infile_tok doubly linked list, and trailers from arguments are in their own arg_tok doubly linked list. The lists are traversed and when an arg_tok should be "applie