Repository navigation
fix(worktree): initialize submodules and preserve their local work - #445
Conversation
Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 46 minutes. View limit details
WalkthroughWorktree creation is now asynchronous and initializes submodules recursively. Removal checks root and submodule files, ignored paths, and commits in module stores before deleting a checkout. Hook checkout resolution now walks enclosing superprojects and can use an explicit project root. CLI creation uses shared promise handling. Tests were updated for asynchronous operations and expanded to cover nested submodule creation, preservation, and removal checks. Merge Risk:
|
|
Design change: A real submodule fixture reached its first devshell and stop/restore, but clean removal refused an object reachable through a cloned tag but no remote-tracking branch. Initialization fetched that tag from the remote without a separate remote-tracking ref. Preserve that signal at creation: when a new module has a tip not remotely tracked, explicitly verify that tip by fetching it to a namespaced remote-tracking ref outside origin's branch-prune refspec. Continue refusing later local commits. This verifies the object at its source; it does not trust a superproject gitlink as preservation. Add a fixture for remote-fetched refs absent from branches, then repeat both gates and a new local review. (Written by GPT-6.1 Sol) |
… tips Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
A Git hook or `git submodule foreach` exports GIT_DIR, GIT_WORK_TREE, and the other repository-local variables, which override discovery from `-C`. With them naming a submodule, the WorktreeCreate hook resolved the project to that submodule and created the checkout there, and removal checks inspected the wrong repository. Drop Git's own `--local-env-vars` list, keeping `-c` config as Git does for other repositories. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Submodule initialization clones module stores into the checkout's own Git directory, outside its path, so the disk budget never charged them, and the derived reserve skipped the main checkout's stores. Count them in each checkout's footprint and in the reserve. Removal deletes those stores, breaking any linked worktree a store serves outside the checkout. Refuse removal while one has any. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # README.md # src/cli/main.ts # src/cli/worktree-hook.ts
…uite `git submodule` is a shell script that spawns sh and five more Git processes per call, which costs seconds on Windows runners. Since #445, every create, release, and removal ran it even without submodules, pushing worktree tests past their timeout on windows-11-arm. List initialized submodules from the index's gitlinks instead, and run `submodule update --init` only when the checkout has any. Fix the suite's other Windows failures where each lies: compare text that Git checks out with core.autocrlf with line endings normalized, expect PATH joined with path.delimiter, and await main for `worktree create`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
refs/remotes/quest-pins/, outside origin's branch-prune namespace. Fetch cloned tags by name, then batch any remaining SHA-only tips. This preserves fetched pins and tags without treating a pushed superproject gitlink as an uploaded module object.worktree.tsandworktree-hook.tswithout the repository-local variables (git rev-parse --local-env-vars, keeping-cconfig as Git does for other repositories). A Git hook orgit submodule foreachexportsGIT_DIR/GIT_WORK_TREE, which override-Cdiscovery: with them naming a submodule, the hook created the worktree inside the submodule and removal checks inspected the wrong repository.Claude Code's standard WorktreeCreate hook is the immediate consumer. This adds module support without a new post-create configuration API.
Merged with main after moq-dev/quest#425 landed, keeping both behaviors: a subagent hook walks up from a submodule cwd to the first registered checkout, then applies #425's
agent-<id>match or workflow-agent binding; WorktreeCreate fetches apr-<number>head through the project-routed checkout, falling back to the default base. Main's new gate-scope tests now await this PR's async run fixture, and a regression test binds a workflow agent that starts inside a submodule of its checkout.Checks
just checkandjust testpass on adb28aa66f4b8cbf9a8a5087d930795b7b4b0a48: 1001 CLI tests, 2 skipped; 508 Worker tests; bundled/native lifecycle and shell suites.GIT_DIR/GIT_WORK_TREE/GIT_INDEX_FILEcreatedrepo/sub/.worktrees/agent-located; a 1 MiB module store went uncharged (allocated 1073152); removal deleted a module store serving a linked worktree.Review
quest review --base origin/main --harness codex --new(Claude Code authored the latest commits).(Written by GPT-6.1 Sol and Claude Opus 5.5)
🤖 Generated with Claude Code