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 7E15F1F55B for ; Fri, 15 May 2020 18:36:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726288AbgEOSg3 (ORCPT ); Fri, 15 May 2020 14:36:29 -0400 Received: from cloud.peff.net ([104.130.231.41]:48032 "HELO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726206AbgEOSg2 (ORCPT ); Fri, 15 May 2020 14:36:28 -0400 Received: (qmail 26130 invoked by uid 109); 15 May 2020 18:36:28 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with SMTP; Fri, 15 May 2020 18:36:28 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 14221 invoked by uid 111); 15 May 2020 18:36:28 -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; Fri, 15 May 2020 14:36:28 -0400 Authentication-Results: peff.net; auth=none Date: Fri, 15 May 2020 14:36:27 -0400 From: Jeff King To: Christian Couder Cc: git@vger.kernel.org, Junio C Hamano , Derrick Stolee , Taylor Blau , Jonathan Tan , Jonathan Nieder , Christian Couder Subject: Re: [PATCH 05/13] upload-pack: pass upload_pack_data to get_common_commits() Message-ID: <20200515183627.GJ3692649@coredump.intra.peff.net> References: <20200515100454.14486-1-chriscool@tuxfamily.org> <20200515100454.14486-6-chriscool@tuxfamily.org> <20200515181754.GE3692649@coredump.intra.peff.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200515181754.GE3692649@coredump.intra.peff.net> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Fri, May 15, 2020 at 02:17:54PM -0400, Jeff King wrote: > On Fri, May 15, 2020 at 12:04:46PM +0200, Christian Couder wrote: > > > As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' > > more thoroughly, let's pass 'struct upload_pack_data' to > > get_common_commits(), so that this function and the functions > > it calls can use all the fields of that struct in followup > > commits. > > This one is optional, I think. We're not removing any globals nor moving > towards removing any (I don't think), because we're really just > replacing two object_array parameters with the big data struct: > > > -static int get_common_commits(struct packet_reader *reader, > > - struct object_array *have_obj, > > - struct object_array *want_obj) > > +static int get_common_commits(struct upload_pack_data *data, > > + struct packet_reader *reader) > > I say "I don't think" because it's possible that get_common_commits() > could use one of the other fields (or pass it to another function) in a > later patch. But I don't see it. > > So I think one _could_ argue that it should continue to take the minimum > set of arguments it needs. I doubt it would ever be useful outside of the > context of upload_pack, so I think in practice it doesn't matter much > (beyond perhaps documenting which parts of the global data it needs). So > I don't feel strongly either way. OK, I take it back. I finally go to the spot later in the series where you use data->stateless_rpc, etc. So I think this is a positive movement. I think it might have been easier to review if the changes were made in the opposite order: globals removed and passed down the call stack, and then the big struct used to simplify passing the data around. But that would have been a lot more tedious to write (and perhaps to review, as I'd have made the opposite complaint ;) ). And definitely not worth doing now. -Peff