Re: [PATCH] fetch-pack: fix unadvertised requests validation
- From
Jeff King <peff@peff.net>
- Date
- Feb 27, 2016, 19:19 UTC
- Message-ID
- <20160227191943.GD12822@sigill.intra.peff.net>
- In-Reply-To
- <20160227190712.GC12822@sigill.intra.peff.net>
On Sat, Feb 27, 2016 at 02:07:12PM -0500, Jeff King wrote:
Show 7 quoted lines
> We expect whoever creates the "sought" list to fill in the name and sha1 > as appropriate. If that is not happening in some code path, then yeah, > filter_refs() will not work as intended. But I think the solution there > would be to fix the caller to set up the "struct ref" more completely. > > Gabriel, did this come from a bug you noticed in practice, or was it > just an intended cleanup?
I double-checked that the code for git-fetch does so. It's in get_fetch_map()
if (refspec->exact_sha1) {
ref_map = alloc_ref(name);
get_oid_hex(name, &ref_map->old_oid);
} else ...So we should always have old_oid filled in already, and there is no need to do so in filter_refs() (and in fact it is wrong, for the degenerate example I gave earlier).
-Peff