Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
fix(server): parse git branches correctly when column.ui is enabled (#1529)
EDM11519eb9e7227b2
diff --git a/apps/server/src/git/Layers/GitCore.test.ts b/apps/server/src/git/Layers/GitCore.test.tsindex 135834f89..5c42e6e87 100644--- a/apps/server/src/git/Layers/GitCore.test.ts+++ b/apps/server/src/git/Layers/GitCore.test.ts@@ -369,6 +369,64 @@ it.layer(TestLayer)("git integration", (it) => {}),);+ it.effect("parses separate branch names when column.ui is always enabled", () =>+ Effect.gen(function* () {+ const tmp = yield* makeTmpDir();+ const { initialBranch } = yield* initRepoWithCommit(tmp);+ const createdBranchNames = [+ "go-bin",+ "copilot/rewrite-cli-in-go",+ "copilot/rewrite-cli-in-rust",+ ] as const;+ for (const branchName of createdBranchNames) {+ yield* (yield* GitCore).createBranch({ cwd: tmp, branch: branchName });+ }+ yield* git(tmp, ["config", "column.ui", "always"]);++ const rawBranchOutput = yield* git(tmp, ["branch", "--no-color"], {+ ...process.env,+ COLUMNS: "120",+ });+ expect(+ rawBranchOutput+ .split("\n")+ .some(+ (line) =>+ createdBranchNames.filter((branchName) => line.includes(branchName)).length >= 2,+ ),+ ).toBe(true);++ const realGitCore = yield* GitCore;+ const core = yield* makeIsolatedGitCore((input) =>+ realGitCore.execute(+ input.args[0] === "branch"+ ? {+ ...input,+ env: { ...input.env, COLUMNS: "120" },+ }+ : input,+ ),+ );++ const result = yield* core.listBranches({ cwd: tmp });+ const localBranchNames = result.branches+ .filter((branch) => !branch.isRemote)+ .map((branch) => branch.name);++ expect(localBranchNames).toHaveLength(4);+ expect(localBranchNames).toEqual(+ expect.arrayContaining([initialBranch, ...createdBranchNames]),+ );+ expect(+ localBranchNames.some(+ (branchName) =>+ createdBranchNames.filter((createdBranch) => branchName.includes(createdBranch))+ .length >= 2,+ ),+ ).toBe(false);+ }),+ );+it.effect("isDefault is false when no remote exists", () =>Effect.gen(function* () {const tmp = yield* makeTmpDir();@@ -1898,7 +1956,7 @@ it.layer(TestLayer)("git integration", (it) => {let didFailRemoteBranches = false;let didFailRemoteNames = false;const core = yield* makeIsolatedGitCore((input) => {- if (input.args.join(" ") === "branch --no-color --remotes") {+ if (input.args.join(" ") === "branch --no-color --no-column --remotes") {didFailRemoteBranches = true;return Effect.fail(new GitCommandError({diff --git a/apps/server/src/git/Layers/GitCore.ts b/apps/server/src/git/Layers/GitCore.tsindex 81d6cbb54..9ef11eecf 100644--- a/apps/server/src/git/Layers/GitCore.ts+++ b/apps/server/src/git/Layers/GitCore.ts@@ -1566,7 +1566,7 @@ export const makeGitCore = Effect.fn("makeGitCore")(function* (options?: {const localBranchResult = yield* executeGit("GitCore.listBranches.branchNoColor",input.cwd,- ["branch", "--no-color"],+ ["branch", "--no-color", "--no-column"],{timeoutMs: 10_000,allowNonZeroExit: true,@@ -1581,7 +1581,7 @@ export const makeGitCore = Effect.fn("makeGitCore")(function* (options?: {return yield* createGitCommandError("GitCore.listBranches",input.cwd,- ["branch", "--no-color"],+ ["branch", "--no-color", "--no-column"],stderr || "git branch failed",);}@@ -1589,7 +1589,7 @@ export const makeGitCore = Effect.fn("makeGitCore")(function* (options?: {const remoteBranchResultEffect = executeGit("GitCore.listBranches.remoteBranches",input.cwd,- ["branch", "--no-color", "--remotes"],+ ["branch", "--no-color", "--no-column", "--remotes"],{timeoutMs: 10_000,allowNonZeroExit: true,@@ -1957,6 +1957,7 @@ export const makeGitCore = Effect.fn("makeGitCore")(function* (options?: {runGitStdout("GitCore.listLocalBranchNames", cwd, ["branch","--list",+ "--no-column","--format=%(refname:short)",]).pipe(Effect.map((stdout) =>