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 — Merge remote-tracking branch 'origin/main' into t3/fix-epub-cdata-ent… · pingdotgg/t3code@e6861da

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps
    • mobile/src/lib
      • threadActivity.ts
    • server/src
      • git
        • GitManager.test.ts
        • GitManager.ts
      • orchestration-v2
        • ContextHandoffBudget.test.ts
        • ContextHandoffService.ts
      • vcs
        • GitVcsDriver.ts
        • GitVcsDriverCore.test.ts
        • GitVcsDriverCore.ts
    • web/src
      • components/settings
        • ProjectDefaultsSettings.tsx
        • SettingsPanels.tsx
        • SourceControlWritingSettings.tsx
        • TextGeneratorsSettings.tsx
        • ThemeEditorPanel.browser.test.tsx
        • ThemeEditorPanel.tsx
        • VoiceSettingsPanel.tsx
      • session-logic.ts
  • packages
    • provider-core/src/server
      • handoffBudget.ts
    • provider-pi/src/server
      • adapter.test.ts
      • adapter.ts
    • shared/src
      • model.test.ts
      • model.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/mobile/src/lib/threadActivity.ts‎

Copy file name to clipboardExpand all lines: apps/mobile/src/lib/threadActivity.ts
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,9 @@ function toWorkLogEntry(
761761
case "file_change":
762762
return {
763763
...common,
764-
changedFiles: item.changes?.map((change) => change.path) ?? [item.fileName],
764+
changedFiles: item.changes?.length
765+
? item.changes.map((change) => change.path)
766+
: [item.fileName],
765767
toolTitle: title ?? "File change",
766768
toolData: item,
767769
};
Collapse file

‎apps/server/src/git/GitManager.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/git/GitManager.test.ts
+51Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4759,6 +4759,57 @@ it.layer(layerGitManagerTest)("GitManager", (it) => {
47594759
}),
47604760
);
47614761

4762+
it.effect(
4763+
"create_pr publishes to the push remote when the tracked upstream already has HEAD",
4764+
() =>
4765+
Effect.gen(function* () {
4766+
const repoDir = yield* makeTempDir("t3code-git-manager-");
4767+
yield* initRepo(repoDir);
4768+
const originDir = yield* createBareRemote();
4769+
const forkDir = yield* createBareRemote();
4770+
yield* runGit(repoDir, ["remote", "add", "origin", originDir]);
4771+
yield* runGit(repoDir, ["remote", "add", "fork", forkDir]);
4772+
yield* runGit(repoDir, ["checkout", "-b", "topic"]);
4773+
NodeFS.writeFileSync(NodePath.join(repoDir, "changes.txt"), "change\n");
4774+
yield* runGit(repoDir, ["add", "changes.txt"]);
4775+
yield* runGit(repoDir, ["commit", "-m", "Topic change"]);
4776+
yield* runGit(repoDir, ["push", "-u", "origin", "topic"]);
4777+
yield* configureVisibleRemoteUrlWithLocalRewrite(
4778+
repoDir,
4779+
"origin",
4780+
"[email protected]:pingdotgg/codething-mvp.git",
4781+
originDir,
4782+
);
4783+
yield* configureVisibleRemoteUrlWithLocalRewrite(
4784+
repoDir,
4785+
"fork",
4786+
"[email protected]:octocat/codething-mvp.git",
4787+
forkDir,
4788+
);
4789+
yield* runGit(repoDir, ["config", "remote.pushDefault", "fork"]);
4790+
4791+
const { manager, providerCalls } = yield* makeManager();
4792+
const result = yield* runStackedAction(manager, {
4793+
cwd: repoDir,
4794+
action: "create_pr",
4795+
});
4796+
4797+
expect(result.push).toMatchObject({ status: "pushed", upstreamBranch: "fork/topic" });
4798+
expect(result.pr.status).toBe("created");
4799+
expect(
4800+
yield* runGit(forkDir, ["--git-dir=.", "log", "-1", "--pretty=%s", "topic"]),
4801+
).toMatchObject({
4802+
stdout: "Topic change\n",
4803+
});
4804+
expect(created(providerCalls)).toEqual([
4805+
{ baseRefName: "main", headSelector: "octocat:topic" },
4806+
]);
4807+
expect(yield* runGit(repoDir, ["rev-parse", "--abbrev-ref", "@{upstream}"])).toMatchObject({
4808+
stdout: "origin/topic\n",
4809+
});
4810+
}),
4811+
);
4812+
47624813
it.effect("rejects push/pr actions from detached HEAD", () =>
47634814
Effect.gen(function* () {
47644815
const repoDir = yield* makeTempDir("t3code-git-manager-");
Collapse file

‎apps/server/src/git/GitManager.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/git/GitManager.ts
+25-5Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2376,6 +2376,7 @@ export const make = Effect.gen(function* () {
23762376
fallbackBranch: string | null,
23772377
threadId: ThreadId | undefined,
23782378
emit: GitActionProgressEmitter,
2379+
pushRemoteRef?: { readonly remoteName: string; readonly upstreamRef: string },
23792380
) {
23802381
const provider = yield* sourceControlProvider(cwd);
23812382
const terms = sourceControlDefinitions.get(provider.kind).changeRequest;
@@ -2396,10 +2397,12 @@ export const make = Effect.gen(function* () {
23962397
});
23972398
}
23982399

2399-
const headContext = yield* resolveBranchHeadContext(cwd, {
2400-
branch,
2401-
upstreamRef: details.upstreamRef,
2402-
});
2400+
// A configured push remote receives the commits while the branch keeps
2401+
// tracking its upstream, so the PR head is the push remote's branch.
2402+
const headContext = yield* resolveBranchHeadContext(
2403+
cwd,
2404+
pushRemoteRef ? { branch, ...pushRemoteRef } : { branch, upstreamRef: details.upstreamRef },
2405+
);
24032406

24042407
const existing = yield* findOpenPr(cwd, headContext);
24052408
if (existing) {
@@ -3412,12 +3415,26 @@ export const make = Effect.gen(function* () {
34123415
> {
34133416
const initialStatus = yield* gitCore.statusDetails(input.cwd);
34143417
const wantsCommit = isCommitAction(input.action);
3418+
const upToDateBranch =
3419+
input.action === "create_pr" &&
3420+
initialStatus.hasUpstream &&
3421+
initialStatus.aheadCount === 0
3422+
? initialStatus.branch
3423+
: null;
3424+
// A current upstream says nothing about a separate push remote, which may lack HEAD.
3425+
const pushTarget = upToDateBranch
3426+
? yield* gitCore
3427+
.resolvePushTarget(input.cwd, { branch: upToDateBranch, hasUpstream: true })
3428+
.pipe(Effect.orElseSucceed(() => null))
3429+
: null;
34153430
const wantsPush =
34163431
input.action === "push" ||
34173432
input.action === "commit_push" ||
34183433
input.action === "commit_push_pr" ||
34193434
(input.action === "create_pr" &&
3420-
(!initialStatus.hasUpstream || initialStatus.aheadCount > 0));
3435+
(!initialStatus.hasUpstream ||
3436+
initialStatus.aheadCount > 0 ||
3437+
pushTarget?.viaPushRemote === true));
34213438
const wantsPr = input.action === "create_pr" || input.action === "commit_push_pr";
34223439

34233440
if (input.featureBranch && !wantsCommit) {
@@ -3570,6 +3587,9 @@ export const make = Effect.gen(function* () {
35703587
currentBranch,
35713588
input.threadId,
35723589
progress.emit,
3590+
"pushRemote" in push && push.pushRemote && push.upstreamBranch
3591+
? { remoteName: push.pushRemote, upstreamRef: push.upstreamBranch }
3592+
: undefined,
35733593
),
35743594
),
35753595
)
Collapse file

‎apps/server/src/orchestration-v2/ContextHandoffBudget.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/ContextHandoffBudget.test.ts
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ describe("handoff budget", () => {
151151
})?.text,
152152
"File change: src/a.ts, src/b.ts, src/new.ts",
153153
);
154+
assert.equal(
155+
historicalMessage({ ...base, type: "file_change", fileName: "src/a.ts", changes: [] })?.text,
156+
"File change: src/a.ts",
157+
);
154158
assert.isNull(
155159
historicalMessage({
156160
...base,
Collapse file

‎apps/server/src/orchestration-v2/ContextHandoffService.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/ContextHandoffService.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ function summarizeDeltaItem(item: OrchestrationV2TurnItem): string | null {
215215
case "command_execution":
216216
return `- Command: ${compactText(item.input)}`;
217217
case "file_change":
218-
return `- File change: ${compactText(item.changes?.map((change) => change.path).join(", ") ?? item.fileName)}`;
218+
return `- File change: ${compactText(item.changes?.length ? item.changes.map((change) => change.path).join(", ") : item.fileName)}`;
219219
case "checkpoint":
220220
return `- Checkpoint: ${item.files.length} files`;
221221
case "handoff":
Collapse file

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

Copy file name to clipboardExpand all lines: apps/server/src/vcs/GitVcsDriver.ts
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,16 @@ export interface GitPushResult {
179179
status: "pushed" | "skipped_up_to_date";
180180
branch: string;
181181
upstreamBranch?: string | undefined;
182+
/** Set when `upstreamBranch` is on a configured push remote instead of the tracked upstream. */
183+
pushRemote?: string | undefined;
182184
setUpstream?: boolean | undefined;
183185
}
184186

185187
export interface GitPushTarget {
186188
remoteName: string;
187189
branchName: string;
190+
/** The tracked upstream is current, yet pushes go to this configured push remote. */
191+
viaPushRemote: boolean;
188192
}
189193

190194
export interface GitRangeContext {
Collapse file

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

Copy file name to clipboardExpand all lines: apps/server/src/vcs/GitVcsDriverCore.test.ts
+146Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7998,6 +7998,152 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
79987998
assert.notEqual(originMain.exitCode, 0);
79997999
}),
80008000
);
8001+
8002+
it.effect.each(["branch.topic.pushRemote", "remote.pushDefault"] as const)(
8003+
"pushes a branch tracking its upstream head to the %s remote",
8004+
(configKey) =>
8005+
Effect.gen(function* () {
8006+
const cwd = yield* makeTmpDir();
8007+
const upstreamRemote = yield* makeTmpDir("git-upstream-remote-");
8008+
const forkRemote = yield* makeTmpDir("git-fork-remote-");
8009+
yield* initRepoWithCommit(cwd);
8010+
const driver = yield* GitVcsDriver.GitVcsDriver;
8011+
yield* git(upstreamRemote, ["init", "--bare"]);
8012+
yield* git(forkRemote, ["init", "--bare"]);
8013+
yield* git(cwd, ["remote", "add", "upstream", upstreamRemote]);
8014+
yield* git(cwd, ["remote", "add", "fork", forkRemote]);
8015+
yield* git(cwd, ["checkout", "-b", "topic"]);
8016+
yield* git(cwd, ["push", "upstream", "topic"]);
8017+
yield* git(cwd, ["push", "fork", "topic"]);
8018+
yield* git(cwd, ["branch", "--set-upstream-to=upstream/topic"]);
8019+
yield* git(cwd, ["config", configKey, "fork"]);
8020+
const upstreamTopicSha = yield* git(cwd, ["rev-parse", "HEAD"]);
8021+
yield* writeTextFile(cwd, "fork.txt", "fork\n");
8022+
yield* git(cwd, ["add", "-A"]);
8023+
yield* driver.commit(cwd, "Add fork update", "");
8024+
8025+
const pushed = yield* driver.pushCurrentBranch(cwd, null);
8026+
8027+
assert.deepInclude(pushed, {
8028+
status: "pushed",
8029+
branch: "topic",
8030+
upstreamBranch: "fork/topic",
8031+
pushRemote: "fork",
8032+
setUpstream: false,
8033+
});
8034+
assert.equal(
8035+
yield* git(forkRemote, ["--git-dir=.", "log", "-1", "--pretty=%s", "topic"]),
8036+
"Add fork update",
8037+
);
8038+
assert.equal(
8039+
yield* git(upstreamRemote, ["--git-dir=.", "rev-parse", "topic"]),
8040+
upstreamTopicSha,
8041+
);
8042+
assert.equal(
8043+
yield* git(cwd, ["rev-parse", "--abbrev-ref", "@{upstream}"]),
8044+
"upstream/topic",
8045+
);
8046+
}),
8047+
);
8048+
8049+
it.effect.each(["deleted", "rewound"] as const)(
8050+
"pushes an up-to-date tracked branch to the push remote when its branch there is %s",
8051+
(forkState) =>
8052+
Effect.gen(function* () {
8053+
const cwd = yield* makeTmpDir();
8054+
const upstreamRemote = yield* makeTmpDir("git-upstream-remote-");
8055+
const forkRemote = yield* makeTmpDir("git-fork-remote-");
8056+
yield* initRepoWithCommit(cwd);
8057+
const driver = yield* GitVcsDriver.GitVcsDriver;
8058+
yield* git(upstreamRemote, ["init", "--bare"]);
8059+
yield* git(forkRemote, ["init", "--bare"]);
8060+
yield* git(cwd, ["remote", "add", "upstream", upstreamRemote]);
8061+
yield* git(cwd, ["remote", "add", "fork", forkRemote]);
8062+
yield* git(cwd, ["checkout", "-b", "topic"]);
8063+
yield* writeTextFile(cwd, "upstream.txt", "upstream\n");
8064+
yield* git(cwd, ["add", "-A"]);
8065+
yield* driver.commit(cwd, "Add upstream update", "");
8066+
yield* git(cwd, ["push", "-u", "upstream", "topic"]);
8067+
yield* git(cwd, ["config", "remote.pushDefault", "fork"]);
8068+
// Another checkout changes the fork after this one last fetched it,
8069+
// leaving a local fork/topic that still contains HEAD.
8070+
yield* git(cwd, ["push", "fork", "topic"]);
8071+
yield* git(
8072+
forkRemote,
8073+
forkState === "deleted"
8074+
? ["--git-dir=.", "update-ref", "-d", "refs/heads/topic"]
8075+
: ["--git-dir=.", "update-ref", "refs/heads/topic", "topic~1"],
8076+
);
8077+
8078+
const pushed = yield* driver.pushCurrentBranch(cwd, null);
8079+
8080+
assert.deepInclude(pushed, {
8081+
status: "pushed",
8082+
upstreamBranch: "fork/topic",
8083+
pushRemote: "fork",
8084+
});
8085+
assert.equal(
8086+
yield* git(forkRemote, ["--git-dir=.", "log", "-1", "--pretty=%s", "topic"]),
8087+
"Add upstream update",
8088+
);
8089+
assert.equal(
8090+
yield* git(cwd, ["rev-parse", "--abbrev-ref", "@{upstream}"]),
8091+
"upstream/topic",
8092+
);
8093+
}),
8094+
);
8095+
8096+
it.effect("skips an up-to-date tracked branch the push remote already has", () =>
8097+
Effect.gen(function* () {
8098+
const cwd = yield* makeTmpDir();
8099+
const upstreamRemote = yield* makeTmpDir("git-upstream-remote-");
8100+
const forkRemote = yield* makeTmpDir("git-fork-remote-");
8101+
yield* initRepoWithCommit(cwd);
8102+
const driver = yield* GitVcsDriver.GitVcsDriver;
8103+
yield* git(upstreamRemote, ["init", "--bare"]);
8104+
yield* git(forkRemote, ["init", "--bare"]);
8105+
yield* git(cwd, ["remote", "add", "upstream", upstreamRemote]);
8106+
yield* git(cwd, ["remote", "add", "fork", forkRemote]);
8107+
yield* git(cwd, ["checkout", "-b", "topic"]);
8108+
yield* git(cwd, ["push", "-u", "upstream", "topic"]);
8109+
yield* git(cwd, ["push", "fork", "topic"]);
8110+
yield* git(cwd, ["config", "remote.pushDefault", "fork"]);
8111+
8112+
const pushed = yield* driver.pushCurrentBranch(cwd, null);
8113+
8114+
assert.deepInclude(pushed, {
8115+
status: "skipped_up_to_date",
8116+
upstreamBranch: "fork/topic",
8117+
pushRemote: "fork",
8118+
});
8119+
}),
8120+
);
8121+
8122+
it.effect("skips an up-to-date branch whose differently named upstream is its base", () =>
8123+
Effect.gen(function* () {
8124+
const cwd = yield* makeTmpDir();
8125+
const upstreamRemote = yield* makeTmpDir("git-upstream-remote-");
8126+
const forkRemote = yield* makeTmpDir("git-fork-remote-");
8127+
yield* initRepoWithCommit(cwd);
8128+
const driver = yield* GitVcsDriver.GitVcsDriver;
8129+
yield* git(upstreamRemote, ["init", "--bare"]);
8130+
yield* git(forkRemote, ["init", "--bare"]);
8131+
yield* git(cwd, ["remote", "add", "upstream", upstreamRemote]);
8132+
yield* git(cwd, ["remote", "add", "fork", forkRemote]);
8133+
yield* git(cwd, ["push", "upstream", "HEAD:refs/heads/release"]);
8134+
yield* git(cwd, ["fetch", "upstream"]);
8135+
yield* git(cwd, ["checkout", "-b", "topic", "--track", "upstream/release"]);
8136+
yield* git(cwd, ["config", "remote.pushDefault", "fork"]);
8137+
8138+
const pushed = yield* driver.pushCurrentBranch(cwd, null);
8139+
8140+
assert.deepInclude(pushed, {
8141+
status: "skipped_up_to_date",
8142+
upstreamBranch: "upstream/release",
8143+
});
8144+
assert.equal(yield* git(forkRemote, ["--git-dir=.", "branch", "--list", "topic"]), "");
8145+
}),
8146+
);
80018147
});
80028148
});
80038149

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.