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 — Refresh upstream state after branch checkout and invalidate git queries by juliusmarminge · Pull Request #46 · pingdotgg/t3code

Refresh upstream state after branch checkout and invalidate git queries #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
juliusmarminge merged 3 commits into main from git-in
Feb 15, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

Refresh upstream state after branch checkout and invalidate git queries #46

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit Hold shift + click to select a range
4c77205
Refresh branch upstream after checkout and invalidate git queries
juliusmarminge Feb 15, 2026
ca2acb0
Make checkout tolerate upstream refresh failures
juliusmarminge Feb 15, 2026
147f433
Scope branch refresh fetch to checked-out upstream refspec
juliusmarminge Feb 15, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
Make checkout tolerate upstream refresh failures
- treat post-checkout upstream fetch as best effort so checkout still succeeds
- route refresh fetch through `this.git(...)` for consistent behavior
- add regression test for fetch-timeout during branch checkout
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge
juliusmarminge committed Feb 15, 2026
commit ca2acb078e522fc46236369497938e5b2cd039c1

There are no files selected for viewing

45 changes: 45 additions & 0 deletions 45 apps/server/src/git.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,51 @@ describe("git integration", () => {
expect(details.behindCount).toBe(1);
});

it("keeps checkout successful when upstream refresh fails", async () => {
await using remote = await makeTmpDir();
await using source = await makeTmpDir();
await git(remote.path, "init --bare");

await initRepoWithCommit(source.path);
const defaultBranch = (await listGitBranches({ cwd: source.path })).branches.find(
(branch) => branch.current,
)!.name;
await git(source.path, `remote add origin ${JSON.stringify(remote.path)}`);
await git(source.path, `push -u origin ${defaultBranch}`);

const featureBranch = "feature-refresh-failure";
await git(source.path, `branch ${featureBranch}`);
await git(source.path, `checkout ${featureBranch}`);
await writeFile(path.join(source.path, "feature.txt"), "feature base\n");
await git(source.path, "add feature.txt");
await git(source.path, "commit -m 'feature base'");
await git(source.path, `push -u origin ${featureBranch}`);
await git(source.path, `checkout ${defaultBranch}`);

class RefreshFailingGitCoreService extends GitCoreService {
refreshFetchAttempts = 0;

override async git(
cwd: string,
args: readonly string[],
allowNonZeroExit = false,
): Promise<void> {
if (args[0] === "fetch") {
this.refreshFetchAttempts += 1;
throw new Error("simulated fetch timeout");
}
await super.git(cwd, args, allowNonZeroExit);
}
}

const core = new RefreshFailingGitCoreService();
await expect(core.checkoutBranch({ cwd: source.path, branch: featureBranch })).resolves.toBe(
undefined,
);
expect(core.refreshFetchAttempts).toBe(1);
expect(await git(source.path, "branch --show-current")).toBe(featureBranch);
});

it("throws when branch does not exist", async () => {
await using tmp = await makeTmpDir();
await initRepoWithCommit(tmp.path);
Expand Down
11 changes: 6 additions & 5 deletions 11 apps/server/src/git.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -574,18 +574,19 @@ export class GitCoreService {
return;
}

await executeGit(cwd, ["fetch", "--quiet", "--no-tags", remoteName], {
timeoutMs: 20_000,
allowNonZeroExit: true,
});
await this.git(cwd, ["fetch", "--quiet", "--no-tags", remoteName], true);
Comment thread
juliusmarminge marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

}

async checkoutBranch(input: GitCheckoutInput): Promise<void> {
await executeGit(input.cwd, ["checkout", input.branch], {
timeoutMs: 10_000,
fallbackErrorMessage: "git checkout failed",
});
await this.refreshCheckedOutBranchUpstream(input.cwd);
try {
await this.refreshCheckedOutBranchUpstream(input.cwd);
} catch {
// Best effort: checkout already succeeded, so avoid surfacing refresh failures.
}
}
Comment thread
juliusmarminge marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.


async initRepo(input: GitInitInput): Promise<void> {
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
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.