fix: target decision center data repo

This commit is contained in:
Codex
2026-07-09 18:52:01 +02:00
parent 6fc459e1fb
commit 4bb930bb36
2 changed files with 15 additions and 6 deletions
@@ -985,12 +985,21 @@ function ensureGitWorktree(): void {
mkdirSync(dirname(config.storage.worktreePath), { recursive: true });
if (!existsSync(join(config.storage.worktreePath, ".git"))) {
if (existsSync(config.storage.worktreePath)) rmSync(config.storage.worktreePath, { recursive: true, force: true });
runGit(["clone", "--branch", config.storage.branch, config.storage.repoSshUrl, config.storage.worktreePath], { cwd: dirname(config.storage.worktreePath) });
runGit(["clone", config.storage.repoSshUrl, config.storage.worktreePath], { cwd: dirname(config.storage.worktreePath) });
}
runGit(["remote", "set-url", "origin", config.storage.repoSshUrl]);
runGit(["fetch", "origin", config.storage.branch]);
runGit(["checkout", config.storage.branch]);
runGit(["pull", "--ff-only", "origin", config.storage.branch]);
const fetchedBranch = runGit(["fetch", "origin", config.storage.branch], { allowFailure: true });
if (fetchedBranch.ok) {
runGit(["checkout", "-B", config.storage.branch, `origin/${config.storage.branch}`]);
runGit(["pull", "--ff-only", "origin", config.storage.branch]);
return;
}
const hasLocalCommit = runGit(["rev-parse", "--verify", "HEAD"], { allowFailure: true });
if (hasLocalCommit.ok) {
runGit(["checkout", "-B", config.storage.branch]);
} else {
runGit(["symbolic-ref", "HEAD", `refs/heads/${config.storage.branch}`]);
}
}
function gitHeadSummary(): JsonRecord {