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

2014-03-21 Thread Junio C Hamano
Dragos Foianu 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 of the candidate selec

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 wrote: > On Wed, Mar 19, 2014 at 7:12 PM, Dragos Foianu > wrote: >> Eric Sunshine sunshineco.com> writes: >>> On Tue, Mar 18, 2014 at 6:31 PM, Eric Sunshine >> sunshineco.com> wrote: >>> >>> One other observation: You have a one-off error in your

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 wrote: > Eric Sunshine sunshineco.com> writes: >> On Tue, Mar 18, 2014 at 6:31 PM, Eric Sunshine > sunshineco.com> wrote: >> >> One other observation: You have a one-off error in your out-of-bounds >> check. It should be 'index >= sizeof...' > > Wel

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

2014-03-19 Thread Dragos Foianu
Eric Sunshine 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 = !!orig

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 wrote: > On Mon, Mar 17, 2014 at 11:51 AM, Dragos Foianu > 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 and p

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 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 and prints the messa

[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 ha