Re: [PATCH 6/6] send-pack: support push negotiation
- From
- Jonathan Tan <jonathantanmy@google.com>
- Date
- May 3, 2021, 22:02 UTC
- Message-ID
- <20210503220244.2878522-1-jonathantanmy@google.com>
- In-Reply-To
- <c2780570-81ec-bede-2f4e-75748b788bbb@gmail.com>
[snip asking about whether extra_have (a.k.a. advertised) and commons (a.k.a. negotiated) can be merged]
Show 11 quoted lines
> Here, it would be nice if extra_have and commons were merged before calling > pack_objects(). I mentioned a way to perhaps make that easier above, but > the context might not make that be super-simple. Running a loop here to > scan 'commons' and append them to 'extra_have' might be a sufficient > approach. > > Generally, this approach seems like it would work. I have not done any > local testing, yet. > > Thanks, > -Stolee
I was reluctant to merge them because that would involve either (1) adding commons to "extra_have" (as you suggest) or (2) iterating through "extra_have" in order to add it to the "commons" set. For (1), this would modify "extra_have", which is passed in from the outside. Looking at its callers, the main one in git_transport_push() in transport.c calls send_pack() with a set that has traversed the transport API, so I think it would be confusing if such a set suddenly changed. For (2), the extra loop seems more troublesome than having two parameters with clearer names indicating where they come from. I don't mind changing to (2), though, if people want it.