From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by dcvr.yhbt.net (Postfix) with ESMTP id 4A4BD1F542 for ; Thu, 1 Jun 2023 17:47:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233097AbjFARrt (ORCPT ); Thu, 1 Jun 2023 13:47:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231298AbjFARrs (ORCPT ); Thu, 1 Jun 2023 13:47:48 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABAA013D for ; Thu, 1 Jun 2023 10:47:47 -0700 (PDT) Received: (qmail 6052 invoked by uid 109); 1 Jun 2023 17:47:47 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Thu, 01 Jun 2023 17:47:47 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 25356 invoked by uid 111); 1 Jun 2023 17:47:46 -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, 01 Jun 2023 13:47:46 -0400 Authentication-Results: peff.net; auth=none Date: Thu, 1 Jun 2023 13:47:46 -0400 From: Jeff King To: Derrick Stolee Cc: Elijah Newren , Derrick Stolee via GitGitGadget , git@vger.kernel.org, vdye@github.com, me@ttaylorr.com, gitster@pobox.com Subject: Re: [PATCH 1/3] repository: create disable_replace_refs() Message-ID: <20230601174746.GA4165405@coredump.intra.peff.net> References: <56544abc15d1fce6fb4a0946e709470af9225395.1685126618.git.gitgitgadget@gmail.com> 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 Wed, May 31, 2023 at 09:37:10AM -0400, Derrick Stolee wrote: > > In this place and several others in the file, you opt to not just > > replace the assignment with a function call, but move the action line > > to later in the file. In some cases, much later. > > > > I don't think it hurts things, but it certainly makes me wonder why it > > was moved. Did it break for some reason when called earlier? (Is > > there something trickier about this patch than I expected?) > > Generally, I decided to move it after option-parsing, so it wouldn't > be called if we are hitting an option-parse error. Playing devil's advocate: would option parsing ever access an object? I think in most cases the answer is no, but I could imagine it happening for some special cases (e.g., update-index uses callbacks to act on options as we parse them, since order is important). So I think as a general principle it makes sense for commands to set this flag as early as possible. > However, these moves were only important for a draft version where > I had not separated the global and local scopes, so calling the method > would also load config. > > In this version of the patch, this is not needed at all, and I could > do an in-line replacement. Thanks! It sounds like you were going to switch the locations back anyway, but maybe the above gives an extra motivation. :) -Peff