mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 04:47:03 -06:00
refactor(projects): remove duplicate origin lookup
Amp-Thread-ID: https://ampcode.com/threads/T-019ff438-3b93-77b8-9828-1d3c586cb127
This commit is contained in:
@@ -9,7 +9,6 @@ import { withOpenClawStateLease } from "../state/openclaw-state-lease.js";
|
||||
import { cloneProjectCheckout, ProjectCloneError } from "./project-clone-runtime.js";
|
||||
import { parseProjectGitUrl } from "./project-git-url.js";
|
||||
import {
|
||||
findProjectRegistryByOrigin,
|
||||
listProjectRegistry,
|
||||
registerClonedProjectRegistry,
|
||||
type ProjectRegistryRecord,
|
||||
@@ -64,9 +63,7 @@ export async function materializeProjectClone(
|
||||
operationLabel: "projects.clone.lease",
|
||||
},
|
||||
async (lease) => {
|
||||
const raced =
|
||||
existingCanonicalProject(input.cfg, parsed.url, options) ??
|
||||
findProjectRegistryByOrigin(parsed.url, options);
|
||||
const raced = existingCanonicalProject(input.cfg, parsed.url, options);
|
||||
if (raced) {
|
||||
return raced;
|
||||
}
|
||||
|
||||
@@ -224,18 +224,6 @@ export async function registerClonedProjectRegistry(
|
||||
);
|
||||
}
|
||||
|
||||
export function findProjectRegistryByOrigin(
|
||||
originUrl: string,
|
||||
options: OpenClawStateDatabaseOptions = {},
|
||||
): ProjectRegistryRecord | undefined {
|
||||
const { sqlite, kysely } = openProjectsDatabase(options);
|
||||
const row = executeSqliteQueryTakeFirstSync(
|
||||
sqlite,
|
||||
kysely.selectFrom("projects").selectAll().where("origin_url", "=", originUrl),
|
||||
);
|
||||
return row ? rowToProject(row) : undefined;
|
||||
}
|
||||
|
||||
export function listProjectRegistry(
|
||||
cfg: OpenClawConfig,
|
||||
options: OpenClawStateDatabaseOptions = {},
|
||||
|
||||
Reference in New Issue
Block a user