fix: target decision center data repo
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user