Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): recognize partial-clone Git remotes #12776

Closedvedprakash2302(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/12776/headopened View on GitHub

Showing 6 changed files with 137 additions and 0 deletions (loading 3).

x
0 of 6 viewed, 6 left
72 additions and 0 deletionsapps/server/src/git/remoteUrls.test.tsAdded
View file
@@ -0,0 +1,72 @@
+import { describe, expect, it } from "@effect/vitest";
+​
+import { parseGitRemoteVerboseOutput, parseRemoteFetchUrls } from "./remoteUrls.ts";
+​
+describe("git remote -v parsing", () => {
+ for (const newline of ["\n", "\r\n"]) {
+ it(`preserves ordinary and partial-clone URLs with ${JSON.stringify(newline)} line endings`, () => {
+ const cases = [
+ ["https://github.com/team/repo.git", ""],
+ ["git@github.com:team/repo.git", " [blob:none]"],
+ ["ssh://git@github.com/team/repo.git", " [blob:limit=1024]"],
+ ["https://org.visualstudio.com/DefaultCollection/Project/_git/repo", " [blob:none]"],
+ ["https://dev.azure.com/org/Project/_git/repo", ""],
+ ["git@ssh.dev.azure.com:v3/org/Project/repo", " [tree:0]"],
+ ];
+ const output = cases
+ .flatMap(([url, annotation], index) => [
+ `remote${index}\t${url} (fetch)${annotation}`,
+ `remote${index}\t${url} (push)`,
+ ])
+ .join(newline);
+​
+ expect(parseGitRemoteVerboseOutput(output)).toEqual(
+ new Map(cases.map(([url], index) => [`remote${index}`, { url, pushUrl: url }])),
+ );
+ });
+ }
+​
+ it("keeps fetch and push URLs separate and excludes push-only remotes from fetch discovery", () => {
+ const output = [