mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-14 04:08:05 +00:00
Merge branch 'main' into rios/fix-generated-regression-merge-base
This commit is contained in:
commit
a7d1920a92
3 changed files with 53 additions and 2 deletions
|
|
@ -1363,7 +1363,10 @@ export async function runFullAnalysis(
|
|||
runnerIdentityAtBootstrap,
|
||||
);
|
||||
if (flatShared) {
|
||||
await publishSharedGraph(flatShared, repoPath, writeTarget.currentCommit, log);
|
||||
await publishSharedGraph(flatShared, repoPath, writeTarget.currentCommit, log, {
|
||||
name: options.registryName,
|
||||
allowDuplicateName: options.allowDuplicateName,
|
||||
});
|
||||
} else if (!writeTarget.sharedStore) {
|
||||
// Also for a `--branch` run routed to a local branch sub-slot: the
|
||||
// checkout still leaves the store.
|
||||
|
|
|
|||
|
|
@ -372,6 +372,7 @@ export const publishSharedGraph = async (
|
|||
repoPath: string,
|
||||
currentCommit: string,
|
||||
log: Log,
|
||||
registryOptions: { name?: string; allowDuplicateName?: boolean } = {},
|
||||
): Promise<void> => {
|
||||
const slot = layout.checkoutSlot;
|
||||
const meta = await loadMeta(slot);
|
||||
|
|
@ -493,7 +494,11 @@ export const publishSharedGraph = async (
|
|||
const moved =
|
||||
previous !== undefined &&
|
||||
!registryPathEquals(canonicalizePath(previous.storagePath), canonicalizePath(slot));
|
||||
await registerRepo(repoPath, meta, { storagePath: slot, dropBranches: moved });
|
||||
await registerRepo(repoPath, meta, {
|
||||
...registryOptions,
|
||||
storagePath: slot,
|
||||
dropBranches: moved,
|
||||
});
|
||||
await writeSharedStorePointer(repoPath, layout);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import {
|
|||
getStoragePaths,
|
||||
listRegisteredRepos,
|
||||
loadMeta,
|
||||
registerRepo,
|
||||
saveMeta,
|
||||
} from '../../src/storage/repo-manager.js';
|
||||
import type { RepoMeta } from '../../src/storage/repo-meta.js';
|
||||
|
|
@ -321,6 +322,48 @@ describe('publishSharedGraph race (#3352)', () => {
|
|||
return { checkouts: [main, wt], head };
|
||||
};
|
||||
|
||||
it.each(['main', 'custom-alias'])(
|
||||
'preserves explicit registry name %s after shared-store registration',
|
||||
async (registryName) => {
|
||||
const { checkouts, head } = await setup();
|
||||
const [main] = checkouts;
|
||||
const layout = layoutOf(main);
|
||||
const meta = await loadMeta(layout.checkoutSlot);
|
||||
if (!meta) throw new Error('Shared-store fixture is missing metadata');
|
||||
git(main, 'remote', 'add', 'origin', 'https://example.com/team/remote-name.git');
|
||||
await registerRepo(main, meta, { name: registryName, storagePath: layout.checkoutSlot });
|
||||
|
||||
await publishSharedGraph(layout, main, head, () => {}, { name: registryName });
|
||||
|
||||
const entry = (await listRegisteredRepos()).find((repo) => repo.path === main);
|
||||
expect(entry?.name).toBe(registryName);
|
||||
expect(entry?.storagePath).toBe(layout.checkoutSlot);
|
||||
},
|
||||
);
|
||||
|
||||
it('keeps an explicitly permitted duplicate name through shared publication', async () => {
|
||||
const { checkouts, head } = await setup();
|
||||
for (const checkout of checkouts) {
|
||||
const slot = layoutOf(checkout).checkoutSlot;
|
||||
const meta = await loadMeta(slot);
|
||||
if (!meta) throw new Error('Shared-store fixture is missing metadata');
|
||||
await registerRepo(checkout, meta, {
|
||||
name: 'shared-alias',
|
||||
allowDuplicateName: true,
|
||||
storagePath: slot,
|
||||
});
|
||||
}
|
||||
|
||||
const checkout = checkouts[1];
|
||||
await publishSharedGraph(layoutOf(checkout), checkout, head, () => {}, {
|
||||
name: 'shared-alias',
|
||||
allowDuplicateName: true,
|
||||
});
|
||||
|
||||
const entry = (await listRegisteredRepos()).find((repo) => repo.path === checkout);
|
||||
expect(entry?.name).toBe('shared-alias');
|
||||
});
|
||||
|
||||
it('Covers AE6: two checkouts publishing one new commit produce exactly one graph', async () => {
|
||||
const { checkouts } = await setup();
|
||||
await Promise.all(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue