History

port desktop app to Effect (#2546)

Julius Marminge committed 6 months ago

Commit aa219be1 parent dd32f52186 files · +13522 −7058Browse files

Showing the changes to apps/server/src/sourceControl/SourceControlRepositoryService.ts (1 of 186 files). Show all

Unified · Split

apps/server/src/sourceControl/SourceControlRepositoryService.ts+15−21
@@ -153,13 +153,11 @@ export const make = Effect.fn("makeSourceControlRepositoryService")(function* () · 152 unmodified lines
153 function* (destinationPath: string) {153 function* (destinationPath: string) {
154 const trimmed = destinationPath.trim();154 const trimmed = destinationPath.trim();
155 if (trimmed.length === 0) {155 if (trimmed.length === 0) {
156 return yield* Effect.fail(156 return yield* repositoryError({
157 repositoryError({157 operation: "cloneRepository",
158 operation: "cloneRepository",158 provider: "unknown",
159 provider: "unknown",159 detail: "Choose a destination path before cloning.",
160 detail: "Choose a destination path before cloning.",160 });
161 }),
162 );
163 }161 }
164 162
165 return path.resolve(expandHomePath(trimmed, path));163 return path.resolve(expandHomePath(trimmed, path));
@@ -183,13 +181,11 @@ export const make = Effect.fn("makeSourceControlRepositoryService")(function* () · 17 unmodified lines
183 ),181 ),
184 );182 );
185 if (entries.length > 0) {183 if (entries.length > 0) {
186 return yield* Effect.fail(184 return yield* repositoryError({
187 repositoryError({185 operation: "cloneRepository",
188 operation: "cloneRepository",186 provider: "unknown",
189 provider: "unknown",187 detail: "Destination path already exists and is not empty.",
190 detail: "Destination path already exists and is not empty.",188 });
191 }),
192 );
193 }189 }
194 } else {190 } else {
195 yield* fileSystem.makeDirectory(path.dirname(normalizedDestination), { recursive: true });191 yield* fileSystem.makeDirectory(path.dirname(normalizedDestination), { recursive: true });
@@ -222,13 +218,11 @@ export const make = Effect.fn("makeSourceControlRepositoryService")(function* () · 26 unmodified lines
222 }218 }
223 219
224 if (!remoteUrl) {220 if (!remoteUrl) {
225 return yield* Effect.fail(221 return yield* repositoryError({
226 repositoryError({222 operation: "cloneRepository",
227 operation: "cloneRepository",223 provider,
228 provider,224 detail: "Enter a repository path or clone URL before cloning.",
229 detail: "Enter a repository path or clone URL before cloning.",225 });
230 }),
231 );
232 }226 }
233 227
234 yield* git.execute({228 yield* git.execute({