feat(settings): choose how new worktrees initialize submodules #12955
Mergedjuliusmarmingemerged 8 commits into
worktree-submodules/env-mode-chain fromrefs/pull/12955/headmerged by juliusmarminge View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/web/src/components/settings/ProjectDefaultsSettings.tsx lines 101 to 105OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -87,3 +94,12 @@8794 category === "general" && checkout ? checkout.workspaceRoot : null,8895 );8996 const repositoryEnvMode = t3File.file?.defaultThreadEnvMode ?? null;97+ // Submodules resolve the other way round: a setting on either scope beats98+ // the file, and "inherit" (null) is what lets the file decide.99+ const repositorySubmodules = t3File.file?.worktreeSubmodules ?? null;100+ const inheritedSubmodulesLabel =101+ settings.worktreeSubmodules !== null102+ ? null103+ : repositorySubmodules104+ ? `${WORKTREE_SUBMODULES_LABELS[repositorySubmodules]} (t3.json)`105+ : WORKTREE_SUBMODULES_LABELS.recursive;apps/mobile/src/features/settings/SettingsServerControlsRouteScreen.tsx line 289Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -248,3 +268,16 @@248268 />249269 ))}250270 </SettingsSection>271+ <SettingsSection272+ title="Worktree submodules"273+ trailing={274+ pendingWrites === 0 && isMixed("worktreeSubmodules") ? (275+ <MixedValuesLabel projectSelected={projectSelected} />276+ ) : null277+ }278+ >279+ {SUBMODULE_CHOICES.map((choice, index) => (280+ <ChoiceRow281+ key={choice.mode ?? "inherit"}282+ label={choice.label}283+ description={choice.description}
- apps/mobile/src/features/settings/SettingsServerControlsRouteScreen.tsx line 296Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -250 +270,21 @@250270 </SettingsSection>271+ <SettingsSection272+ title="Worktree submodules"273+ trailing={274+ pendingWrites === 0 && isMixed("worktreeSubmodules") ? (275+ <MixedValuesLabel projectSelected={projectSelected} />276+ ) : null277+ }278+ >279+ {SUBMODULE_CHOICES.map((choice, index) => (280+ <ChoiceRow281+ key={choice.mode ?? "inherit"}282+ label={choice.label}283+ description={choice.description}284+ selected={285+ !isMixed("worktreeSubmodules") &&286+ uniform("worktreeSubmodules") === choice.mode287+ }288+ separated={index > 0}289+ disabled={disabledFor("worktreeSubmodules")}290+ onPress={() => write({ worktreeSubmodules: choice.mode })}apps/server/src/ws.ts lines 1540 to 1546Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -1505,7 +1540,7 @@15051540 threadId,15061541 "submodules",15071542 "skipped",1508- "disabled in t3.json",1543+ "disabled in settings",15091544 ),15101545 onSubmoduleLine: (line) => {15111546 const submodulePath = /Submodule path '([^']+)'/.exec(line)?.[1];apps/web/src/components/settings/ProjectDefaultsSettings.tsx line 361OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -325,3 +341,21 @@325341 </Select>326342 }327343 />344+ <SettingsRow345+ serverScoped346+ settingKeys={["worktreeSubmodules"]}347+ mixed={mixedSubmodules}348+ {...searchableSetting("worktree-submodules")}349+ description={350+ isProjectScope351+ ? "How new worktrees populate git submodules. Inherit follows the environment, then the repository's t3.json."352+ : "How new worktrees populate git submodules. Inherit follows the repository's t3.json, or initializes them recursively."353+ }354+ status={355+ inheritedSubmodulesLabel ? `Resolves to: ${inheritedSubmodulesLabel}` : undefined356+ }357+ control={358+ <Select359+ value={mixedSubmodules ? null : (settings.worktreeSubmodules ?? "inherit")}360+ onValueChange={(value) => {361+ if (value === "inherit") updateSettings({ worktreeSubmodules: null });docs/user/project-settings.md line 58OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -55,5 +55,4 @@5555 Browser access changes apply when an agent session next starts.56565757 New worktrees initialize git submodules recursively. If that step is slow because the repository58-declares many nested submodules, set `"worktreeSubmodules"` in `t3.json` to `"top-level"` to stop59-at the ones the repository declares itself, or `"none"` to leave them for a setup script.58+declares many nested submodules, set **Submodules** under **Settings → Project** to **Top level
- apps/server/src/orchestration/Layers/ProviderCommandReactor.ts line 504OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -501,3 +501,4 @@501501 });502502 // A directory deleted without `git worktree remove` leaves an admin entry503503 // that makes `git worktree add` refuse the path; prune clears it.504+ const { worktreeSubmodules: submodules } = yield* projectSettingsForThread(thread.id);
- apps/server/src/orchestration/Layers/ProviderCommandReactor.ts lines 504 to 508OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -501,5 +501,8 @@501501 });502502 // A directory deleted without `git worktree remove` leaves an admin entry503503 // that makes `git worktree add` refuse the path; prune clears it.504+ const { worktreeSubmodules: submodules } = yield* projectSettingsForThread(thread.id);504505 yield* gitWorkflow.pruneWorktrees({ cwd }).pipe(505- Effect.andThen(gitWorkflow.createWorktree({ cwd, refName: branch, path: worktreePath })),506+ Effect.andThen(507+ gitWorkflow.createWorktree({ cwd, refName: branch, path: worktreePath }, { submodules }),508+ ),packages/contracts/src/settings.ts line 1031OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -1027,3 +1028,4 @@10271028 defaultRuntimeMode: Schema.optionalKey(RuntimeMode),10281029 defaultThreadEnvMode: Schema.optionalKey(ThreadEnvMode),10291030 newWorktreesStartFromOrigin: Schema.optionalKey(Schema.Boolean),1031+ worktreeSubmodules: Schema.optionalKey(Schema.NullOr(WorktreeSubmodules)),
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:XL
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- packages/contracts/src/settings.ts line 1032Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1027,3 +1029,4 @@10271029 defaultRuntimeMode: Schema.optionalKey(RuntimeMode),10281030 defaultThreadEnvMode: Schema.optionalKey(ThreadEnvMode),10291031 newWorktreesStartFromOrigin: Schema.optionalKey(Schema.Boolean),1032+ worktreeSubmodules: ForwardCompatibleOptional(WorktreeSubmodules),
juliusmarminge merged this0141bc2
juliusmarminge closed this
Sign in to join this conversation.





macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed