Re: [PATCH] git-status: Show empty directories
- From
Leila <muhtasib@gmail.com>
- Date
- Jun 10, 2012, 14:20 UTC
- Message-ID
- <CAA3EhHKORv3n9b4Ln1L36_ETZVjEqrZeutKiK0ML=u3ecrqJ0g@mail.gmail.com>
- In-Reply-To
- <20120610114615.Horde.Sp1YK3wdC4BP1GznJuNzcNA@webmail.minatec.grenoble-inp.fr>
On Sun, Jun 10, 2012 at 5:46 AM, <konglu@minatec.inpg.fr> wrote:
Show 37 quoted lines
>
> Thomas Rast <trast@student.ethz.ch> a écrit :
>
>> - We avoid using braces unnecessarily. I.e.
>>
>> if (bla) {
>> x = 1;
>> }
>>
>> is frowned upon. A gray area is when the statement extends
>> over a few lines, and/or you have a lengthy comment atop of
>> it. Also, like in the Linux kernel, if there is a long list
>> of "else if" statements, it can make sense to add braces to
>> single line blocks.
>>
>> I'm not the one who wrote them, but I'm taking the last sentence to mean
>> that you should not put the braces unless the omission will break the
>> vertical alignment of the 'else if' chain.
>
>
> I agree with you and that's what I thought. Still
>
> Junio C Hamano <gitster@pobox.com> a écrit :
>
>> Two points on style (also appear elsewhere in this patch):
>>
>> if (!"applying") {
>> ...
>> } else {
>> state->rebase_in_progress = 1;
>> }
>>
>> - "else" comes on the same line as closing "}" of its "if" block;
>>
>> - if one of if/else if/else chain has multiple statement block, use {}
>> even for a single statement block in the chain.
>I'm happy to produce a patch to update the documentation if there is consensus to avoid using braces unnecessarily for if statements with one line, but not in the case that there is {} used in a if/else chain. Thomas, Lucien, are you on board?