Add comprehensive worktree support across wrapper/corehooks/both#528
Add comprehensive worktree support across wrapper/corehooks/both#528svarlamov wants to merge 6 commits intofeat/corehooksfrom
Conversation
There was a problem hiding this comment.
Devin Review found 1 new potential issue.
🐛 1 issue in files not directly in the diff
🐛 config_get_regexp returns lowercase keys but caller uses camelCase for rebase.autoStash lookup (src/commands/hooks/fetch_hooks.rs:289-291)
The config_get_regexp implementation (both old gix_config and new git config --get-regexp CLI) returns keys with lowercased section and variable names (git's canonical form). For example, rebase.autoStash becomes rebase.autostash in the returned HashMap. However, the caller in fetch_hooks.rs:290 does .get("rebase.autoStash") with camelCase, which is a case-sensitive HashMap lookup that will never match.
Root Cause and Impact
When git config --get-regexp "^(pull\.rebase|rebase\.autoStash)$" is executed, it outputs:
rebase.autostash true
The new code at src/git/repository.rs:1094-1097 correctly parses this into the HashMap with key rebase.autostash. The old gix_config implementation also lowercased via value_name.to_string().to_lowercase(), producing the same key.
But the caller at src/commands/hooks/fetch_hooks.rs:289-291:
config
.get("rebase.autoStash")
.map(|v| v.to_lowercase() == "true")
.unwrap_or(false)Since HashMap::get is case-sensitive, "rebase.autoStash" != "rebase.autostash", so the lookup always returns None and autostash detection from git config is silently ignored, defaulting to false. Users who set rebase.autoStash = true in their git config won't get autostash behavior detected by the hook system unless they also pass --autostash on the CLI.
View 17 additional findings in Devin Review.
Summary
tests/worktrees.rssuite covering repository discovery, storage isolation, config precedence, detached/locked/removed worktrees, and rewrite flows.worktree_test_wrappers!and extendsubdir_test_variants!with worktree +-Cworktree variants.initial_attributionsandstatstests.Repository::config_get_str/config_get_regexpnow delegate to git CLI for native worktree/includeIf precedence.Repositorynow tracks resolved common git dir (used by tests and future worktree-aware plumbing).statusnow forces--untracked-files=allwhen untracked files are included, preventing directory-collapsed paths likenested/from dropping checkpoint attribution.Validation
cargo test --no-runcargo test --test worktrees -- --test-threads=1GIT_AI_TEST_GIT_MODE=corehooks cargo test --test worktrees -- --test-threads=1GIT_AI_TEST_GIT_MODE=both cargo test --test worktrees -- --test-threads=1GIT_AI_TEST_GIT_MODE=corehooks cargo test --test checkpoint_size -- --test-threads=1GIT_AI_TEST_GIT_MODE=both cargo test --test checkpoint_size -- --test-threads=1GIT_AI_TEST_GIT_MODE=corehooks cargo test --test stats -- --test-threads=1GIT_AI_TEST_GIT_MODE=both cargo test --test stats -- --test-threads=1GIT_AI_TEST_GIT_MODE=corehooks cargo test --test initial_attributions -- --test-threads=1GIT_AI_TEST_GIT_MODE=both cargo test --test initial_attributions -- --test-threads=1GIT_AI_TEST_GIT_MODE=corehooks cargo test --test pull_rebase_ff -- --test-threads=1GIT_AI_TEST_GIT_MODE=both cargo test --test pull_rebase_ff -- --test-threads=1Notes
tests/search.rs/tests/continue_session.rsremain unchanged.