From patchwork Fri Apr 9 11:27:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 12193837 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86C79C433ED for ; Fri, 9 Apr 2021 11:28:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 536106105A for ; Fri, 9 Apr 2021 11:28:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233564AbhDIL2P (ORCPT ); Fri, 9 Apr 2021 07:28:15 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:37711 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231599AbhDIL2N (ORCPT ); Fri, 9 Apr 2021 07:28:13 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id D73755C0093; Fri, 9 Apr 2021 07:28:00 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 09 Apr 2021 07:28:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=3HFQtrD5QIMa3ooX/VKrKiz7YJ1 rk8ybu00BZsvO5Nk=; b=JMJS5uwqmz+wJDSBW7X0I04TNTdLD+4jbHTomvQNbpw CffkQ3xnrYo/YMSSNxZI5If89s/i67E/FUx7cxcXPT0H2IL4fzsfbcH4q1LeJCb2 NFf7KuoLL3nLydLatpuiPyzzRP7Fi+9Lr8nJQ5KjN5/7TyOdf/1TXfkeSvDSScNY R3HQGFP0zsAsHrBemUYsoRIEuR9IRewwtdrmo92b9SDMEGtynBQlDa+iottcvaNo a/srVep3U0W876IHPX7umOn9Ydk9JwA6rMvWeOVwmpYYrzMH8ZNykkWIDdgeK73c w45NRnWzwdvqLXcGq5afKV+lo376btxcVZNzTrajynA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=3HFQtr D5QIMa3ooX/VKrKiz7YJ1rk8ybu00BZsvO5Nk=; b=esi1r0aXa80k6KiL2DvJAn 3WjWtSNYzTimovDJLE7+YOI/vvwrXKcZqmBv4dHG8ULTVJ4X7Ec4IrrRkwlGp4Pv qrnH5rBNaeD+40DwI4+YX4ddM43t48SHorJjE8XZqm2xmUKcJLVGgQLbDhJ0gFUI h5ZyXsZ/ZgnyppDRWKAu0pWLVEtN2FbozeIPEQAmYWEgJ33ZsDszXuIN+dVvTW+a 1STMUL1mwnQ+LF+VW2Ka8cdf6yDb+9Urymv06ORBxvunqreVD8C1VadBR4qmO89B 8U7YZ2w98CO4j72gxMQO+HPGPQwdbeYkFxhnsvCQqLNXqFbgrSjqga8maajqXH+w == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudekuddggeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefrrghtrhhi tghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrh hnpeehgefhtdefueffheekgfffudelffejtdfhvdejkedthfehvdelgfetgfdvtedthfen ucfkphepjeejrdduledurdekrdduieelnecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimh X-ME-Proxy: Received: from vm-mail.pks.im (x4dbf08a9.dyn.telefonica.de [77.191.8.169]) by mail.messagingengine.com (Postfix) with ESMTPA id 35247240065; Fri, 9 Apr 2021 07:28:00 -0400 (EDT) Received: from localhost (ncase [10.192.0.11]) by vm-mail.pks.im (OpenSMTPD) with ESMTPSA id 5ba95a97 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 9 Apr 2021 11:27:59 +0000 (UTC) Date: Fri, 9 Apr 2021 13:27:57 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Jeff King , Christian Couder , Taylor Blau Subject: [PATCH v3 2/8] revision: mark commit parents as NOT_USER_GIVEN Message-ID: <46c1952405173eca40706ed7be3b939b210ad2d5.1617967252.git.ps@pks.im> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The NOT_USER_GIVEN flag of an object marks whether a flag was explicitly provided by the user or not. The most important use case for this is when filtering objects: only objects that were not explicitly requested will get filtered. The flag is currently only set for blobs and trees, which has been fine given that there are no filters for tags or commits currently. We're about to extend filtering capabilities to add object type filter though, which requires us to set up the NOT_USER_GIVEN flag correctly -- if it's not set, the object wouldn't get filtered at all. Mark unseen commit parents as NOT_USER_GIVEN when processing parents. Like this, explicitly provided parents stay user-given and thus unfiltered, while parents which get loaded as part of the graph walk can be filtered. This commit shouldn't have any user-visible impact yet as there is no logic to filter commits yet. Signed-off-by: Patrick Steinhardt --- revision.c | 4 ++-- revision.h | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/revision.c b/revision.c index 553c0faa9b..fd34c75e23 100644 --- a/revision.c +++ b/revision.c @@ -1123,7 +1123,7 @@ static int process_parents(struct rev_info *revs, struct commit *commit, mark_parents_uninteresting(p); if (p->object.flags & SEEN) continue; - p->object.flags |= SEEN; + p->object.flags |= (SEEN | NOT_USER_GIVEN); if (list) commit_list_insert_by_date(p, list); if (queue) @@ -1165,7 +1165,7 @@ static int process_parents(struct rev_info *revs, struct commit *commit, } p->object.flags |= left_flag; if (!(p->object.flags & SEEN)) { - p->object.flags |= SEEN; + p->object.flags |= (SEEN | NOT_USER_GIVEN); if (list) commit_list_insert_by_date(p, list); if (queue) diff --git a/revision.h b/revision.h index a24f72dcd1..93aa012f51 100644 --- a/revision.h +++ b/revision.h @@ -44,9 +44,6 @@ /* * Indicates object was reached by traversal. i.e. not given by user on * command-line or stdin. - * NEEDSWORK: NOT_USER_GIVEN doesn't apply to commits because we only support - * filtering trees and blobs, but it may be useful to support filtering commits - * in the future. */ #define NOT_USER_GIVEN (1u<<25) #define TRACK_LINEAR (1u<<26)