From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 76D1C1FB0A for ; Thu, 3 Dec 2020 18:36:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729791AbgLCScr (ORCPT ); Thu, 3 Dec 2020 13:32:47 -0500 Received: from cloud.peff.net ([104.130.231.41]:50454 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729629AbgLCScq (ORCPT ); Thu, 3 Dec 2020 13:32:46 -0500 Received: (qmail 13626 invoked by uid 109); 3 Dec 2020 18:32:06 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Thu, 03 Dec 2020 18:32:06 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 3414 invoked by uid 111); 3 Dec 2020 18:32:05 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Thu, 03 Dec 2020 13:32:05 -0500 Authentication-Results: peff.net; auth=none Date: Thu, 3 Dec 2020 13:32:05 -0500 From: Jeff King To: Junio C Hamano Cc: git@vger.kernel.org Subject: Re: [PATCH] style: indent multiline "if" conditions by 4 spaces Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Thu, Dec 03, 2020 at 10:22:35AM -0800, Junio C Hamano wrote: > Jeff King writes: > > > Commit 6dc905d974 (config: split repo scope to local and worktree, > > 2020-02-10) made some "if" statements multiline, but didn't indent the > > second lines in our usual way. > > > > Signed-off-by: Jeff King > > --- > > I just happened to be reading nearby code and saw this. > > Can we rephrase "by 4 spaces" to avoid misleading new developers, > though? It's not like our rule is to indent continued expression by > 4 spaces---it happens to be 4 in this case only because the second > line is aligned with the column inside "if (". > > If the expression were > > if ((A == X && B == Y && > boolean_expression_on_the_second_line()) || > C == Z) > > we would have indented the second line to align with the inside of > the opening parenthesis, which may end up with "by 5 spaces", but > four vs five is not the important part of the equation. Yeah, the goal is to align it, but I had trouble thinking of a succinct way to say that. Maybe just: style: align indent of multiline "if" conditions ? -Peff