| ... | ... | @@ -369,6 +369,64 @@ it.layer(TestLayer)("git integration", (it) => { |
| 369 | 369 | }), |
| 370 | 370 | ); |
| 371 | 371 | |
| 372 | it.effect("parses separate branch names when column.ui is always enabled", () => |
| 373 | Effect.gen(function* () { |
| 374 | const tmp = yield* makeTmpDir(); |
| 375 | const { initialBranch } = yield* initRepoWithCommit(tmp); |
| 376 | const createdBranchNames = [ |
| 377 | "go-bin", |
| 378 | "copilot/rewrite-cli-in-go", |
| 379 | "copilot/rewrite-cli-in-rust", |
| 380 | ] as const; |
| 381 | for (const branchName of createdBranchNames) { |
| 382 | yield* (yield* GitCore).createBranch({ cwd: tmp, branch: branchName }); |
| 383 | } |
| 384 | yield* git(tmp, ["config", "column.ui", "always"]); |
| 385 | |
| 386 | const rawBranchOutput = yield* git(tmp, ["branch", "--no-color"], { |
| 387 | ...process.env, |
| 388 | COLUMNS: "120", |
| 389 | }); |
| 390 | expect( |
| 391 | rawBranchOutput |
| 392 | .split("\n") |
| 393 | .some( |
| 394 | (line) => |
| 395 | createdBranchNames.filter((branchName) => line.includes(branchName)).length >= 2, |
| 396 | ), |
| 397 | ).toBe(true); |
| 398 | |
| 399 | const realGitCore = yield* GitCore; |
| 400 | const core = yield* makeIsolatedGitCore((input) => |
| 401 | realGitCore.execute( |
| 402 | input.args[0] === "branch" |
| 403 | ? { |
| 404 | ...input, |
| 405 | env: { ...input.env, COLUMNS: "120" }, |
| 406 | } |
| 407 | : input, |
| 408 | ), |
| 409 | ); |
| 410 | |
| 411 | const result = yield* core.listBranches({ cwd: tmp }); |
| 412 | const localBranchNames = result.branches |
| 413 | .filter((branch) => !branch.isRemote) |
| 414 | .map((branch) => branch.name); |
| 415 | |
| 416 | expect(localBranchNames).toHaveLength(4); |
| 417 | expect(localBranchNames).toEqual( |
| 418 | expect.arrayContaining([initialBranch, ...createdBranchNames]), |
| 419 | ); |
| 420 | expect( |
| 421 | localBranchNames.some( |
| 422 | (branchName) => |
| 423 | createdBranchNames.filter((createdBranch) => branchName.includes(createdBranch)) |
| 424 | .length >= 2, |
| 425 | ), |
| 426 | ).toBe(false); |
| 427 | }), |
| 428 | ); |
| 429 | |
| 372 | 430 | it.effect("isDefault is false when no remote exists", () => |
| 373 | 431 | Effect.gen(function* () { |
| 374 | 432 | const tmp = yield* makeTmpDir(); |
| ... | ... | @@ -1898,7 +1956,7 @@ it.layer(TestLayer)("git integration", (it) => { |
| 1898 | 1956 | let didFailRemoteBranches = false; |
| 1899 | 1957 | let didFailRemoteNames = false; |
| 1900 | 1958 | const core = yield* makeIsolatedGitCore((input) => { |
| 1901 | | if (input.args.join(" ") === "branch --no-color --remotes") { |
| 1959 | if (input.args.join(" ") === "branch --no-color --no-column --remotes") { |
| 1902 | 1960 | didFailRemoteBranches = true; |
| 1903 | 1961 | return Effect.fail( |
| 1904 | 1962 | new GitCommandError({ |