chore: generate
This commit is contained in:
@@ -181,19 +181,17 @@ const ensureWithServices = Effect.fn("RepositoryCache.ensureWithServices")(funct
|
|||||||
),
|
),
|
||||||
() =>
|
() =>
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
yield* services.fs
|
yield* services.fs.ensureDir(path.dirname(localPath)).pipe(
|
||||||
.ensureDir(path.dirname(localPath))
|
Effect.catch((error: unknown) =>
|
||||||
.pipe(
|
Effect.fail(
|
||||||
Effect.catch((error: unknown) =>
|
new CacheOperationError({
|
||||||
Effect.fail(
|
operation: "ensure cache directory",
|
||||||
new CacheOperationError({
|
path: localPath,
|
||||||
operation: "ensure cache directory",
|
message: errorMessage(error),
|
||||||
path: localPath,
|
}),
|
||||||
message: errorMessage(error),
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
|
)
|
||||||
|
|
||||||
const exists = yield* services.fs.existsSafe(localPath)
|
const exists = yield* services.fs.existsSafe(localPath)
|
||||||
const hasGitDir = yield* services.fs.existsSafe(path.join(localPath, ".git"))
|
const hasGitDir = yield* services.fs.existsSafe(path.join(localPath, ".git"))
|
||||||
@@ -203,19 +201,17 @@ const ensureWithServices = Effect.fn("RepositoryCache.ensureWithServices")(funct
|
|||||||
const originReference = origin?.exitCode === 0 ? parseRepositoryReference(origin.text().trim()) : undefined
|
const originReference = origin?.exitCode === 0 ? parseRepositoryReference(origin.text().trim()) : undefined
|
||||||
const reuse = hasGitDir && Boolean(originReference && sameRepositoryReference(originReference, cloneTarget))
|
const reuse = hasGitDir && Boolean(originReference && sameRepositoryReference(originReference, cloneTarget))
|
||||||
if (exists && !reuse) {
|
if (exists && !reuse) {
|
||||||
yield* services.fs
|
yield* services.fs.remove(localPath, { recursive: true }).pipe(
|
||||||
.remove(localPath, { recursive: true })
|
Effect.catch((error: unknown) =>
|
||||||
.pipe(
|
Effect.fail(
|
||||||
Effect.catch((error: unknown) =>
|
new CacheOperationError({
|
||||||
Effect.fail(
|
operation: "remove stale cache",
|
||||||
new CacheOperationError({
|
path: localPath,
|
||||||
operation: "remove stale cache",
|
message: errorMessage(error),
|
||||||
path: localPath,
|
}),
|
||||||
message: errorMessage(error),
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentBranch = hasGitDir ? yield* services.git.branch(localPath) : undefined
|
const currentBranch = hasGitDir ? yield* services.git.branch(localPath) : undefined
|
||||||
|
|||||||
Reference in New Issue
Block a user