mirror of
https://github.com/openclaw/openclaw.git
synced 2026-10-03 09:39:25 +00:00
test(pr): reuse repeated merge fixture histories (#162816)
Cache uncustomized source-version sequences in the existing immutable Git fixture template. Each case retains private refs, index, objects, remote and worktree; custom attribution and promisor clones stay fresh. Crabbox A-B-B-A passed all 48 cases per arm: candidates 69.04-72.01s versus baselines 75.80s and 94.83s. Baseline drift limits percentage precision. The target, 167 sibling cases and all 18 selected checks passed. Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
parent
b0324be63c
commit
f05948c9a3
1 changed files with 8 additions and 12 deletions
|
|
@ -61,7 +61,7 @@ export function createMergeGitFixtureFactory(directory: string, gitEnv: NodeJS.P
|
||||||
const base = seed.commit(seed.tree("before\n"), []);
|
const base = seed.commit(seed.tree("before\n"), []);
|
||||||
seed.git(["update-ref", "refs/heads/main", base]);
|
seed.git(["update-ref", "refs/heads/main", base]);
|
||||||
const copyOptions = { recursive: true, mode: fsConstants.COPYFILE_FICLONE };
|
const copyOptions = { recursive: true, mode: fsConstants.COPYFILE_FICLONE };
|
||||||
let prepared: ReturnType<typeof createSourceFixture> | undefined;
|
const preparedSources = new Map<string, ReturnType<typeof createSourceFixture>>();
|
||||||
|
|
||||||
function createSourceFixture(
|
function createSourceFixture(
|
||||||
fixtureRoot: string,
|
fixtureRoot: string,
|
||||||
|
|
@ -136,15 +136,8 @@ export function createMergeGitFixtureFactory(directory: string, gitEnv: NodeJS.P
|
||||||
promisor = false,
|
promisor = false,
|
||||||
sourceAuthor?: { name: string; email: string },
|
sourceAuthor?: { name: string; email: string },
|
||||||
) => {
|
) => {
|
||||||
// Attribution, multi-commit and filtered-clone cases still construct their own source history.
|
// Attribution and filtered-clone cases still construct their own source history.
|
||||||
if (
|
if (sourceMessage !== undefined || sourceAuthor !== undefined || promisor) {
|
||||||
sourceMessage !== undefined ||
|
|
||||||
sourceAuthor !== undefined ||
|
|
||||||
promisor ||
|
|
||||||
sourceVersions.length !== 1 ||
|
|
||||||
sourceVersions[0]?.[0] !== "after\n" ||
|
|
||||||
sourceVersions[0]?.[1] !== undefined
|
|
||||||
) {
|
|
||||||
return createSourceFixture(
|
return createSourceFixture(
|
||||||
fixtureRoot,
|
fixtureRoot,
|
||||||
sourceMessage,
|
sourceMessage,
|
||||||
|
|
@ -153,10 +146,13 @@ export function createMergeGitFixtureFactory(directory: string, gitEnv: NodeJS.P
|
||||||
sourceAuthor,
|
sourceAuthor,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
const sourceKey = JSON.stringify(sourceVersions);
|
||||||
|
let prepared = preparedSources.get(sourceKey);
|
||||||
if (!prepared) {
|
if (!prepared) {
|
||||||
const preparedRoot = join(root, "prepared");
|
const preparedRoot = join(root, `prepared-${preparedSources.size}`);
|
||||||
mkdirSync(preparedRoot);
|
mkdirSync(preparedRoot);
|
||||||
prepared = createSourceFixture(preparedRoot);
|
prepared = createSourceFixture(preparedRoot, undefined, sourceVersions);
|
||||||
|
preparedSources.set(sourceKey, prepared);
|
||||||
}
|
}
|
||||||
const fixtureRepo = join(fixtureRoot, "repo");
|
const fixtureRepo = join(fixtureRoot, "repo");
|
||||||
const fixtureRemote = join(fixtureRoot, "remote.git");
|
const fixtureRemote = join(fixtureRoot, "remote.git");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue