🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #4335

[PATCH] cache-tree: do not start an ODB transaction for repair-only updates

#4335
From: "Johannes Schindelin via GitGitG...
Date: Fri, 04 Dec 2026 14:37
82 lines
13959 bytes
From: Johannes Schindelin <johannes.schindelin@gmx.de>

Since e928a32355dc (object-file: create ODB transaction temporary
directory eagerly), every ODB transaction in the "files" backend
immediately creates `<objects>/tmp_objdir-transaction-XXXXXX/pack`.

The `cache_tree_update()` function begins such a transaction whenever
none is in flight, even with `WRITE_TREE_REPAIR`. A repair never writes
objects, though: it only hashes tree buffers and checks whether those
objects already exist. Because `unpack_trees()` and `git checkout` both
request repair-only updates, a checkout can now create and then remove a
temporary object directory for nothing.

On Windows without `core.longPaths=true` (which only exists only in Git
for Windows so far, anyway), that is not just wasteful. The `mkdir()`
refuses paths of 248 characters or more on that platform.

As a consequence, Git for Windows' `t7429-submodule-long-path.sh`
started failing when Git for Windows was rebased onto v2.98.0-rc0. The
object directory of the nested submodule is 214 characters long.
Appending `/tmp_objdir-transaction-XXXXXX/pack` goes over the limit, and
the checkout fails:

  error: unable to create temporary object directory in
    .../objects: Filename too long
  fatal: failed to start object transaction

Since that operation does not need to write any new objects, skip the
transaction when repairing, and keep the transaction for updates that
write trees. Obviously, the latter would still fail, but we do not test
for that in Git's test suite, and addressing that is a longer story
(involving upstreaming the `core.longPaths` support from Git for
Windows, something we'll need to do _some_ day, but not during the `-rc`
phase of v2.98.0).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
    cache-tree: do not start an ODB transaction for repair-only updates
    
    I needed this (in addition to many other fixes) to get Git for Windows
    v2.98.0-rc0 out the door.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2348%2Fdscho%2Fcache-tree-vs-odb-transactions-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2348/dscho/cache-tree-vs-odb-transactions-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2348

 cache-tree.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/cache-tree.c b/cache-tree.c
index 671d4165bf..3c86144cd1 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -525,7 +525,8 @@ static int update_one(struct repository *repo,
 
 int cache_tree_update(struct index_state *istate, int flags)
 {
-	int inflight = !!istate->repo->objects->transaction;
+	int start_transaction = !istate->repo->objects->transaction &&
+		!(flags & WRITE_TREE_REPAIR);
 	struct odb_transaction *transaction;
 	int skip, i;
 
@@ -542,11 +543,11 @@ int cache_tree_update(struct index_state *istate, int flags)
 
 	trace_performance_enter();
 	trace2_region_enter("cache_tree", "update", istate->repo);
-	if (!inflight)
+	if (start_transaction)
 		odb_transaction_begin_or_die(istate->repo->objects, &transaction, 0);
 	i = update_one(istate->repo, istate->cache_tree, istate->cache, istate->cache_nr,
 		       "", 0, &skip, flags);
-	if (!inflight)
+	if (start_transaction)
 		odb_transaction_commit_and_finalize_or_die(transaction);
 	trace2_region_leave("cache_tree", "update", istate->repo);
 	trace_performance_leave("cache_tree_update");

base-commit: 566b6997dd4710b625c0882cf10a7443bf52d183
-- 
gitgitgadget
Technical Details
Message-ID: <pull.2348.git.1796395037799.gitgitgadget@gmail.com>
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-77011-linux-kernel-git=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-77011-linux-kernel-git=dewy.ru
From: gitgitgadget@gmail.com ("Johannes Schindelin via GitGitGadget")
Newsgroups: linux.kernel.git
Subject: [PATCH] cache-tree: do not start an ODB transaction for repair-only
 updates
Date: Fri, 04 Dec 2026 14:37:17 +0000
Organization: Usenet Network
Message-ID: <pull.2348.git.1796395037799.gitgitgadget@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2785908"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:6imzOms1u+kHaQLQpYTwT7DBiw4= sha256:W5A2hi+WVA3y5cIiBoW0BhxRZyWcW5BgtMb576MiFnQ=
	sha1:cGj2N1HexXBcSYyB6J5ddxnjtRk= sha256:gtwM2fikdAYj1PdGc4IKbyQOULl6oyF0XNDAbdjhGAo=
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 04389117C37; Fri,  4 Dec 2026 17:37:36 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.296
X-Spam-Status: No, score=-2.296 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.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.001,
	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 Fwpw7EjdVH8d;
	Fri,  4 Dec 2026 17:37:32 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=git+bounces-77011-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 74F16117C32; Fri,  4 Dec 2026 17:37:23 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 8CF062EA5A; Fri,  4 Dec 2026 14:37:22 +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=1796395042;
	b=i2l7EDZL0Py/yKLgcXrnu+4kf9Uw0z1rlJryQxAkgTaZ4oTwljvQ9F6C2yZukCz4o3W0
	 St4o+mT9UZ73nHAM5D5c965fHnHl2aNwIR2D6TqF33mNSpgsDLOLZZqnHf6LXekhhosIg
	 sMjtOXh2epoOLDuQpvcGGcQJDWbHjXNrQgT2djEm5V0T/0WZazriw46uXLgLIpJV/nAZS
	 NNINsoQ77mE0xa7fVdokN6MT4fLb0P8HOCajsCb7dNIMfDTb8VsLFmuH3FEbmpgSPNJ5b
	 lTdFdgphuAhIq6sTHRt59QWyGf8SVBrGNWqKjtWfz753Lq/fIahJeIohAW082XHY1dw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796395042;
	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=Xc/3B6hpmQPjs93CheQUn6GYhs+zIlkKrQ916R4jOp4=;
	b=1upjfjgzo0COJygEkFS5zr4RYv21eNt2zitoBOwi/A5qC4Yr2wGvB6FGgC8WMGJYuRsF
	 /brNEo4KppHZS8cQEc8eHqIMnnkE/sJjEdoSwXxvKBP6hPGdIFWEc8jZ0kwH+c3d48kSF
	 AhbCDCRxBLRYLzJ4eYh5isvcLf5DelmWjEL7o947/rLIjjcxs5FruMGPFT7oGPBXF60qL
	 NquJ59/xHyx2GIwuUwzX/ABwds1bxwCABxEaoQ4wJOdU9THkR07A6Wpxi/zkvvqsXUq8c
	 B+m48MZh+6GiAUKWSXNZJgiEAAtTNl2h+DNszIoEW7R9Digzsi9Kb5URaa50JBvu64Q==
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=pj0ZhKEU;
	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 345AB606A336;
	Fri,  4 Dec 2026 14:37:22 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=pj0ZhKEU
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.182
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796395041;
	b=F7mDLQpzrucvlrb/WT0S3NeEVkJNoABr+/N51LMIFwfcfx3qVe65pA90tyte+fBOtLUj
	 scexwgTwSSGEAwRtQQBl+zWrWXUxMKD4xh5UvcCdPo3cwDds6EoU+6eZ04cJTSu9gvkMZ
	 PUeyIupBnFS8nhHh17vo8dS4cC2mzXlUDV29c4eFYH6fb4UC68BaBy6lGvG4r/2mhS5ks
	 2GBPtE14pBjF1XEHLWPXihtACb3NVgrakjQBH9WLIRplhpbVaQ18LDXoX8kOOcMVBglTJ
	 SiKSwZcacFxh8UVef1d5WPfQ/tOKPJpDahX2wn4dC//XwBDGRZ5W0izRGpNOMDV2qVA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796395041;
	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=Xc/3B6hpmQPjs93CheQUn6GYhs+zIlkKrQ916R4jOp4=;
	b=rzvuaNL5JCBrs0FGlHf92MIkc2D3tCxNnwt6zOuxaNJPtRFjQtAXk4bLIDgfma+NGLtR
	 koHls3kkiHwF9mRlLHL4gqkEpIRPjq34cxHpc+EITZw7+eaLkEfIdzJY6MjzfSVSPsGGf
	 UE1/pE/o8mMb7H1nrrtbxVYzGLWWE80ddUSpvphr4CktHXn/JOwS7YhECFyUyoYXlHQGp
	 W3XB8fI4lRX0VN/MudomzXeDl5wGeFpV0jnnqbIAuuz9dg7mPTCmtLQlJPnewooTi29qg
	 kOWyo7kl5Vo6Q/6JbZAKySKI446kvJsVqk5Fbnkm+sNHxOalCqkXCrpUQDJw+jDKqsw==
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=pj0ZhKEU;
	arc=none smtp.remote-ip=209.85.208.182
X-Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182])
	(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 05FC0606A32C
	for <git@vger.kernel.org>; Fri,  4 Dec 2026 14:37:20 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 05FC0606A32C
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-lj1-f182.google.com with SMTP id 38308e7fff4ca-3ae7d1ce1bfso8345931fa.1
        for <git@vger.kernel.org>; Fri, 04 Dec 2026 06:37:20 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1796395039; x=1796999839; 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=Xc/3B6hpmQPjs93CheQUn6GYhs+zIlkKrQ916R4jOp4=;
        b=pj0ZhKEUOgM3PeDwosMqC6I2+J7MpdCRhsBBBYOA9lzgTtuZI3IIeO/KSqw4Cg2q+S
         kbuef5I3K/atB96dhY7QTaWbfeQEQk2vReLnjZbiQTGG5BWN5OcsmOYGzlxXSSEEr0H1
         gOT8n44xaC3Z1iYQzihFhUH2xa/fRQeSLLDF6nP1be8pruJKHBS8dm2pVkrHB5r2Zdor
         twp/LBnL6+fnZuXwZDg6pZz3zf4TXiYWlNO9FUoNI0/JcUtjtvjFCiT87oDmVDKv1G0K
         SPmSojH0tvUMsh8quFyntjc0ejY/+HTJHmBaqd7VLdFpsDAmFH6jh88EUQxRCs3ZuRXc
         /lPw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1796395039; x=1796999839;
        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=Xc/3B6hpmQPjs93CheQUn6GYhs+zIlkKrQ916R4jOp4=;
        b=OBKgQbnvzVFrkmJQH9aVdtaHbfcGOk85ZzVWoFal6xibZpoeBq83//Xb9FPJoe/0N/
         rGn53bstsHS39+BCoC2QDiFGTfCJ7xmiNcpSzE/wBgrT68kY7w3q6OcguZ1MJ14jEuAc
         VnW991UTAobBF6EHElcWDtszVfyH8B4pY8BwhgZ0VZCAan4tLPmOSbRxEdE+RL9nL2wc
         XescpJm2t0zar8LpomYwNpwQe4RI5GDFHXvJfF78TGn1E+1X9zgEaMCcNyUXYtKDShiw
         ic5s2CG3rRbzGWPWU/YjCYKvn7NGLlMwcltVYUOU+6Ger8ZIVWLQuxXRvw73S+IBa7Q4
         8VIw==
X-Gm-Message-State: APuU4Z+wc8lH8ju0bOdx504dtjyLaclDS6zZeJ23/fXpe9GRsKrJwufT
	5OrZggGpuRqyyJsYbJ6Q46r48bYFbZQB80aAvQ8zBcWtzLJenMgHvI6p+FrZgQ==
X-Gm-Gg: AZFdTZe3WAYHOi42Ymh4U7Dq2ohbz/Hv/XxjarPZFzBhKNXqXOqV6MvPUg+g6U39/oi
	f0k8VkTZHDsjZ1Sqx7Aw9SRpNohXRro4Fc4ZUSGuCgDyy8cdErD5v/5Nh5TgTAWRYA5NgpL/GCI
	0mrUHFg6JI8IKAa7a0rM+xpiJKeAATkSFrIo5D3Te8F4XwIYm8cNipPvC2H+VVWAni2A+YDRPZI
	/ncbQDGyiGHmJikWgPOB75epT/wXUKRF8PuQISUJe+rNdJCJXmYcMtmrYUWz9TettQFOahFLIqA
	W+NpUtvLHqmosE9/VBEMOUMey1GcBIQqG4R5Kq50D1sKDF3I1V80hf3nqr+m/J6E3FAObluy65j
	Hm1BfovP71q6u+mKHCePUB1KCicit/GTtTwsXdiDveymzaYo+6slvdkCVS9Znt2hosns3F4Dxcq
	hk01LTPsvolnzADB+APflcCwF+QkyGCMYLjrP8in6StiV79iZ8ZisE2Glk+wa4N8mzbZFyWMj0M
	QJTWLtUkh+AnnhWnMu0azkltNVcOR3NlZS08nRRc8VJxQHHeMiYzf4tgKh6B030qroLq8i5OWk5
	p2XuMfMJqeqm4MqRqGkKZ6kq0lf2EPgJm4JmAomk/0PUjVKlkGgE
X-Received: by 2002:a05:651c:a333:b0:3ab:3d02:d03d with SMTP id 38308e7fff4ca-3b004477165mr5746441fa.13.1796395038899;
        Fri, 04 Dec 2026 06:37:18 -0800 (PST)
X-Received: from [127.0.0.1] ([20.102.47.89])
        by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-3b00829cfecsm4085771fa.2.2026.12.04.06.37.18
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Fri, 04 Dec 2026 06:37:18 -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: Johannes Schindelin <johannes.schindelin@gmx.de>,
    Johannes Schindelin <johannes.schindelin@gmx.de>