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

Re: [PATCH][GSoC] branch.c:install_branch_config Simplified long chain of if statements

From
Vincenzo di Cicco <enzodicicco@gmail.com>
Date
Mar 10, 2014, 23:55 UTC
Message-ID
<CAKOJyXcVM0xujy8yCMnOies_67CyWf1GgQ807rszXYxqf1JA5Q@mail.gmail.com>
In-Reply-To
<CAPig+cRZyvrPL69eunsV89-AycF=TWeN8x5cUvBhcF0MLVvOog@mail.gmail.com>

Thank you very much for the answer! I've learned a lot in this few rows.

Show 8 quoted lines
> If we take the time to trace through the code, we can see that
> remote_is_branch is indeed either 0 or 1, thus this expression is safe
> today, however, if the implementation of starts_with() ever changes so
> that it returns a value other than 1 for true, then this code will
> break. To avoid such breakage, and to avoid placing burden of tracing
> code, you might instead write the expression as:
>
>     location = locations[!!origin][!!remote_is_branch];

Thanks for the good tip. I've erroneously assumed that starts_with() never will change.

> This approach of composing strings is problematic for translation,
> which is why the GSoC microproject states:

Thanks to show me this issue. I've read the other thread and understood the problem.

I will do better in future :)
Previous: Eric Sunshine
Message 3 of 3 in “[GSoC] branch.c:install_branch_config Simplified long chain of if statements”
  1. [GSoC] branch.c:install_branch_config Simplified long chain of if statementsVincenzo di Cicco, Mar 10, 2014
  2. Eric SunshineMar 10, 2014
  3. Vincenzo di CiccoMar 10, 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.