Re: [PATCH 05/13] upload-pack: pass upload_pack_data to get_common_commits()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux