fix addressed registry recovery blockers
This commit is contained in:
@@ -132,6 +132,11 @@ export class GitWorkspaceRepository {
|
||||
private validateRevision(revision: string): void {
|
||||
if (!/^[0-9a-f]{40}$/.test(revision)) throw new WorkspaceRegistryError("workspace_invalid", "Workspace revision is invalid");
|
||||
}
|
||||
async parentOf(revision: string): Promise<string | undefined> {
|
||||
this.validateRevision(revision);
|
||||
return (await this.gitOptional(["rev-parse", `${revision}^`]))?.trim();
|
||||
}
|
||||
|
||||
async workspacePathsAt(revision: string): Promise<string[]> {
|
||||
this.validateRevision(revision);
|
||||
const output = await this.git(["ls-tree", "-r", "--name-only", revision, "--", "workspaces"]);
|
||||
@@ -221,6 +226,24 @@ export class GitWorkspaceRepository {
|
||||
await rm(join(this.repoPath, path), { force: true });
|
||||
}
|
||||
|
||||
/** Push an already-created commit by its exact object ID. Repeating this is idempotent. */
|
||||
async pushExact(revision: string): Promise<void> {
|
||||
this.validateRevision(revision);
|
||||
try {
|
||||
await this.git(["push", "origin", `${revision}:refs/heads/${this.config.branch}`]);
|
||||
} catch (error) {
|
||||
throw this.sanitizeGitError(error);
|
||||
}
|
||||
}
|
||||
|
||||
/** Create a local publication commit without contacting the remote. */
|
||||
async commitOnly(paths: readonly string[], message: string): Promise<GitStatus> {
|
||||
if (paths.length === 0 || paths.some((path) => !this.isRegistryArtifactPath(path))) throw new WorkspaceRegistryError("workspace_invalid", "Workspace repository path is invalid");
|
||||
await this.git(["add", "--", ...paths]);
|
||||
await this.git(["commit", "-m", message], this.publicationIdentity());
|
||||
return await this.status();
|
||||
}
|
||||
|
||||
/** Commit and push a fixed set of validated artifact paths without exposing Git output. */
|
||||
async commitAndPush(paths: readonly string[], message: string): Promise<GitStatus> {
|
||||
if (paths.length === 0 || paths.some((path) => !this.isRegistryArtifactPath(path))) {
|
||||
|
||||
Reference in New Issue
Block a user