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 :)