Re: [RFC PATCH] index-pack: optionally allow duplicate objects
Taylor Blau <[email protected]> Wed, 29 Jul 2026 16:29:04 -0500
| Newsgroups | org.kernel.vger.git |
|---|---|
| Message-ID | <ampwoImYYKeYzkw7@com-79390> |
On Wed, Jul 29, 2026 at 02:17:16PM -0700, [email protected] wrote: > From: Friel <[email protected]> > > On Wed, Jul 29, 2026 at 01:32:39PM -0700, Junio C Hamano wrote: > > > I can live with such an extension as long as we teach the receiving > > end to deduplicate the extra copy. > > That makes sense. We don't want packs containing duplicate objects to > become a persistent source of duplicate objects in other repositories. > > For our server, duplicate objects would be an exceptional consequence of > an optimization, not normal operation. We have not seen duplicates in > practice yet. But preventing them imposes a cost on every upload-pack > request even when duplicates are rare. To Junio's point about "these cannot go forever unchecked", I agree, and I think this is an important internal detail which I may not have made clear. We don't expect to send packs containing duplicate objects as a general case, but this patch and my series are a defensive measure to make sure clients don't immediately choke on them. > I'll talk with Taylor about whether the client should repack when it > detects duplicates, or whether Git already has a way to mark such a pack > as dirty for reuse or retransmission until it has been cleaned up. > The intent would be to pay that cost only when duplicates actually > occur. Let me think a little bit more about this. It would be a shame to have to repack the entirety of the pack when there are only a few (or zero) duplicate object entries. But if we can efficiently pluck them out of the stream when fetching/cloning, that may be worthwhile. FWIW, (and I'm biased, but) I still think the series this patch is based on is worth picking up. I think it makes sense to have better support when we *do* happen to see duplicate objects (e.g., to recover the only good copy of some object you have, similar to Peff's argument quoted earlier in the thread). But "better support" can coexist with "...you still shouldn't do this". > In all humility, thank you for reviewing and considering the RFC PATCH. > I'm still getting acquainted with mailing list and the history of Git, > and I'm happy to have Taylor & Ted's help. Thanks for saying that. Welcome to the list :-). Thanks, Taylor