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

Re: [PATCH] git-status: Show empty directories

From
Kkonglu@minatec.inpg.fr <konglu@minatec.inpg.fr>
Date
Jun 10, 2012, 09:46 UTC
Message-ID
<20120610114615.Horde.Sp1YK3wdC4BP1GznJuNzcNA@webmail.minatec.grenoble-inp.fr>
In-Reply-To
<87haujr15p.fsf@thomas.inf.ethz.ch>
Thomas Rast <trast@student.ethz.ch> a écrit :
Show 15 quoted lines
>  - 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 :
Show 12 quoted lines
> 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.
Previous: Thomas RastNext: Leila
Message 8 of 17 in “git-status: Show empty directories”
  1. git-status: Show empty directoriesLeila Muhtasib, Jun 9, 2012
  2. konglu@minatec.inpg.frJun 9, 2012
  3. LeilaJun 9, 2012
  4. Thomas RastJun 9, 2012
  5. LeilaJun 9, 2012
  6. konglu@minatec.inpg.frJun 9, 2012
  7. Thomas RastJun 10, 2012
  8. konglu@minatec.inpg.frJun 10, 2012
  9. LeilaJun 10, 2012
  10. Junio C HamanoJun 11, 2012
  11. Junio C HamanoJun 10, 2012
  12. LeilaJun 10, 2012
  13. konglu@minatec.inpg.frJun 10, 2012
  14. LeilaJun 10, 2012
  15. Junio C HamanoJun 11, 2012
  16. LeilaJun 11, 2012
  17. LeilaJun 11, 2012

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.