Re: [PATCH v6 01/10] ref-filter: introduce 'ref_formatting_state'

2015-07-30 Thread Karthik Nayak
On Thu, Jul 30, 2015 at 12:49 AM, Eric Sunshine sunsh...@sunshineco.com wrote: On Tuesday, July 28, 2015, Karthik Nayak karthik@gmail.com wrote: Introduce 'ref_formatting' structure to hold values of pseudo atoms which help only in formatting. This will eventually be used by atoms like

Re: [PATCH v6 01/10] ref-filter: introduce 'ref_formatting_state'

2015-07-30 Thread Karthik Nayak
On Thu, Jul 30, 2015 at 1:24 AM, Junio C Hamano gits...@pobox.com wrote: Actually, I think it is wrong to have this function in the first place. It is a sign that the caller is doing too little before calling this function. If the act of printing an atom uses the formatting state that says

Re: [PATCH v6 01/10] ref-filter: introduce 'ref_formatting_state'

2015-07-30 Thread Matthieu Moy
Junio C Hamano gits...@pobox.com writes: If the act of printing an atom uses the formatting state that says next one needs X, then it is responsible to clear that next one needs X part of the state, as it is the one who consumed that state. E.g. if it used to say next one needs to be padded

Re: [PATCH v6 01/10] ref-filter: introduce 'ref_formatting_state'

2015-07-29 Thread Karthik Nayak
On Tue, Jul 28, 2015 at 12:56 PM, Matthieu Moy matthieu@grenoble-inp.fr wrote: Karthik Nayak karthik@gmail.com writes: -static void print_value(struct atom_value *v, int quote_style) +static void apply_formatting_state(struct ref_formatting_state *state, +

Re: [PATCH v6 01/10] ref-filter: introduce 'ref_formatting_state'

2015-07-29 Thread Matthieu Moy
Karthik Nayak karthik@gmail.com writes: Ah, I hate making grammatical errors, Even though I check it always gets away. Anyways waiting for Junio and others to reply on this version. Could do a resend for this series if needed. If you took all my remarks into account, I think it's worth

Re: [PATCH v6 01/10] ref-filter: introduce 'ref_formatting_state'

2015-07-29 Thread Junio C Hamano
Eric Sunshine sunsh...@sunshineco.com writes: @@ -1254,9 +1273,26 @@ static void emit(const char *cp, const char *ep) +static void reset_formatting_state(struct ref_formatting_state *state) +{ + int quote_style = state-quote_style; + memset(state, 0, sizeof(*state)); +

Re: [PATCH v6 01/10] ref-filter: introduce 'ref_formatting_state'

2015-07-29 Thread Junio C Hamano
Eric Sunshine sunsh...@sunshineco.com writes: @@ -1254,9 +1273,26 @@ static void emit(const char *cp, const char *ep) +static void reset_formatting_state(struct ref_formatting_state *state) +{ + int quote_style = state-quote_style; + memset(state, 0, sizeof(*state)); +

Re: [PATCH v6 01/10] ref-filter: introduce 'ref_formatting_state'

2015-07-29 Thread Matthieu Moy
Eric Sunshine sunsh...@sunshineco.com writes: @@ -1254,9 +1273,26 @@ static void emit(const char *cp, const char *ep) +static void reset_formatting_state(struct ref_formatting_state *state) +{ + int quote_style = state-quote_style; + memset(state, 0, sizeof(*state)); +

[PATCH v6 01/10] ref-filter: introduce 'ref_formatting_state'

2015-07-29 Thread Eric Sunshine
On Tuesday, July 28, 2015, Karthik Nayak karthik@gmail.com wrote: Introduce 'ref_formatting' structure to hold values of pseudo atoms which help only in formatting. This will eventually be used by atoms like `color` and the `padright` atom which will be introduced in a later patch. Isn't

Re: [PATCH v6 01/10] ref-filter: introduce 'ref_formatting_state'

2015-07-28 Thread Matthieu Moy
Karthik Nayak karthik@gmail.com writes: -static void print_value(struct atom_value *v, int quote_style) +static void apply_formatting_state(struct ref_formatting_state *state, +struct atom_value *v, struct strbuf *value) { - struct strbuf sb =

[PATCH v6 01/10] ref-filter: introduce 'ref_formatting_state'

2015-07-28 Thread Karthik Nayak
Introduce 'ref_formatting' structure to hold values of pseudo atoms which help only in formatting. This will eventually be used by atoms like `color` and the `padright` atom which will be introduced in a later patch. Helped-by: Junio C Hamano gits...@pobox.com Mentored-by: Christian Couder