From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-a8-smtp.messagingengine.com (fout-a8-smtp.messagingengine.com [103.168.172.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5124F3BD65A for ; Thu, 25 Jun 2026 05:52:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.151 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782366749; cv=none; b=ksP+Syp88UOTM4liqthtFcbG8iSoZObqiDYbOmdRG+KALf3qkqVLntQ4mvCJmCaj3BRnRi4xNuobGCEFfNuDPTrewqWcJOlZGEe0IgGy6k2T20ztt6IfZUtttfnVwT+tmiIH6odNTesT68lD8CaNL+EWgBFVOQ/bt4p/8o24jH8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782366749; c=relaxed/simple; bh=Cp/IgienghK/QfHNN4nhjTZUDKE4eGIeJYOO2bg8qXw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tQIjXPeDAkDo85pIhBZN9M0Nyqebk0vBLkZVMKp8YmS38nNa03veLGk2HsnCgsOr42mYMS9ULTzK9bHcKKctF7/lilVxNLTio7Qf9WAG62O/qktL0BuGqPcknrgvrqJhInrQ+1XLU8TAlZnZb/vrBVk1Zxy0PvJUBl/NKIKo/hI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=XrQ9OmIZ; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=NqHi7t52; arc=none smtp.client-ip=103.168.172.151 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="XrQ9OmIZ"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="NqHi7t52" Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id 5A56BEC0331; Thu, 25 Jun 2026 01:52:25 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Thu, 25 Jun 2026 01:52:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1782366745; x=1782453145; bh=bBpu9E+OB1+n7NSfcSiZpo9nEAslXT8oGc1/lbWQNjI=; b= XrQ9OmIZFcNIU4lKBmEJuATfgiEcokRCHbAO4RDFsr64sX1TGXmEd4VIDdJfK6nR fdi9sd9UHCHgu0H9hjazsdj7CWEdLjcn0+igYCIGZ4xvJ+I8BjJnsBKkt5+WhlN4 miUhSLd38dFTrZxjboohxuFI4zBrZvCFa7gp4i3hVPapi/+V++JXWog5sE5bmNZ+ lsSLx6Nd8LqneSGH0KYB63kjJiuDwf/kNjRAMh12zKMMFEo+jV8eJpy6QwNmmTmf e0zS3iuYWrFG9EseLYP6RYtxwFr+l1VVf7gcTpZfcExoWA09/3gDQPNc/qzxSnO1 1yCjudA76VPVp64K3V2k2A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1782366745; x= 1782453145; b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0zgpuxAF+qfFn1ztp3tBM4exmPme3NAwYWsqhFipu9Nq4pWPQ X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 25 Jun 2026 01:52:24 -0400 (EDT) Received: by mail (OpenSMTPD) with ESMTPSA id d8db89a2 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 25 Jun 2026 05:52:21 +0000 (UTC) Date: Thu, 25 Jun 2026 07:52:14 +0200 From: Patrick Steinhardt To: Christian Couder Cc: git@vger.kernel.org, Junio C Hamano , Christian Couder Subject: Re: [PATCH v2 2/4] odb/source-packed: support flags when iterating an object prefix Message-ID: References: <20260624-pks-connected-generic-promisor-checks-v2-0-132d73ee47b9@pks.im> <20260624-pks-connected-generic-promisor-checks-v2-2-132d73ee47b9@pks.im> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Jun 24, 2026 at 07:02:48PM +0200, Christian Couder wrote: > On Wed, Jun 24, 2026 at 12:37 PM Patrick Steinhardt wrote: > > diff --git a/odb/source-packed.c b/odb/source-packed.c > > index 3afc4bf01f..6f31f0ff94 100644 > > --- a/odb/source-packed.c > > +++ b/odb/source-packed.c > > @@ -171,6 +172,20 @@ static int for_each_prefixed_object_in_midx( > > const struct object_id *current = NULL; > > struct object_id oid; > > > > + if (opts->flags) { > > + uint32_t pack_id = nth_midxed_pack_int_id(m, i); > > + struct packed_git *pack; > > + > > + if (prepare_midx_pack(m, pack_id)) { > > + pack_errors = true; > > + continue; > > + } > > + > > + pack = nth_midxed_pack(m, pack_id); > > + if (should_exclude_pack(pack, opts->flags)) > > + continue; > > + } > > + > > current = nth_midxed_object_oid(&oid, m, i); > > > > if (!match_hash(len, opts->prefix->hash, current->hash)) > > It looks like this is: > > if (!match_hash(len, opts->prefix->hash, current->hash)) > break; > > and I wonder if the `if (opts->flags) { ... }` block would be better > after that prefix check rather than before it. > > Putting it after the prefix check would make sure we don't continue > when the prefix doesn't match. Hm, that's a good point indeed. Will adapt, thanks! Patrick