Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): repository identity honors the gh default remote #21574

Mergedjuliusmarmingemerged 16 commits intomain fromrefs/pull/21574/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 94 additions and 39 deletions.

x
0 of 2 viewed, 2 left
40 additions and 0 deletionsapps/server/src/project/RepositoryIdentityResolver.test.tsModified
View file
@@ -344,6 +344,46 @@
}).pipe(Effect.provide(RepositoryIdentityResolver.layer)),
​
+ it.effect("follows an OWNER/REPO mark only to a remote that fetches that repository", () =>
+ Effect.gen(function* () {
+ const fileSystem = yield* FileSystem.FileSystem;
+ const cwd = yield* fileSystem.makeTempDirectoryScoped({
+ prefix: "t3-repository-identity-gh-parent-test-",
+ });
+ const resolver = yield* RepositoryIdentityResolver.RepositoryIdentityResolver;
+ const resolveFresh = () => resolver.resolve(cwd, { refresh: true });
+​
+ yield* git(cwd, ["init"]);
+ yield* git(cwd, ["remote", "add", "fork", "https://github.com/julius/t3code-fork.git"]);
+ yield* git(cwd, ["remote", "add", "main", "https://github.com/T3Tools/t3code.git"]);
+ yield* git(cwd, ["remote", "add", "upstream", "https://github.com/other/t3code.git"]);
+ yield* git(cwd, ["config", "remote.fork.gh-resolved", "t3tools/t3code"]);
+ const parent = yield* resolveFresh();
+ expect(parent?.canonicalKey).toBe("github.com/t3tools/t3code");
+ expect(parent?.locator).toEqual({
+ source: "git-remote",
+ remoteName: "main",
+ remoteUrl: "https://github.com/T3Tools/t3code.git",
+ });
+​
+ // No remote fetches the marked repository, and several marks leave gh's choice unknown.
+ yield* git(cwd, ["config", "remote.fork.gh-resolved", "someone/else"]);
+ expect((yield* resolveFresh())?.locator.remoteName).toBe("upstream");
+ yield* git(cwd, ["config", "remote.fork.gh-resolved", "base"]);