All of lore.kernel.org
 help / color / mirror / Atom feed
From: Derrick Stolee <stolee@gmail.com>
To: git@vger.kernel.org
Subject: Re: [PATCH] cache-tree: do not start an ODB transaction for repair-only updates
Date: Fri, 4 Dec 2026 09:44:16 -0500	[thread overview]
Message-ID: <cff126c8-bf3e-448e-a8cd-e9433318ccf0@gmail.com> (raw)
In-Reply-To: <pull.2348.git.1796395037799.gitgitgadget@gmail.com>

On 12/4/2026 9:37 AM, Johannes Schindelin via GitGitGadget wrote:
> 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.

I imagine that this has some performance implications beyond your issues
with long paths. Perhaps it's minor compared to everything else going on.
 
> 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).

Thanks for stepping through how this was caught. Yes, there are going to
be other issues with long paths. This change is a pretty solid fix for
avoiding unnecessary transactions. And perhaps is a good thing to find
for future avoidance of transactions, when possible.

LGTM.
-Stolee



      reply	other threads:[~2026-12-04 14:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 14:37 [PATCH] cache-tree: do not start an ODB transaction for repair-only updates Johannes Schindelin via GitGitGadget
2026-12-04 14:44 ` Derrick Stolee [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cff126c8-bf3e-448e-a8cd-e9433318ccf0@gmail.com \
    --to=stolee@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.