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

2014-03-18 Thread Eric Sunshine
On Mon, Mar 17, 2014 at 7:46 AM, Dragos Foianu wrote: > Eric Sunshine sunshineco.com> writes: >> Matthieu already mentioned [2] that this sort of "lego" string >> construction is not internationalization-friendly. See section 4.3 [3] >> of the gettext manual for details. > > I was hoping to get a

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

2014-03-17 Thread Ævar Arnfjörð Bjarmason
On Mon, Mar 17, 2014 at 12:46 PM, Dragos Foianu wrote: > The reason I did not go with this is because I would still need the four ifs > in order to keep the bug check part of the code. I might be able to find a > work-around for it on the second attempt. > > I have seen N_() used in other code but

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

2014-03-17 Thread Dragos Foianu
Eric Sunshine sunshineco.com> writes: > In fact, this change is not table-driven (emphasis on *driven*). It > merely moves the strings into a table, but all the logic is still in > the code. To be table-driven, the logic would be encoded in the table > as well, and that logic would *drive* the co

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

2014-03-17 Thread Eric Sunshine
Thanks for the submission. Comments below to give you a taste of the Git review process... On Sun, Mar 16, 2014 at 5:22 PM, Dragos Foianu wrote: > This patch uses a table-driven approach in order to make the code > cleaner. In fact, this change is not table-driven (emphasis on *driven*). It mere

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

2014-03-17 Thread Eric Sunshine
On Mon, Mar 17, 2014 at 3:23 AM, Matthieu Moy wrote: > Dragos Foianu writes: > >> + const char *verbose_prints[4] = { >> + "Branch %s set up to track remote branch %s from %s%s", >> + "Branch %s set up to track local branch %s%s", >> + "Branch %s set up to

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

2014-03-17 Thread Matthieu Moy
Dragos Foianu writes: > + const char *verbose_prints[4] = { > + "Branch %s set up to track remote branch %s from %s%s", > + "Branch %s set up to track local branch %s%s", > + "Branch %s set up to track remote ref %s%s", > + "Branch %s set up to

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

2014-03-16 Thread Dragos Foianu
This patch uses a table-driven approach in order to make the code cleaner. Although not necessary, it helps code reability by not forcing the user to read the print message when trying to understand what the code does. The rebase check has been moved to the verbose if statement to avoid making the