The best way to control Claude Code, Codex and more from any computer or phone
fix(source-control): a query or fragment after .git keeps the repository identity (#34857)
Julius Marminge committed
Nov 11, 2026 at 23:45 UTC
6b2591b252b46d1128e8ed4dd0538d15975fb285
4 files changed
+20
-3
packages/shared/src/git.test.ts
+9
@@ -27,6 +27,15 @@ describe("normalizeGitRemoteUrl", () => {
27
expect(normalizeGitRemoteUrl("ssh://git@github.com/T3Tools/T3Code")).toBe(
28
"github.com/t3tools/t3code",
29
);
30
+ expect(normalizeGitRemoteUrl("https://github.com/T3Tools/T3Code.git?view=compact")).toBe(
31
+ "github.com/t3tools/t3code",
32
+ );
33
+ expect(normalizeGitRemoteUrl("https://github.com/T3Tools/T3Code.git#section")).toBe(
34
+ "github.com/t3tools/t3code",
35
+ );
36
+ expect(normalizeGitRemoteUrl("ssh://git@code.example.test/owner/repo.git.git")).toBe(
37
+ normalizeGitRemoteUrl("git@code.example.test:owner/repo.git.git"),
38
+ );
39
});
40
41
it("preserves nested group paths for providers like GitLab", () => {
packages/shared/src/git.ts
+7
-2
@@ -141,8 +141,13 @@ export function parseGitRemoteRepository(
141
142
if (/^(?:ssh|https?|git):\/\//i.test(normalized)) {
143
try {
144
- const url = new URL(normalized);
145
- const repositorySegments = url.pathname.split("/").filter((segment) => segment.length > 0);
144
+ // Parse the raw remote: `.git` may sit before a query or fragment, so strip it from the path once.
145
+ const url = new URL(value.trim().toLowerCase());
146
+ const repositorySegments = url.pathname
147
+ .replace(/\/+$/, "")
148
+ .replace(/\.git$/, "")
149
+ .split("/")
150
+ .filter((segment) => segment.length > 0);
151
if (url.hostname && repositorySegments.length > 1) {
152
return { host: url.hostname, path: repositorySegments.join("/") };
153
}
packages/source-control-core/src/server/SourceControlProvider.test.ts
+2
@@ -19,6 +19,8 @@ it.each([
19
["github.com:T3Tools/t3code.git", "T3Tools/t3code"],
20
["gitlab.com:T3Tools/platform/t3code", "T3Tools/platform/t3code"],
21
["https://github.com/T3Tools/t3code.git", "T3Tools/t3code"],
22
+ ["https://github.com/T3Tools/t3code.git?view=compact", "T3Tools/t3code"],
23
+ ["https://github.com/T3Tools/t3code.git#section", "T3Tools/t3code"],
24
["C:/repos/t3code", null],
25
])("reads the repository path of %s", (remoteUrl, expected) => {
26
assert.strictEqual(repositoryPathFromRemoteUrl(remoteUrl), expected);
packages/source-control-core/src/server/SourceControlProvider.ts
+2
-1
@@ -100,7 +100,8 @@ export function sourceControlRefFromInput(input: {
100
}
101
102
export function repositoryPathFromRemoteUrl(url: string | null): string | null {
103
- const trimmed = url?.trim() ?? "";
103
+ const remote = url?.trim() ?? "";
104
+ const trimmed = /^(?:ssh|https?|git):\/\//iu.test(remote) ? remote.split(/[?#]/u, 1)[0]! : remote;
105
if (trimmed.length === 0) {
106
return null;
107
}