@devries-cameron20 / t3code Mirror · read-only / commits / 8ee7cf9a32
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 22, 05:45 UTC

fix(server): status no longer fetches a remote named after a local tracked branch (#29670)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: maria-rcks <254055478+maria-rcks@users.noreply.github.com>

Alex Southwell committed Nov 3, 2026 at 23:08 UTC 8ee7cf9a324e17832250feaa51be2b22a86a4a96
2 files changed +46 -6
apps/server/src/vcs/GitVcsDriverCore.test.ts
+30
@@ -1516,6 +1516,36 @@ it.effect("retries a fetch that lost a ref update to another Git process", () =>
1516 ),
1517 );
1518
1519 +it.effect("does not fetch for status when the branch tracks a local branch", () =>
1520 + Effect.scoped(
1521 + Effect.gen(function* () {
1522 + const delegate = yield* ChildProcessSpawner.ChildProcessSpawner;
1523 + const fetches: Array<ReadonlyArray<string>> = [];
1524 + const spawner = ChildProcessSpawner.make((command) => {
1525 + if (ChildProcess.isStandardCommand(command) && command.args.includes("fetch")) {
1526 + fetches.push(command.args.map(String));
1527 + }
1528 + return delegate.spawn(command);
1529 + });
1530 + const driver = yield* makeGitVcsDriverCore().pipe(
1531 + Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),
1532 + );
1533 + const cwd = yield* makeTmpDir();
1534 + const remote = yield* makeTmpDir("git-vcs-driver-remote-");
1535 + yield* initRepoWithCommit(cwd);
1536 + yield* git(remote, ["init", "--bare"]);
1537 + yield* git(cwd, ["remote", "add", "feature", remote]);
1538 + yield* git(cwd, ["branch", "feature/base"]);
1539 + yield* git(cwd, ["checkout", "-b", "stacked", "--track", "feature/base"]);
1540 +
1541 + const status = yield* driver.statusDetailsRemote(cwd);
1542 +
1543 + assert.equal(status.upstreamRef, "feature/base");
1544 + assert.deepStrictEqual(fetches, []);
1545 + }),
1546 + ).pipe(Effect.provide(layerTest)),
1547 +);
1548 +
1549 it.effect("lets a worktree checkout that is still working run past five minutes", () =>
1550 Effect.gen(function* () {
1551 const checkoutStarted = yield* Deferred.make<void>();
apps/server/src/vcs/GitVcsDriverCore.ts
+16 -6
@@ -1652,15 +1652,25 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
1652 const refreshStatusUpstreamIfStale = Effect.fn("refreshStatusUpstreamIfStale")(function* (
1653 cwd: string,
1654 ) {
1655 - const upstream = yield* resolveCurrentUpstream(cwd);
1656 - if (!upstream) return;
1655 + const headRef = yield* runGitStdout(
1656 + "GitVcsDriver.refreshStatusUpstreamIfStale.headRef",
1657 + cwd,
1658 + ["symbolic-ref", "--quiet", "HEAD"],
1659 + true,
1660 + ).pipe(Effect.map((stdout) => stdout.trim()));
1661 + if (headRef.length === 0) return;
1662 + const remoteName = yield* runGitStdout(
1663 + "GitVcsDriver.refreshStatusUpstreamIfStale.upstreamRemote",
1664 + cwd,
1665 + ["for-each-ref", "--format=%(upstream:remotename)", headRef],
1666 + true,
1667 + ).pipe(Effect.map((stdout) => stdout.trim()));
1668 + // Empty means no upstream; `.` means the upstream is a local branch.
1669 + if (remoteName.length === 0 || remoteName === ".") return;
1670 const gitCommonDir = yield* resolveGitCommonDir(cwd);
1671 yield* Cache.get(
1672 statusRemoteRefreshCache,
1660 - new StatusRemoteRefreshCacheKey({
1661 - gitCommonDir,
1662 - remoteName: upstream.remoteName,
1663 - }),
1673 + new StatusRemoteRefreshCacheKey({ gitCommonDir, remoteName }),
1674 ).pipe(Effect.ignore);
1675 });
1676