Skip to content

fix: initialize submodules in new worktrees#942

Merged
njbrake merged 3 commits intomainfrom
fix/init-submodules-in-worktrees
May 7, 2026
Merged

fix: initialize submodules in new worktrees#942
njbrake merged 3 commits intomainfrom
fix/init-submodules-in-worktrees

Conversation

@njbrake
Copy link
Copy Markdown
Owner

@njbrake njbrake commented May 6, 2026

Description

  • initialize submodules after creating a new git worktree when the checkout contains a .gitmodules file
  • allow local-path submodule URLs for that update step so workspace-local .claude style submodules populate correctly
  • add a regression test that creates a real local submodule and verifies its contents appear in the new worktree
  • closes Worktrees don't copy submodules #932

Verification:

  • cargo test --lib create_worktree_initializes_submodules
  • cargo test --lib create_worktree

PR Type

  • New Feature
  • Bug Fix
  • Refactor
  • Documentation
  • Infrastructure / CI

Checklist

  • I understand the code I am submitting
  • New and existing tests pass
  • Documentation was updated where necessary
  • For UI changes: included screenshot or recording

AI Usage

  • No AI was used
  • AI was used for drafting/refactoring
  • This is fully AI-generated

AI Model/Tool used:
Codex (GPT-5)

Any Additional AI Details you would like to share:
Implemented the worktree submodule initialization fix and regression test directly from issue triage for #932.

  • I am an AI Agent filling out this form (check box if true)

@Seluj78
Copy link
Copy Markdown

Seluj78 commented May 7, 2026

Tested locally, I can confirm my .claude submodule was copied ;)

@Seluj78
Copy link
Copy Markdown

Seluj78 commented May 7, 2026

Ah well, sorry I didn't test far enough, I switched to another branch (fix/separate-session-title-and-branch) and when I tried to delete the session I created I got this error (expected since I no longer had the code to delete the submodule)

Screenshot 2026-05-07 at 07 42 15

@njbrake
Copy link
Copy Markdown
Owner Author

njbrake commented May 7, 2026

Ah well, sorry I didn't test far enough, I switched to another branch (fix/separate-session-title-and-branch) and when I tried to delete the session I created I got this error (expected since I no longer had the code to delete the submodule)

In this case, I think we have a 'force' delete option that should still let you remove the session 🤞

@Seluj78
Copy link
Copy Markdown

Seluj78 commented May 7, 2026

yess it worked perfectly for this 😎

@njbrake
Copy link
Copy Markdown
Owner Author

njbrake commented May 7, 2026

@Seluj78 thank you for all the testing this is suuuuuper helpful 🙏 🚀

@njbrake njbrake merged commit af9b2ea into main May 7, 2026
11 checks passed
@njbrake njbrake deleted the fix/init-submodules-in-worktrees branch May 7, 2026 09:12
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.

Worktrees don't copy submodules

2 participants