Skip to content

Commit 409ba22

Browse files
authored
fix(core): ignore unavailable project copy roots (anomalyco#32234)
1 parent 252223a commit 409ba22

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

packages/core/src/project/copy.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ export const layer = Layer.effect(
245245
(sourceDirectory) =>
246246
Effect.forEach(strategies(), (strategy) =>
247247
strategy.list(sourceDirectory).pipe(
248+
Effect.catchTag("ProjectCopy.DirectoryUnavailableError", () => Effect.succeed([])),
248249
Effect.map((items) =>
249250
items.map((item) => ({
250251
directory: item.directory,

packages/core/test/project-copy.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,18 @@ describe("ProjectCopy", () => {
365365
}),
366366
)
367367

368+
it.live("refresh ignores existing directories that are no longer git checkouts", () =>
369+
Effect.gen(function* () {
370+
const input = yield* setup()
371+
yield* Effect.promise(() => fs.rm(path.join(input.sourceDirectory, ".git"), { recursive: true }))
372+
const copy = yield* ProjectCopy.Service
373+
374+
yield* copy.refresh({ projectID: input.projectID })
375+
376+
expect(yield* stored(input.projectID)).toEqual([{ directory: input.sourceDirectory, strategy: null }])
377+
}),
378+
)
379+
368380
it.live("refresh with no roots is a no-op", () =>
369381
Effect.gen(function* () {
370382
const copy = yield* ProjectCopy.Service

0 commit comments

Comments
 (0)