Skip to content

Add comprehensive worktree support across wrapper/corehooks/both#528

Open
svarlamov wants to merge 6 commits intofeat/corehooksfrom
codex/worktree-support-corehooks
Open

Add comprehensive worktree support across wrapper/corehooks/both#528
svarlamov wants to merge 6 commits intofeat/corehooksfrom
codex/worktree-support-corehooks

Conversation

@svarlamov
Copy link
Member

@svarlamov svarlamov commented Feb 14, 2026

Summary

  • Recreate and modernize the worktree test harness from PR Worktrees in-depth support, tests #419 while preserving the current corehooks/wrapper mode matrix harness.
  • Add a dedicated tests/worktrees.rs suite covering repository discovery, storage isolation, config precedence, detached/locked/removed worktrees, and rewrite flows.
  • Add worktree wrapper variants across integration tests via worktree_test_wrappers! and extend subdir_test_variants! with worktree + -C worktree variants.
  • Add worktree snapshot coverage for initial_attributions and stats tests.
  • Implement minimal production fixes needed for robust worktree behavior:
    • Repository::config_get_str / config_get_regexp now delegate to git CLI for native worktree/includeIf precedence.
    • Repository now tracks resolved common git dir (used by tests and future worktree-aware plumbing).
    • status now forces --untracked-files=all when untracked files are included, preventing directory-collapsed paths like nested/ from dropping checkpoint attribution.

Validation

  • cargo test --no-run
  • cargo test --test worktrees -- --test-threads=1
  • GIT_AI_TEST_GIT_MODE=corehooks cargo test --test worktrees -- --test-threads=1
  • GIT_AI_TEST_GIT_MODE=both cargo test --test worktrees -- --test-threads=1
  • GIT_AI_TEST_GIT_MODE=corehooks cargo test --test checkpoint_size -- --test-threads=1
  • GIT_AI_TEST_GIT_MODE=both cargo test --test checkpoint_size -- --test-threads=1
  • GIT_AI_TEST_GIT_MODE=corehooks cargo test --test stats -- --test-threads=1
  • GIT_AI_TEST_GIT_MODE=both cargo test --test stats -- --test-threads=1
  • GIT_AI_TEST_GIT_MODE=corehooks cargo test --test initial_attributions -- --test-threads=1
  • GIT_AI_TEST_GIT_MODE=both cargo test --test initial_attributions -- --test-threads=1
  • GIT_AI_TEST_GIT_MODE=corehooks cargo test --test pull_rebase_ff -- --test-threads=1
  • GIT_AI_TEST_GIT_MODE=both cargo test --test pull_rebase_ff -- --test-threads=1

Notes

  • Existing unrelated warnings in tests/search.rs / tests/continue_session.rs remain unchanged.
  • Per request, corehooks e2e instability relative to the corehooks baseline PR can be handled in CI triage.

Open with Devin

@git-ai-cloud-dev
Copy link

git-ai-cloud-dev bot commented Feb 14, 2026

Stats powered by Git AI

🧠 you    ████████████████████  100%
🤖 ai     ░░░░░░░░░░░░░░░░░░░░  0%
More stats
  • 0.0 lines generated for every 1 accepted
  • 0 seconds waiting for AI

AI code tracked with git-ai

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 9 additional findings.

Open in Devin Review

@git-ai-cloud
Copy link

git-ai-cloud bot commented Feb 14, 2026

Stats powered by Git AI

🧠 you    ████████████████████  100%
🤖 ai     ░░░░░░░░░░░░░░░░░░░░  0%
More stats
  • 0.0 lines generated for every 1 accepted
  • 0 seconds waiting for AI

AI code tracked with git-ai

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

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.

Open in Devin Review

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