GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): status reads the upstream's configured remote before fet… · pingdotgg/t3code@7368460

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src/vcs
    • GitVcsDriverCore.test.ts
    • GitVcsDriverCore.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/server/src/vcs/GitVcsDriverCore.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/vcs/GitVcsDriverCore.test.ts
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,10 @@ it.effect("does not fetch for status when the branch tracks a local branch", ()
13501350
Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),
13511351
);
13521352
const cwd = yield* makeTmpDir();
1353+
const remote = yield* makeTmpDir("git-vcs-driver-remote-");
13531354
yield* initRepoWithCommit(cwd);
1355+
yield* git(remote, ["init", "--bare"]);
1356+
yield* git(cwd, ["remote", "add", "feature", remote]);
13541357
yield* git(cwd, ["branch", "feature/base"]);
13551358
yield* git(cwd, ["checkout", "-b", "stacked", "--track", "feature/base"]);
13561359

Collapse file

‎apps/server/src/vcs/GitVcsDriverCore.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/vcs/GitVcsDriverCore.ts
+16-13Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,22 +1643,25 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
16431643
const refreshStatusUpstreamIfStale = Effect.fn("refreshStatusUpstreamIfStale")(function* (
16441644
cwd: string,
16451645
) {
1646-
const upstreamRef = yield* readCurrentUpstreamRef(cwd);
1647-
if (upstreamRef === null) return;
1648-
const remoteNames = yield* runGitStdout("GitVcsDriver.listRemoteNames", cwd, ["remote"]).pipe(
1649-
Effect.map(parseRemoteNames),
1650-
Effect.orElseSucceed((): ReadonlyArray<string> => []),
1651-
);
1652-
// An upstream on no configured remote is a local branch (`branch.<name>.remote = .`).
1653-
const upstream = parseUpstreamRefWithRemoteNames(upstreamRef, remoteNames);
1654-
if (!upstream) return;
1646+
const headRef = yield* runGitStdout(
1647+
"GitVcsDriver.refreshStatusUpstreamIfStale.headRef",
1648+
cwd,
1649+
["symbolic-ref", "--quiet", "HEAD"],
1650+
true,
1651+
).pipe(Effect.map((stdout) => stdout.trim()));
1652+
if (headRef.length === 0) return;
1653+
const remoteName = yield* runGitStdout(
1654+
"GitVcsDriver.refreshStatusUpstreamIfStale.upstreamRemote",
1655+
cwd,
1656+
["for-each-ref", "--format=%(upstream:remotename)", headRef],
1657+
true,
1658+
).pipe(Effect.map((stdout) => stdout.trim()));
1659+
// Empty means no upstream; `.` means the upstream is a local branch.
1660+
if (remoteName.length === 0 || remoteName === ".") return;
16551661
const gitCommonDir = yield* resolveGitCommonDir(cwd);
16561662
yield* Cache.get(
16571663
statusRemoteRefreshCache,
1658-
new StatusRemoteRefreshCacheKey({
1659-
gitCommonDir,
1660-
remoteName: upstream.remoteName,
1661-
}),
1664+
new StatusRemoteRefreshCacheKey({ gitCommonDir, remoteName }),
16621665
).pipe(Effect.ignore);
16631666
});
16641667

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.