git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Mar 12, 2014, 22:49 UTC
Message-ID
<CAPig+cRviwyxDa3xNt6JgmRURFC-AbLRS8NnBQ4SAnm3g=Cc7g@mail.gmail.com>
In-Reply-To
<xmqqob1bjcti.fsf@gitster.dls.corp.google.com>
On Wed, Mar 12, 2014 at 6:02 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 18 quoted lines
> Eric Sunshine <sunshine@sunshineco.com> writes:
>
>>> +               if (origin && remote_is_branch)
>>> +                       printf_ln(_(message[!remote_is_branch][!origin][!rebasing]),
>>> +                               local, name, origin);
>>>                 else
>>> -                       die("BUG: impossible combination of %d and %p",
>>> -                           remote_is_branch, origin);
>>> +                       printf_ln(_(message[!remote_is_branch][!origin][!rebasing]),
>>> +                               local, name);
>>
>> Shouldn't this logic also be encoded in the table? After all, the
>> point of making the code table-driven is so that such hard-coded logic
>> can be avoided. It shouldn't be difficult to do.
>
> Hmph.  Is it even necessary in the first place?  Does it hurt if you
> give more parameters than the number of placeholders in the format
> string?

It's not necessary, which is why my question was posed: as a clue. By asking GSoC applicants to think about how the logic can be table-driven, it is hoped that they will arrive at the realization that it is okay to pass in more parameters than placeholders. With that idea in mind, the code can be simplified whether table-driven or not.

(I suspect Michael had this in mind when he composed this GSoC microproject and asked students to consider if it would make sense to make the code table-driven.)

Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 7 in “install_branch_config: simplify verbose messages logic”
  1. install_branch_config: simplify verbose messages logicPaweł Wawruch, Mar 12, 2014
  2. Eric SunshineMar 12, 2014
  3. Junio C HamanoMar 12, 2014
  4. Eric SunshineMar 12, 2014
  5. Junio C HamanoMar 13, 2014
  6. Eric SunshineMar 13, 2014
  7. Eric SunshineMar 13, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.