Skip to content

worktree checkout fixes windows - #3057

Merged
Sebastian Thiel (Byron) merged 3 commits into
mainfrom
worktree-add-windows
Oct 13, 2026
Merged

Sebastian Thiel (Byron) merged 3 commits into
mainfrom
worktree-add-windows

Conversation

@Byron

@Byron Byron commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Tasks

  • refackiew

<!-- agent -->
Windows symlink creation inferred the target type with a filesystem probe.
Git for Windows guards that probe because a leading slash or backslash can
introduce a network share, including UNC and NT namespace spellings, whose
resolution could disclose credentials.

Match `process_phantom_symlink()` in Git's `compat/mingw.c` by checking the
original target spelling before probing it and creating a file link for
these targets. Relative and drive-qualified local targets retain directory
detection. This also deliberately treats drive-less rooted and verbatim
local targets as files, matching the conservative Git rule.

The regression uses only local directories with slash, backslash, and
verbatim spellings. It fails before the guard and passes afterward. This
is a focused safety hardening based on source review.

Assisted-by: GPT 6.1 Sol
<!-- agent -->
Delaying symlinks until regular files are written is insufficient on
Windows: an early link can target another link that has not been created
yet. A single target probe then leaves a file link where a directory link
is required, making paths such as `a-child -> z-dir/nested` unusable.
Git for Windows retries unresolved links when directory links appear.

Add `gix_fs::symlink::create_or_delay()` and retry unresolved checkout
entries while other links make progress. When a pass makes no progress,
create the remaining dangling or cyclic links with the existing file
fallback.

Completed links need no removal or recreation. For forced overwrites,
try creation before unlinking so a deferred replacement leaves the
existing link intact if a later object error aborts checkout.

Assisted-by: GPT 6.1 Sol
Co-authored-by: GPT 6.1 Sol <codex@openai.com>
@Byron
Sebastian Thiel (Byron) marked this pull request as ready for review October 13, 2026 10:44
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T10:48:25.589695Z 3909fb6 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3909fb6928

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "Codex (@codex) address that feedback".

Comment thread gix-worktree-state/tests/fixtures/generated-archives/.gitignore
<!-- agent -->
`gix_worktree_state::checkout()` stops dispatching entries when interrupted
but deliberately returns a partial `Ok` outcome. Clone checkout follows
that contract: it writes the index and returns the fetched repository even
when the worktree is incomplete. Treating interruption as an error would
otherwise trigger cleanup of an initially empty clone destination on drop
and require repeating the fetch.

Keep the existing behavior and document that callers must inspect
`should_interrupt` after `PrepareCheckout::main_worktree()` returns.
Neither `Ok` nor an outcome without errors guarantees a complete checkout.
Explain index persistence, retention of the fetched repository and partial
worktree, and how to finish checkout without fetching again. Clarify that
returning `Ok` consumes the preparation even after interruption.

Add isolated tests for interruption requested before checkout or inside
the checkout engine. Verify the partial outcome, persisted HEAD-tree
index, incomplete worktree, and retained repository and objects after
drop. Also cover cleanup of an initially empty destination when writing
the index fails, distinguishing ordinary errors from partial `Ok`.

Assisted-by: GPT 6.1 Sol
Co-authored-by: GPT 6.1 Sol <codex@openai.com>
@Byron
Sebastian Thiel (Byron) merged commit eae2fef into main Oct 13, 2026
33 checks passed
@Byron
Sebastian Thiel (Byron) deleted the worktree-add-windows branch October 13, 2026 11:26
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.

1 participant