The best way to control Claude Code, Codex and more from any computer or phone
fix(web): show the comparison base beside Changes totals (#30085)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
shivam committed
Nov 5, 2026 at 06:44 UTC
199cb5b6a9d17f2b55881338dc4381ca59d0e5e9
3 files changed
+41
-21
apps/web/src/components/GitActionsControl.logic.test.ts
+4
-4
@@ -251,7 +251,7 @@ describe("resolveAutoFeatureBranchName", () => {
251
252
describe("resolveChangesTotals", () => {
253
it("does not let an empty branchChanges hide a dirty working tree", () => {
254
- assert.deepEqual(
254
+ assert.deepInclude(
255
resolveChangesTotals(
256
status({
257
hasWorkingTreeChanges: true,
@@ -271,7 +271,7 @@ describe("resolveChangesTotals", () => {
271
assert.deepEqual(
272
resolveChangesTotals(
273
status({
274
- branchChanges: { baseRef: "main", insertions: 20, deletions: 3 },
274
+ branchChanges: { baseRef: "origin/master", insertions: 20, deletions: 3 },
275
workingTree: {
276
files: [{ path: "a.ts", insertions: 1, deletions: 0 }],
277
insertions: 1,
@@ -279,12 +279,12 @@ describe("resolveChangesTotals", () => {
279
},
280
}),
281
),
282
- { insertions: 20, deletions: 3 },
282
+ { insertions: 20, deletions: 3, baseRef: "origin/master" },
283
);
284
});
285
286
it("falls back to the working tree when branchChanges is omitted", () => {
287
- assert.deepEqual(
287
+ assert.deepInclude(
288
resolveChangesTotals(
289
status({
290
workingTree: {
apps/web/src/components/GitActionsControl.logic.ts
+14
-11
@@ -429,6 +429,8 @@ export function resolveLiveThreadBranchUpdate(input: {
429
export type ChangesLineTotals = {
430
readonly insertions: number;
431
readonly deletions: number;
432
+ /** Ref the counts compare against; `null` means they are uncommitted changes against HEAD. */
433
+ readonly baseRef: string | null;
434
};
435
436
// `branchChanges ?? workingTree` treats `{0,0}` as present, so a zero branch total hid a dirty
@@ -438,15 +440,16 @@ export function resolveChangesTotals(
440
): ChangesLineTotals | null {
441
if (!status) return null;
442
const branch = status.branchChanges;
441
- const tree = status.workingTree;
442
- if (branch && (branch.insertions > 0 || branch.deletions > 0)) {
443
- return { insertions: branch.insertions, deletions: branch.deletions };
444
- }
445
- if (tree.insertions > 0 || tree.deletions > 0) {
446
- return { insertions: tree.insertions, deletions: tree.deletions };
447
- }
448
- if (branch) {
449
- return { insertions: branch.insertions, deletions: branch.deletions };
450
- }
451
- return { insertions: tree.insertions, deletions: tree.deletions };
443
+ const tree = { ...status.workingTree, baseRef: null };
444
+ const selected =
445
+ branch && (branch.insertions > 0 || branch.deletions > 0)
446
+ ? branch
447
+ : tree.insertions > 0 || tree.deletions > 0
448
+ ? tree
449
+ : (branch ?? tree);
450
+ return {
451
+ insertions: selected.insertions,
452
+ deletions: selected.deletions,
453
+ baseRef: selected.baseRef,
454
+ };
455
}
apps/web/src/components/GitActionsControl.tsx
+23
-6
@@ -1049,10 +1049,13 @@ export default function GitActionsControl({
1049
const isRepo = gitStatus?.isRepo ?? true;
1050
const hasPrimaryRemote = gitStatus?.hasPrimaryRemote ?? false;
1051
const gitStatusForActions = gitStatus;
1052
- const changesTotals = resolveChangesTotals(gitStatusForActions) ?? {
1053
- insertions: 0,
1054
- deletions: 0,
1055
- };
1052
+ const resolvedChangesTotals = resolveChangesTotals(gitStatusForActions);
1053
+ const changesTotals = resolvedChangesTotals ?? { insertions: 0, deletions: 0 };
1054
+ const changesBaseLabel = resolvedChangesTotals
1055
+ ? resolvedChangesTotals.baseRef === null
1056
+ ? "Uncommitted"
1057
+ : `vs ${resolvedChangesTotals.baseRef}`
1058
+ : null;
1059
1060
const allFiles = gitStatusForActions?.workingTree.files ?? [];
1061
// Changed-file paths are repository-relative, so they must resolve against
@@ -1636,8 +1639,22 @@ export default function GitActionsControl({
1639
onClick={onOpenChanges}
1640
>
1641
<FileDiffIcon className={THREAD_DETAILS_PANEL_ICON_CLASS} aria-hidden />
1639
- <span className={cn("flex-1 text-left", THREAD_DETAILS_PANEL_LABEL_CLASS)}>Changes</span>
1640
- <span className="flex items-center gap-1.5 font-mono text-xs tabular-nums">
1642
+ <span className={cn("shrink-0", THREAD_DETAILS_PANEL_LABEL_CLASS)}>Changes</span>
1643
+ {changesBaseLabel ? (
1644
+ <Tooltip>
1645
+ <TooltipTrigger
1646
+ render={
1647
+ <span className="pointer-events-auto min-w-0 truncate text-xs text-muted-foreground" />
1648
+ }
1649
+ >
1650
+ {changesBaseLabel}
1651
+ </TooltipTrigger>
1652
+ <TooltipPopup side="top" className="max-w-96 break-words">
1653
+ {changesBaseLabel}
1654
+ </TooltipPopup>
1655
+ </Tooltip>
1656
+ ) : null}
1657
+ <span className="ml-auto flex shrink-0 items-center gap-1.5 font-mono text-xs tabular-nums">
1658
<span
1659
className={
1660
changesTotals.insertions ? "text-diff-addition-foreground" : "text-muted-foreground"