Skip to content

worktree checkout improvements - #3056

Merged
Sebastian Thiel (Byron) merged 2 commits into
mainfrom
worktree-sparse-checkout
Oct 12, 2026
Merged

Sebastian Thiel (Byron) merged 2 commits into
mainfrom
worktree-sparse-checkout

Conversation

@Byron

@Byron Byron commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Tasks

  • refackiew

@Byron
Sebastian Thiel (Byron) force-pushed the worktree-sparse-checkout branch 3 times, most recently from cc45747 to 917e4b9 Compare October 12, 2026 09:22
@Byron
Sebastian Thiel (Byron) marked this pull request as ready for review October 12, 2026 09:22
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 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-12T09:26:11.377365Z 917e4b9 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: 917e4b9ece

ℹ️ 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/src/sparse.rs Outdated
Looked at everything carefully, but was despite test refactoring, I went
through those more quickly. The benchmark I only skimmed.

<!-- agent -->
Adding a linked worktree from a sparse checkout copied its configuration
without its patterns, then materialized the entire target tree. Copy active
`info/sparse-checkout` patterns from the source worktree's private Git directory
during preparation, including when checkout is deferred. Missing patterns are
skipped, empty files are retained, and copy failures roll back registration.

Expose pattern loading and full-index selection through `gix_worktree::sparse`.
Initial checkout in `gix` reads the destination's current patterns and marks
excluded target-tree entries with `SKIP_WORKTREE` and `EXTENDED` before writing
files and persisting the index. Support cone and non-cone patterns, case
folding, invalid-cone fallback, root entries, and directory pruning. Sparse
index generation and updates to existing checkouts remain outside this API.

Reuse matching decisions for shared directory ancestors with storage bounded
by path depth, and skip index traversal for a validated full-cone selection.
Cover pattern matching with 18 Git-generated baseline scenarios, regression
tests for cache boundaries and ordering, and integration tests for main and
linked sources, deferred checkout, missing or disabled patterns, and rollback.
Add Criterion benchmarks for cone and non-cone selection on synthetic indices
with 20,000 to 200,000 entries, checking membership and flags before timing.

Breaking change: `gix_worktree::add::prepare()` now accepts the destination
first, followed by an `add::Context` containing the common Git directory and
an optional source private Git directory, then its existing options. Use
`add::Context::new(common_dir)` when pattern inheritance is not wanted.

Assisted-by: GPT 6.1 Sol
Co-authored-by: GPT 6.1 Sol <codex@openai.com>
Non-cone directory-only patterns should treat gitlinks as directories on
every host, including when the destination is initially empty. The original
matcher instead hardcoded them as non-directories, reproducing the result
of Git's little-endian `ce_to_dtype()` bug.

Expose `gix_index::entry::Mode::is_dir_for_git_matching()` using decoded
modes directly, and document why Git's extra `ntohl()` conversion is wrong.
Use this classification for sparse matching, so `/*/` includes an absent
gitlink and `!/module/` excludes it consistently across hosts.

Keep Git-generated baselines while working around its conversion bug:
pre-create the empty gitlink directory only for the reference operation,
allowing Git's filesystem fallback to recover its intended classification.
The gix index-only regression and initial checkout still start without it.
Check included gitlinks as directories rather than reading them as files.

Assisted-by: GPT 6.1 Sol
Co-authored-by: GPT 6.1 Sol <codex@openai.com>
@Byron
Sebastian Thiel (Byron) merged commit ca9eb08 into main Oct 12, 2026
33 checks passed
@Byron
Sebastian Thiel (Byron) deleted the worktree-sparse-checkout branch October 12, 2026 14:05
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