Repository navigation
fix(tests): stop git auto-maintenance from deleting the promote test's new worktree - #4466
Merged
Merged
Conversation
…tree Pushing into the bare fixture makes receive-pack start a detached git maintenance run --auto. Its worktree-prune task deletes a worktrees/<name> directory that has no gitdir file yet, which is the state git worktree add leaves between its mkdir and writing the locked file. When the two overlap, worktree add fails with "could not open 'worktrees/worktree/locked' for writing". receive-pack strips GIT_CONFIG_* from its environment, so the bare repo's own config disables auto-maintenance. Refs #4464
This was referenced Oct 13, 2026
Closed
max-sixty
pushed a commit
that referenced
this pull request
Oct 13, 2026
After #4436 removed the `dirs::data_dir()` fallbacks, the only remaining use of `dirs` is `dirs::document_dir()` inside `#[cfg(windows)]` in `src/shell/paths.rs` (`powershell_profile_paths`). The nightly `check-unused-dependencies` job runs `cargo udeps --all-targets` on Linux, and in [run 38353472092](https://github.com/max-sixty/worktrunk/actions/runs/38353472092) it reports `dirs` as unused. This PR moves `dirs` into a `[target.'cfg(windows)'.dependencies]` table so Linux and macOS builds no longer pull it in. `Cargo.lock` is unchanged. I couldn't run `cargo udeps` locally because it needs a nightly toolchain. The Windows build in this PR's CI confirms that `dirs` still resolves where it's used. The same nightly run had a second, unrelated failure, a race in `test_promote_bare_repo_with_worktrees`. #4466 fixes it separately. Refs #4464 — automated triage Co-authored-by: worktrunk-bot <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test_promote_bare_repo_with_worktreesfailed during setup in nightly run 38353472092. Its plaingit worktree addagainst the bare fixture died withfatal: could not open 'worktrees/worktree/locked' for writing: No such file or directory. This is the second occurrence: #3918 recorded the same failure in August and closed it as a one-off.The cause is Git's own auto-maintenance. The test's
git pushinto the bare repo makesreceive-packstartgit maintenance run --auto --quiet --detachin that repo, which keeps running after the push returns. Under Git 2.55, auto-maintenance includes theworktree-prunetask, and that task deletes anyworktrees/<name>directory without agitdirfile.git worktree addleaves exactly that state for a moment, between creatingworktrees/<name>and writing itslockedfile. If the detached maintenance scans during that moment, it removes the directory, and the write fails with ENOENT.The test now sets
maintenance.auto=falsein the bare repo before pushing. It has to be repo config:receive-packstripsGIT_CONFIG_*from its environment for local transports, so the suite's hermetic env never reaches it.What was verified locally (git 2.55.0)
receive-packspawninggit maintenance run --auto --quiet --detach.git maintenance run --autodeletes a hand-madeworktrees/xdirectory that has nogitdirfile.maintenance.auto=falsethroughGIT_CONFIG_COUNTdoes not stop the push's maintenance child. The same setting in the bare repo's config does: the trace then shows no maintenance child.cargo test --test integration step_promotepasses.git commitalso spawns detached auto-maintenance, but the suite's hermetic env could turn that off. Every failure seen so far came through the push path, so this PR leaves the commit path alone.The other failure in the same run,
dirsreported unused by udeps, is fixed separately in #4465.Refs #4464 — automated triage