From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-5.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id E188620798 for ; Sat, 14 Jan 2017 18:05:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751380AbdANSFy (ORCPT ); Sat, 14 Jan 2017 13:05:54 -0500 Received: from cloud.peff.net ([104.130.231.41]:39236 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750807AbdANSFy (ORCPT ); Sat, 14 Jan 2017 13:05:54 -0500 Received: (qmail 20548 invoked by uid 109); 14 Jan 2017 18:05:53 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.84) with SMTP; Sat, 14 Jan 2017 18:05:53 +0000 Received: (qmail 14346 invoked by uid 111); 14 Jan 2017 18:06:46 -0000 Received: from sigill.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.7) by peff.net (qpsmtpd/0.84) with SMTP; Sat, 14 Jan 2017 13:06:46 -0500 Received: by sigill.intra.peff.net (sSMTP sendmail emulation); Sat, 14 Jan 2017 13:05:50 -0500 Date: Sat, 14 Jan 2017 13:05:50 -0500 From: Jeff King To: Johannes Schindelin Cc: Junio C Hamano , git@vger.kernel.org, Kevin Daudt , Dennis Kaarsemaker , Stephan Beyer Subject: Re: [PATCH v3 01/38] sequencer: avoid unnecessary curly braces Message-ID: <20170114180550.ebra5qexewetuoyk@sigill.intra.peff.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Sat, Jan 14, 2017 at 06:57:13PM +0100, Johannes Schindelin wrote: > On Thu, 12 Jan 2017, Junio C Hamano wrote: > > > Johannes Schindelin writes: > > > > > > > > - if (!commit->parents) { > > > + if (!commit->parents) > > > parent = NULL; > > > - } > > > else if (commit->parents->next) { > > > /* Reverting or cherry-picking a merge commit */ > > > int cnt; > > > > The result becomes > > > > if (...) > > single statement; > > else if (...) { > > multiple; > > statements; > > } > > > > which is not quite an improvement. > > Yet, this used to be the coding style of Git, and your statement comes > quite as a surprise to me. Yeah, I thought we were OK with: if (cond) single statement; else { multiple; statements; } but not the other way around: if (cond) { multiple; statements; } else single statement; I don't know if the "else if" changes that or not, but I certainly have written things like your patch does. -Peff