Re: [PATCHv2] branch.c: simplify chain of if statements

2014-03-21 Thread Junio C Hamano
Dragos Foianu dragos.foi...@gmail.com writes: I'm not sure it's worth pursuing the table approach further, especially since a solution has already been accepted and merged into the codebase. Yes. I would further say that you already qualify as having finished a microproject, if I were a part

Re: [PATCHv2] branch.c: simplify chain of if statements

2014-03-20 Thread Eric Sunshine
On Wed, Mar 19, 2014 at 7:12 PM, Dragos Foianu dragos.foi...@gmail.com wrote: Eric Sunshine sunshine at sunshineco.com writes: On Tue, Mar 18, 2014 at 6:31 PM, Eric Sunshine sunshine at sunshineco.com wrote: One other observation: You have a one-off error in your out-of-bounds check. It

Re: [PATCHv2] branch.c: simplify chain of if statements

2014-03-20 Thread Eric Sunshine
On Thu, Mar 20, 2014 at 8:40 PM, Eric Sunshine sunsh...@sunshineco.com wrote: On Wed, Mar 19, 2014 at 7:12 PM, Dragos Foianu dragos.foi...@gmail.com wrote: Eric Sunshine sunshine at sunshineco.com writes: On Tue, Mar 18, 2014 at 6:31 PM, Eric Sunshine sunshine at sunshineco.com wrote: One

Re: [PATCHv2] branch.c: simplify chain of if statements

2014-03-19 Thread Dragos Foianu
Eric Sunshine sunshine at sunshineco.com writes: Other submissions have computed this value mathematically without need for conditionals. For instance, we've seen: index = (!!origin 0) + (!!remote_is_branch 1) + (!!rebasing 2) as, well as the equivalent: index = !!origin +

Re: [PATCHv2] branch.c: simplify chain of if statements

2014-03-18 Thread Eric Sunshine
Thanks for the resubmission. Comments below... On Mon, Mar 17, 2014 at 11:51 AM, Dragos Foianu dragos.foi...@gmail.com wrote: This patch uses a table to store the different messages that can be emitted by the verbose install_branch_config function. It computes an index based on the three flags

Re: [PATCHv2] branch.c: simplify chain of if statements

2014-03-18 Thread Eric Sunshine
On Tue, Mar 18, 2014 at 6:31 PM, Eric Sunshine sunsh...@sunshineco.com wrote: On Mon, Mar 17, 2014 at 11:51 AM, Dragos Foianu dragos.foi...@gmail.com wrote: This patch uses a table to store the different messages that can be emitted by the verbose install_branch_config function. It computes

[PATCHv2] branch.c: simplify chain of if statements

2014-03-17 Thread Dragos Foianu
This patch uses a table to store the different messages that can be emitted by the verbose install_branch_config function. It computes an index based on the three flags and prints the message located at the specific index in the table of messages. If the index somehow is not within the table, we