Skip to content

fix(gix): ignore incomplete linked worktrees during fetch - #2960

Merged
Sebastian Thiel (Byron) merged 1 commit into
mainfrom
fetch-in-linked-wt
Sep 2, 2026
Merged

fix(gix): ignore incomplete linked worktrees during fetch#2960
Sebastian Thiel (Byron) merged 1 commit into
mainfrom
fetch-in-linked-wt

Conversation

@Byron

@Byron Sebastian Thiel (Byron) commented Sep 2, 2026

Copy link
Copy Markdown
Member

Tasks

This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.

  • refackiew

Everything below this line was generated by Codex GPT-5.

Created by Codex on behalf of Byron. Byron will review before this is ready to merge.

Summary

  • Ignore linked-worktree admin directories that contain gitdir but not commondir while collecting checked-out branches.
  • Preserve repository-open errors for all other linked worktrees so fetch and branch deletion remain fail-safe.
  • Add a regression covering both the interrupted state and preservation of other open failures.

Fixes #2959

Git reference

Validated the reported scenario with Git 2.55.0 from /Users/byron/dev/github.com/git/git at 0bd5a6920d7c4238e0d90ddc0e7e08866e84a0f1. Git reports the incomplete entry as prunable, completes git fetch with exit status 0, and creates the remote-tracking ref. Its add_worktree() implementation writes gitdir before commondir.

Validation

  • cargo fmt --all -- --check
  • cargo test -p gix --lib --features blocking-network-client (23 passed)
  • cargo test -p gix --test gix (409 passed)
  • cargo clippy -p gix --lib --features blocking-network-client

Commits

<!-- agent -->
Expose `worktree::Proxy::is_prunable()` with Git-compatible semantics: locked
worktrees are retained, while unreadable `gitdir` files and missing checkout
targets are prunable. Treat any filesystem entry at `locked` as a lock,
including symlinks.

When opening a proxy as a repository, use the common directory already known
by its parent instead of relying on the linked worktree’s optional `commondir`
file. This prevents incomplete administration from being mistaken for a
standalone repository and keeps `HEAD` access routed through the repository ref
store for backend compatibility.

Fetch can consequently inspect linked-worktree heads without failing for missing
checkouts, locks, or missing and malformed `commondir` files.

Assisted-by: Codex <codex@openai.com>
Co-authored-by: GPT 5.6 <codex@openai.com>
@Byron
Sebastian Thiel (Byron) marked this pull request as ready for review September 2, 2026 08:19
@Byron
Sebastian Thiel (Byron) merged commit 87727ee into main Sep 2, 2026
32 checks passed
@Byron
Sebastian Thiel (Byron) deleted the fetch-in-linked-wt branch September 2, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gix: fetch fails when a linked worktree admin dir has a gitdir file but no commondir

1 participant