fix: resolve relative core.worktree from real git dir#2671
Merged
Conversation
8a4d481 to
16eb8ba
Compare
Contributor
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 16eb8ba9af
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
Issue #2052 reports that `gix status` can fail for a repository opened through a symlinked top-level `.git` when `core.worktree` is relative and the repository contains submodules. The submodule worktree was anchored from the symlink parent instead of the actual repository git dir, producing paths outside the intended detached worktree. Resolve relative `core.worktree` paths against a symlink-resolved git-dir base only when resolving symlinks changes the git-dir path. This follows Git setup behavior without changing normal relative path preservation for repositories without symlinked git dirs. Git baseline: git.git t1510-repo-setup.sh documents that `core.worktree` is relative to the git dir, and t7409-submodule-detached-work-tree.sh validates submodules in detached worktrees pointed to by `core.worktree`. Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
16eb8ba to
b1c1cce
Compare
Let's try to run these tests on Windows as well. They have a chance, given that the scripts executed correctly.
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.
Tasks
This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.
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.
Fixes #2052
Summary
core.worktreeconfig values against a symlink-resolved git-dir base when opening through a symlinked.git..git, detached worktree, and populated submodule.Git baseline
git.gitt1510-repo-setup.shdocuments thatcore.worktreeis relative to the git dir.git.gitt7409-submodule-detached-work-tree.shvalidates submodules in detached worktrees pointed to bycore.worktree.Validation
GIX_TEST_IGNORE_ARCHIVES=1 cargo test -p gix --test gix submodule::open::status_uses_detached_worktree_from_symlinked_git_dir -- --exact --nocaptureGIX_TEST_IGNORE_ARCHIVES=1 GIX_TEST_FIXTURE_HASH=sha256 cargo test -p gix --test gix submodule::open::status_uses_detached_worktree_from_symlinked_git_dir -- --exact --nocapturecargo test -p gix --test gix submodule::open::status_uses_detached_worktree_from_symlinked_git_dir -- --exact --nocaptureGIX_TEST_FIXTURE_HASH=sha256 cargo test -p gix --test gix submodule::open::status_uses_detached_worktree_from_symlinked_git_dir -- --exact --nocaptureGIX_TEST_IGNORE_ARCHIVES=1 cargo test -p gix --test gix submodule::open -- --nocaptureGIX_TEST_IGNORE_ARCHIVES=1 cargo test -p gix --test gix repository::worktree::with_core_worktree_config -- --nocapturecargo test -p gix --test gixcargo test -p gix --no-default-features --test gix submodule::open::status_uses_detached_worktree_from_symlinked_git_dir -- --exact --nocapturecargo test -p gix --test gix linked_worktree_proxy_base -- --nocapturegit diff --checkcodex review --commit 8a4d48196bde30fcf5300bc3159210b9afa6607efound no correctness issues.