Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions apps/server/src/git/GitManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import {
type SourceControlProviderKind,
type SourceControlWritingStyleSettings,
type ThreadId,
type VcsCreateWorktreeInput,
type VcsCreateWorktreeResult,
} from "@t3tools/contracts";
import {
hasProjectSettingsOverrides,
Expand Down Expand Up @@ -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>;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -2848,6 +2867,7 @@ export const make = Effect.gen(function* () {
);

return GitManager.of({
createWorktree,
localStatus,
remoteStatus,
status,
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/git/GitWorkflowService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading