@devries-cameron20 / t3code Mirror · read-only / commits / d6ac53ead2
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 19:45 UTC

fix(server): a project whose origin URL contains a space gets a repository identity (#35080)

Julius Marminge committed Nov 12, 2026 at 02:32 UTC d6ac53ead242f49cc7da6e1d34c4c92d5a6fdbba
2 files changed +20 -4
apps/server/src/project/RepositoryIdentityResolver.test.ts
+17
@@ -94,6 +94,23 @@ it.layer(NodeServices.layer)("RepositoryIdentityResolverLive", (it) => {
94 }).pipe(Effect.provide(RepositoryIdentityResolver.layer)),
95 );
96
97 + it.effect("resolves a remote whose URL contains a space", () =>
98 + Effect.gen(function* () {
99 + const fileSystem = yield* FileSystem.FileSystem;
100 + const cwd = yield* fileSystem.makeTempDirectoryScoped({
101 + prefix: "t3-repository-identity-spaced-url-test-",
102 + });
103 +
104 + yield* git(cwd, ["init"]);
105 + yield* git(cwd, ["remote", "add", "origin", "ssh://git@git.example.test/team repos/app.git"]);
106 +
107 + const resolver = yield* RepositoryIdentityResolver.RepositoryIdentityResolver;
108 + const identity = yield* resolver.resolve(cwd);
109 + expect(identity?.locator.remoteUrl).toBe("ssh://git@git.example.test/team repos/app.git");
110 + expect(identity?.locator.remoteName).toBe("origin");
111 + }).pipe(Effect.provide(RepositoryIdentityResolver.layer)),
112 + );
113 +
114 it.effect("returns the git top-level root path when resolving from a nested workspace", () =>
115 Effect.gen(function* () {
116 const fileSystem = yield* FileSystem.FileSystem;
apps/server/src/project/RepositoryIdentityResolver.ts
+3 -4
@@ -50,11 +50,10 @@ function isLocalRemoteUrl(url: string): boolean {
50
51 function parseRemoteFetchUrls(stdout: string): Map<string, string> {
52 const remotes = new Map<string, string>();
53 - for (const line of stdout.split("\n")) {
54 - const trimmed = line.trim();
55 - if (trimmed.length === 0) continue;
53 + for (const line of stdout.split(/\r?\n/)) {
54 + // Git uses a tab before the URL and one space before the direction; both can occur in URLs.
55 // Partial clones append the promisor filter, e.g. `(fetch) [blob:none]`.
57 - const match = /^(\S+)\s+(\S+)\s+\((fetch|push)\)(?:\s+\[[^\]]+\])?$/.exec(trimmed);
56 + const match = /^(\S+)\t(.+) \((fetch|push)\)(?:\s+\[[^\]]+\])?$/.exec(line);
57 if (!match) continue;
58 const [, remoteName = "", remoteUrl = "", direction = ""] = match;
59 if (