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

2014-02-23 Thread Christian Couder
From: Junio C Hamano gits...@pobox.com Junio C Hamano gits...@pobox.com 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

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

2014-02-20 Thread Junio C Hamano
Junio C Hamano gits...@pobox.com writes: Junio C Hamano gits...@pobox.com 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.

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

2014-02-14 Thread Christian Couder
From: Junio C Hamano gits...@pobox.com 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

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

2014-02-14 Thread Junio C Hamano
Christian Couder chrisc...@tuxfamily.org 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 =

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

2014-02-14 Thread Christian Couder
From: Junio C Hamano gits...@pobox.com Christian Couder chrisc...@tuxfamily.org 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

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 didn't want us to

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

2014-02-14 Thread Junio C Hamano
Christian Couder chrisc...@tuxfamily.org 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

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

2014-02-14 Thread Junio C Hamano
Junio C Hamano gits...@pobox.com 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

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 gits...@pobox.com wrote: Christian Couder chrisc...@tuxfamily.org 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

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

2014-02-11 Thread Junio C Hamano
Christian Couder christian.cou...@gmail.com 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

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

2014-02-10 Thread Junio C Hamano
Christian Couder chrisc...@tuxfamily.org 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:

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

2014-02-10 Thread Christian Couder
From: Junio C Hamano gits...@pobox.com Subject: Re: [PATCH v5 02/14] trailer: process trailers from file and arguments Date: Mon, 10 Feb 2014 10:14:34 -0800 Christian Couder chrisc...@tuxfamily.org writes: This is what if_exists and if_missing are all about. Either: the same key

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

2014-02-10 Thread Junio C Hamano
Christian Couder chrisc...@tuxfamily.org 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

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

2014-02-09 Thread Christian Couder
From: Junio C Hamano gits...@pobox.com Christian Couder chrisc...@tuxfamily.org writes: +static void apply_arg_if_exist(struct trailer_item *infile_tok, + struct trailer_item *arg_tok, + int alnum_len) +{ +switch

[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

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

2014-02-06 Thread Junio C Hamano
Christian Couder chrisc...@tuxfamily.org 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