From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff King Subject: Re: [PATCH] fetch-pack: fix unadvertised requests validation Date: Sat, 27 Feb 2016 14:19:44 -0500 Message-ID: <20160227191943.GD12822@sigill.intra.peff.net> References: <1456577034-6494-1-git-send-email-gabrielfrancosouza@gmail.com> <20160227190712.GC12822@sigill.intra.peff.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: git@vger.kernel.org, Gabriel Souza Franco To: Junio C Hamano X-From: git-owner@vger.kernel.org Sat Feb 27 20:19:52 2016 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aZkP9-0000ls-GL for gcvg-git-2@plane.gmane.org; Sat, 27 Feb 2016 20:19:51 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756736AbcB0TTr (ORCPT ); Sat, 27 Feb 2016 14:19:47 -0500 Received: from cloud.peff.net ([50.56.180.127]:50816 "HELO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751389AbcB0TTr (ORCPT ); Sat, 27 Feb 2016 14:19:47 -0500 Received: (qmail 1615 invoked by uid 102); 27 Feb 2016 19:19:46 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.84) with SMTP; Sat, 27 Feb 2016 14:19:46 -0500 Received: (qmail 14939 invoked by uid 107); 27 Feb 2016 19:19:56 -0000 Received: from sigill.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.7) by peff.net (qpsmtpd/0.84) with SMTP; Sat, 27 Feb 2016 14:19:56 -0500 Received: by sigill.intra.peff.net (sSMTP sendmail emulation); Sat, 27 Feb 2016 14:19:44 -0500 Content-Disposition: inline In-Reply-To: <20160227190712.GC12822@sigill.intra.peff.net> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: On Sat, Feb 27, 2016 at 02:07:12PM -0500, Jeff King wrote: > 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