fix(server): honor submodule settings when creating worktrees (#15594)
This commit is contained in:
1 parent
9d029a1df2
commit
3e6b45028c
2 files changed
+21
-1
No files matched your search
@@ -35,6 +35,8 @@ import {
|
||||
type SourceControlProviderKind,
|
||||
type SourceControlWritingStyleSettings,
|
||||
type ThreadId,
|
||||
type VcsCreateWorktreeInput,
|
||||
type VcsCreateWorktreeResult,
|
||||
} from "@t3tools/contracts";
|
||||
import {
|
||||
hasProjectSettingsOverrides,
|
||||
@@ -103,6 +105,10 @@ interface SourceControlTextGenerationSettings {
|
||||
export class GitManager extends Context.Service<
|
||||
GitManager,
|
||||
{
|
||||
readonly createWorktree: (
|
||||
input: VcsCreateWorktreeInput,
|
||||
options?: GitVcsDriver.CreateWorktreeOptions,
|
||||
) => Effect.Effect<VcsCreateWorktreeResult, GitCommandError>;
|
||||
readonly status: (
|
||||
input: VcsStatusInput,
|
||||
) => Effect.Effect<VcsStatusResult, GitManagerServiceError>;
|
||||
@@ -727,6 +733,19 @@ export const make = Effect.gen(function* () {
|
||||
);
|
||||
return resolveProjectSettings(settings, projectId).settings;
|
||||
});
|
||||
const createWorktree: GitManager["Service"]["createWorktree"] = Effect.fn(
|
||||
"GitManager.createWorktree",
|
||||
)(function* (input, options) {
|
||||
const submodules =
|
||||
options?.submodules !== undefined
|
||||
? options.submodules
|
||||
: yield* projectSettingsFor(input).pipe(
|
||||
Effect.map((settings) => settings.worktreeSubmodules),
|
||||
Effect.orElseSucceed(() => null),
|
||||
);
|
||||
return yield* gitCore.createWorktree(input, { ...options, submodules });
|
||||
});
|
||||
|
||||
const readRepositoryInstructions = (cwd: string, fileName: string) =>
|
||||
Effect.gen(function* () {
|
||||
const root = yield* fileSystem.realPath(cwd);
|
||||
@@ -2849,6 +2868,7 @@ export const make = Effect.gen(function* () {
|
||||
);
|
||||
|
||||
return GitManager.of({
|
||||
createWorktree,
|
||||
localStatus,
|
||||
remoteStatus,
|
||||
status,
|
||||
|
||||
@@ -347,7 +347,7 @@ export const make = Effect.gen(function* () {
|
||||
),
|
||||
createWorktree: (input, options) =>
|
||||
ensureGitCommand("GitWorkflowService.createWorktree", input.cwd).pipe(
|
||||
Effect.andThen(git.createWorktree(input, options)),
|
||||
Effect.andThen(gitManager.createWorktree(input, options)),
|
||||
),
|
||||
listLocalBranchNames: (cwd) =>
|
||||
ensureGitCommand("GitWorkflowService.listLocalBranchNames", cwd).pipe(
|
||||
|
||||
Reference in new issue
Block a user