🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #2363

[PATCH] path-walk: allow revisiting paths from tagged trees

#2363
From: "Derrick Stolee via GitGitGadget...
Date: Wed, 04 Nov 2026 19:07
102 lines
14412 bytes
From: Derrick Stolee <stolee@gmail.com>

When adding support for tree-depth filters, 5111520e2a1 (path-walk:
support `tree:0` filter, 2026-05-22) moved tagged root trees into a
separate batch. These trees are expanded after commit root trees and
their root-level blob batches.  If a tagged tree introduces another blob
at an already consumed path, push_to_stack() refuses to queue that path
again because path_stack_pushed remembers every previously queued path.
The final remaining-path drain makes the same check and also skips the
blob, leading to a repository with missing objects.

This regression was first released in Git 2.55.0. The torvalds/linux
repository has such tagged trees that revealed the bug.

To resolve this issue, remove a path from path_stack_pushed when
consuming its queue entry.  The set then suppresses duplicate pending
entries without preventing new objects from being visited at a
previously consumed path. This preserves the existing visit priorities
instead of reordering tagged trees relative to other batches.

Add a regression test with a commit and an annotated tree tag that
contain distinct blobs at the same path. After an initial repack to
clear loose objects, repack everything with path-walk and run an fsck
connectivity check to reveal the error without this fix.

Assisted-by: GPT-6.1 Sol
Signed-off-by: Derrick Stolee <stolee@gmail.com>
---
    path-walk: allow revisiting paths from tagged trees
    
    While exploring potential future improvements to path-walk repacks, I
    discovered this regression. It's slightly subtle in a way that the
    existing tree-tag tests didn't catch, due to needing to revisit paths.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2296%2Fderrickstolee%2Fpath-walk-tree-tags-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2296/derrickstolee/path-walk-tree-tags-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2296

 path-walk.c       |  5 ++++-
 t/t7700-repack.sh | 23 +++++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/path-walk.c b/path-walk.c
index 9ca3248ea8..e3a5ba201c 100644
--- a/path-walk.c
+++ b/path-walk.c
@@ -62,7 +62,8 @@ struct path_walk_context {
 	 * like a stack and performs a DFS within the trees.
 	 *
 	 * Use path_stack_pushed to indicate whether a path
-	 * was previously added to path_stack.
+	 * is currently queued in path_stack. Tagged trees can
+	 * discover new objects at an already visited path.
 	 */
 	struct prio_queue path_stack;
 	struct strset path_stack_pushed;
@@ -309,6 +310,8 @@ static int walk_path(struct path_walk_context *ctx,
 	if (!list)
 		BUG("provided path '%s' that had no associated list", path);
 
+	strset_remove(&ctx->path_stack_pushed, path);
+
 	if (!list->oids.nr)
 		return 0;
 
diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh
index f0a390e3c6..338f622614 100755
--- a/t/t7700-repack.sh
+++ b/t/t7700-repack.sh
@@ -904,4 +904,27 @@ test_expect_success 'pending objects are repacked appropriately' '
 	)
 '
 
+test_expect_success '--path-walk keeps blobs from tagged trees at already visited paths' '
+	git init --bare tagged-tree.git &&
+	(
+		cd tagged-tree.git &&
+		GIT_DIR=. &&
+		export GIT_DIR &&
+		old=$(echo old | git hash-object -w --stdin) &&
+		tree=$(printf "100644 blob %s\tfile\n" "$old" | git mktree) &&
+		git tag -a -m "historical tree" tree-tag "$tree" &&
+		new=$(echo new | git hash-object -w --stdin) &&
+		tree=$(printf "100644 blob %s\tfile\n" "$new" | git mktree) &&
+		commit=$(echo new | git commit-tree "$tree") &&
+		git update-ref HEAD "$commit" &&
+
+		# collect all loose objects into packs
+		git repack -adf --no-path-walk &&
+
+		# now confirm that --path-walk keeps all objects.
+		git repack -adf --path-walk &&
+		git fsck --connectivity-only
+	)
+'
+
 test_done

base-commit: a018953688f1b10bddf91bff8747068f5f4746a4
-- 
gitgitgadget
Technical Details
Message-ID: <pull.2296.git.1793819268371.gitgitgadget@gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-74479-linux-kernel-git=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-74479-linux-kernel-git=dewy.ru
From: gitgitgadget@gmail.com ("Derrick Stolee via GitGitGadget")
Newsgroups: linux.kernel.git
Subject: [PATCH] path-walk: allow revisiting paths from tagged trees
Date: Wed, 04 Nov 2026 19:07:48 +0000
Organization: Usenet Network
Message-ID: <pull.2296.git.1793819268371.gitgitgadget@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3479888"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:sWXk1ataDNrCwLUoYmpeykFnKg0= sha256:+a579yGmRh7IjWIymDscZvHARpntfHVIzeDlrIaOmVQ=
	sha1:nsO8TCeYat3svX5i3kqFGpBBVJM= sha256:7KlqKuy9/I+xwh6f2EoW5iSZE4XCmsxJgjZRvKZIsAc=
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 6D9C4112D44; Wed,  4 Nov 2026 23:33:31 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.948
X-Spam-Status: No, score=-1.948 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id zZTpfXrHT6oF;
	Wed,  4 Nov 2026 23:33:27 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=git+bounces-74479-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 5DB81112D3A; Wed,  4 Nov 2026 23:33:16 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id C98A5395CF; Wed,  4 Nov 2026 19:07:54 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793819272;
	b=KMYWbXvKdeH7p0M5AcnkR2fuzJGHDBa7ijF2b2qBBGe1OGWIDNkueW6kAGyLt94LFEoG
	 rJ141YRk0x1NtETvD3F7d//qnH+zZTNu4AzuE3H3pbGHs+S4OT2mkT0J9FjiArbAqaokc
	 1Bm1rhazhOVGjpT7s0jOs7glRX7uklmWjhuBK4OmX6nbpyxk1VWH0z2vX3kzZx3lO3ubq
	 wFUKnHoCdgcR6vuc5UMznu6jlxYDtlGuNG/ONVFkVtRoMfgIG+9wqZVkTbyzsj/zqqZ98
	 pfZE9ltuf+7PveCeWo4iOdaLS6TqA2/YqMYvJIUNAufxPaKsduCyaGw9HJ9/uM4fOzA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793819272;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:Message-Id:From:Date:Subject:Fcc:Content-Type:
	 Content-Transfer-Encoding:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:To:
	 Cc;
	bh=I2cN0IaGnS/X8hoVG5d41wt0T6rw4T9Ehvrg15pw6c8=;
	b=jGoAreEVi76Wgc/ey/jmtvPd7/qdekEXFjuEfkFB+Im+SP/gPtKnuEhaerJl/jFDhILU
	 YQCnJRa+NPDYDQFmETAg5D/5IgxUiTuhpsiMbLNa6r7c6A8kc1prNdojyjNLqYjs+qVlG
	 C0x3zE/KqjPMO21c83VT9WmCV5JYEy2RG+S9GShpoHMMg51c4iMM1e5q22KryWKFxI5pX
	 FE9laU64PIbjSBA2Vgxzi+IkVmak0HNQURHTNUhSW/3XOSE0/OEEyEzxuPucqsOAYXDCC
	 X4EAlP/4gazRhOyXXvSkXZcdHhEu1de1/d2p0JHg5QRqJpizn5s9M7rvwn1YI/y++Jg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=p+59IPbs;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 2570F606A32E;
	Wed,  4 Nov 2026 19:07:52 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=p+59IPbs
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.49
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793819271;
	b=DgDPo9OL2mYaCRt7MszRWIjhfvzlwyrRgvdxmfXQmRIIqn7AwzSbdnnQzns/GYQM2qZ+
	 9PBFX/4tKjMxKSc2cCMpNjhM4o6FDMtXj2xN3q77MfPzAlbVG5hEDqzW4UOP9bJlGIdbI
	 5G/n4TOdpaQiLGBtot6v1r/GzNbRMl6UgWsLx0fhleM9HXNr14uAYp+Fytu+2wkF+/Muc
	 SQXMjIBnhreoIWpg9U3sgTf8ALl/IW3M/mrMK6xchf9F+cPDWNtVwend/uIwk52P5FOJv
	 cRUJcEwHc8xsDEQ/dnPkua9v0jNXsdNL3VO/1WibROYIj/++squ6CpwIMIVBCMzsJVQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793819271;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Message-Id:From:Date:
	 Subject:Fcc:Content-Type:Content-Transfer-Encoding:MIME-Version:To:
	 Cc;
	bh=I2cN0IaGnS/X8hoVG5d41wt0T6rw4T9Ehvrg15pw6c8=;
	b=hdUxESqV5wZoiMvrfccztHP3S0PQ1Cpld/bY1Hjb4aQFP5ilITKGi9ikGvXByHPYk1vI
	 RC1X1ghDgiGkfW1EGzs3+TjGUGNYgnaAa5GQzfU0dF86fG/b1hn3Oede9O0DwCpqiSVj8
	 +eRasqUswmbxsJhmMQ/+M6ADbOUYLV/fwvEoFfcv/QwC9zc117GFITEs87ReVx6xxOSrm
	 WSBXYAfRFu6awrH/RGQyinzWeZsxlo+HWS/RGHQCCw1tjascCFZYw4iSZ9BFXHZk6LJKA
	 EbZ1R9Cja2WZZH1zdjgxsVX7K3k/LXIkCbQUabyxBUS1U6oqE2usOqq5uUONlq2RaKA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=p+59IPbs;
	arc=none smtp.remote-ip=74.125.82.49
X-Received: from mail-dl1-f49.google.com (mail-dl1-f49.google.com [74.125.82.49])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD983606A31B
	for <git@vger.kernel.org>; Wed,  4 Nov 2026 19:07:50 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DD983606A31B
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-dl1-f49.google.com with SMTP id a92af1059eb24-1ae18eb9b69so1023609c88.0
        for <git@vger.kernel.org>; Wed, 04 Nov 2026 11:07:50 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1793819270; x=1794424070; darn=vger.kernel.org;
        h=cc:to:mime-version:content-transfer-encoding:content-type:fcc
         :subject:date:from:message-id:from:to:cc:subject:date:message-id
         :reply-to:content-type;
        bh=I2cN0IaGnS/X8hoVG5d41wt0T6rw4T9Ehvrg15pw6c8=;
        b=p+59IPbs5ZA6PcYC/EExO5P+QlPsolIO0bCMEn9fSI8vCf36Y0KXuXNmq7h+XgGWXJ
         XdiaQ3Uj9PDB6TSg3IwVfZU0jNkL5JupP586tx5URRsY8UJoUIS8E/wJmsLYIF3jugi6
         393qDhjQ1Feo04WL/z6TfgqgyWcgWiLV3dPhUG9UuP2Z4Czh7B2bZPYvjC8wlddAn+eG
         xkbRAejlFZWdYpHQbyGCkO1BpFsNN1tABchTOeoHSwu1rf0ucmWF9zCQyhJnOIrlvhNg
         eOzbiQxMr37PFsC/RDhEQX3Gg/S4IdkYgFBzmcJijj4/SBIRnWgLOaDLDi7zB/Ra1w3c
         +HsQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1793819270; x=1794424070;
        h=cc:to:mime-version:content-transfer-encoding:content-type:fcc
         :subject:date:from:message-id:x-gm-gg:x-gm-message-state:from:to:cc
         :subject:date:message-id:reply-to:content-type;
        bh=I2cN0IaGnS/X8hoVG5d41wt0T6rw4T9Ehvrg15pw6c8=;
        b=FVGkMx8zvLfI7oCLM/gZ1tlOzyXnnvf3VDtj+WQW/n77R0golzlnqIa+OuDK1NJRL8
         LNdn0LxrNNH/V/889n2YeA21C37u3qftBsUTAaAW/VWmPlZdgyLdlZ+NTCxa8xb0uoHt
         YlOLF+WH93esvpRFY1K8V50g6+g+rMd7OQXq82UkFjg/o7AsYbcg6zB78+9CLzcXrdNP
         qsr8Wb3ryPnyOGHT+E6gQEwL0AGN6KAnfgzHiKkQ4RL5nHpmztG8uOLQIF7olx8J74nM
         0vzoK78aZfGbttuALzbooXUHyFDZLQd87bYbJccG+uGpstzEa7sVQFvv4VsRJ0YO1Zl8
         4srg==
X-Gm-Message-State: APuU4Z9Aqm+2Fe0u6B55uOl8gSlOYItMFsJVpsW+6W21Q9tYe0CitP0E
	o+NpqS7DbR5BTen46LYw4ITJqz/3Wrce9aRbJ/hZBIfDLYb2eMZEsWae2UXchBB9Z/M=
X-Gm-Gg: AYBFou1FJ71EwyuVrw9jd29MG2dNZ5Pe5TAXleQWBnXyjrWtLG5Lx8Apphg0oKOUETM
	+J3heKYxLbA7x0o3gCMBTMQYVwaGK1+8Z8BdJRk4MaChCrTXQr/JeJahG8faIpkfyxHn0tv0/WY
	yfpe6RaLA8ipy2Gkq2o40DlrEyAX+9phvizqHCyQaYKXY3n5bWk5BciWGV0XnQ8ZFM33Y86HlDD
	lQ6RY4xhrr8fbEuJF9wRspOZtVlY6T9z/WjF9tUEZFvKWaxRk9cRQqfZNc1aoAaXuGP5fm3YAHv
	0f40odFni186v8YpI2l464tG4pk/tIDvWj+Te8Na564OrLwlZ8EG57LK7STKejwF0RkJi1E1sGD
	GX9AOUxCzRtADr8hkPYvNL7kMID9PRAwJYceVA0M4hRnV0HRHe+LjzZrazhqQrQBlxrP22Cg3L/
	qA7nXa2MSxE3a/9PDw6RenzLfpP409xDkRTflNyictdH+yTfH84QPwkYFXaPp6FGlw9YVn+71c6
	xYl05ZiNsbNgRh8jqaQiheBURXgr1IKa9fv7m20Bv7wXbhB7YUxWZchkWXoG9vNCgKx5XVaOFDC
	k3TH/k2XNcwLONN+eMZwLJmlrO/Zuw==
X-Received: by 2002:a05:701b:2310:b0:1b2:4e79:bfb0 with SMTP id a92af1059eb24-1b24e79cc85mr822515c88.23.1793819269786;
        Wed, 04 Nov 2026 11:07:49 -0800 (PST)
X-Received: from [127.0.0.1] ([57.154.4.160])
        by smtp.gmail.com with ESMTPSA id a92af1059eb24-1b245c1c272sm9419407c88.8.2026.11.04.11.07.48
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Wed, 04 Nov 2026 11:07:49 -0800 (PST)
X-Fcc: Sent
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list
X-Cc: gitster@pobox.com,
    ttaylorr@openai.com,
    Derrick Stolee <stolee@gmail.com>,
    Derrick Stolee <stolee@gmail.com>