git/list[1] front-page[2] threads[3] people[4] search[5] about
 

failed to read .git/worktrees/test-worktree-xdrphX/commondir: Success

From
BJBrendan Jackman <bhenryj0117@gmail.com>
Date
Dec 12, 2024, 20:23 UTC
Message-ID
<CAJUwWUMQF_tN_hyBMh+F4NtAHVAx1z+g0HYY=PD9-jd5RdcR9g@mail.gmail.com>

I am developing a tool that uses Git via its CLI. The tool creates a bunch of worktrees on startup and tears them down on shutdown.

When running its tests, it does this a lot. Sometimes, the git worktree add command fails with exit code 128. The output just looks like:

failed to read .git/worktrees/test-worktree-xdrphX/commondir: Success

Naturally, whenever I try to strace anything, the bug stops reproducing. But, I have tried manually adding logging to my application to see the Git commands it's running.

The test harness sets up a fresh repo and puts some commits in it, then runs multiple instances of the application (on the same repo). The one that fails seems to only be running these two commands:

["-c", "color.ui=false", "log", "-n1", "--format=%H %T", "HEAD"] ["-c", "color.ui=false", "worktree", "add", "/tmp/limmat-child3qE96Q/worktrees/test-worktree-sGVqA8", "HEAD"]

And that second command fails with the error above.

Any idea what's going wrong here? Is what I'm doing (i.e. creating worktrees in parallel) actually legit? Anything I can do to help narrow down the issue?

.:: Details

I've built git from next on Ubuntu 24.04.1 LTS, here's the git bugreport output: https://gist.github.com/bjackman/3377add9e8d7b747d9f74b52518e9101/edit

But, I also experienced this issue with the Ubuntu packaged version of Git.

The application with the hacks to add logging of Git commands is here: https://github.com/bjackman/limmat/tree/git-bug

Here's an example of the test failing in CI: https://github.com/bjackman/limmat/actions/runs/12303338582/job/34338222752#step:5:337

If you're willing to try and reproduce locally, in theory it should be enough to put your Git build in $PATH, clone my repo, install Cargo (https://doc.rust-lang.org/cargo/getting-started/installation.html), and then from the base of my repo run `cargo test race` in a loop, in my case it usually fails relatively quickly.

Many thanks, Brendan

Next: Phillip Wood
Message 1 of 3 in “failed to read .git/worktrees/test-worktree-xdrphX/commondir: Success”
  1. Brendan JackmanDec 12, 2024
  2. Phillip WoodDec 13, 2024
  3. Brendan JackmanDec 14, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.