Re: [PATCH v4] install_branch_config: simplify verbose messages logic

2014-03-13 Thread Eric Sunshine
On Thu, Mar 13, 2014 at 4:35 PM, Eric Sunshine wrote: > A more table-driven approach might look something > like this: > > struct M { const char *s; const char **a1; const char **a2; } > message[][2][2] = {{{ > { "Branch %s set ... %s ... %s", &shortname, &origin }, > ... >

Re: [PATCH v4] install_branch_config: simplify verbose messages logic

2014-03-13 Thread Eric Sunshine
On Thu, Mar 13, 2014 at 2:34 PM, Junio C Hamano wrote: > Eric Sunshine writes: > >> Shouldn't this logic [to decide what the printf arguments should >> be] also be encoded in the table? >> ... >> The same argument also applies to computation of the 'name' variable >> above. It too can be pushed i

Re: [PATCH v4] install_branch_config: simplify verbose messages logic

2014-03-13 Thread Junio C Hamano
Eric Sunshine writes: > Shouldn't this logic [to decide what the printf arguments should > be] also be encoded in the table? > ... > The same argument also applies to computation of the 'name' variable > above. It too can be pushed into the the table. Because the "printf argument" logic does not

Re: [PATCH v4] install_branch_config: simplify verbose messages logic

2014-03-12 Thread Eric Sunshine
On Wed, Mar 12, 2014 at 6:02 PM, Junio C Hamano wrote: > Eric Sunshine writes: > >>> + if (origin && remote_is_branch) >>> + >>> printf_ln(_(message[!remote_is_branch][!origin][!rebasing]), >>> + local, name, origin); >>>

Re: [PATCH v4] install_branch_config: simplify verbose messages logic

2014-03-12 Thread Junio C Hamano
Eric Sunshine writes: >> + if (origin && remote_is_branch) >> + >> printf_ln(_(message[!remote_is_branch][!origin][!rebasing]), >> + local, name, origin); >> else >> - die("BUG: impossible com

Re: [PATCH v4] install_branch_config: simplify verbose messages logic

2014-03-11 Thread Eric Sunshine
On Tue, Mar 11, 2014 at 8:33 PM, Paweł Wawruch wrote: > Replace the chain of if statements with table of strings. > > Signed-off-by: Paweł Wawruch > --- > The changes proposed by Junio C Hamano: > Improvement of indentations. Removed an unused variable. Better, thanks. More below. > [1]: http:/

[PATCH v4] install_branch_config: simplify verbose messages logic

2014-03-11 Thread Paweł Wawruch
Replace the chain of if statements with table of strings. Signed-off-by: Paweł Wawruch --- The changes proposed by Junio C Hamano: Improvement of indentations. Removed an unused variable. [1]: http://thread.gmane.org/gmane.comp.version-control.git/243502 [2]: http://thread.gmane.org/gmane.comp.v