From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.182 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== 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== 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 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 ; Fri, 4 Dec 2026 14:37:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 05FC0606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com 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 Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-3ae7d1ce1bfso8345931fa.1 for ; Fri, 04 Dec 2026 06:37:20 -0800 (PST) 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) 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) Message-Id: From: "Johannes Schindelin via GitGitGadget" Date: Fri, 04 Dec 2026 14:37:17 +0000 Subject: [PATCH] cache-tree: do not start an ODB transaction for repair-only updates Fcc: Sent Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Mailing-List: git@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 To: git@vger.kernel.org Cc: Johannes Schindelin , Johannes Schindelin From: Johannes Schindelin Since e928a32355dc (object-file: create ODB transaction temporary directory eagerly), every ODB transaction in the "files" backend immediately creates `/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 --- 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