Skip to content

Commit 35350b1

Browse files
authored
feat: restore git-backed review modes (anomalyco#20845)
1 parent 263dcf7 commit 35350b1

23 files changed

Lines changed: 1102 additions & 247 deletions

File tree

packages/app/src/context/global-sync/bootstrap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ export async function bootstrapDirectory(input: {
248248
input.sdk.vcs.get().then((x) => {
249249
const next = x.data ?? input.store.vcs
250250
input.setStore("vcs", next)
251-
if (next?.branch) input.vcsCache.setStore("value", next)
251+
if (next) input.vcsCache.setStore("value", next)
252252
}),
253253
),
254254
() => retry(() => input.sdk.command.list().then((x) => input.setStore("command", x.data ?? []))),

packages/app/src/context/global-sync/event-reducer.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,10 @@ describe("applyDirectoryEvent", () => {
494494
})
495495

496496
test("updates vcs branch in store and cache", () => {
497-
const [store, setStore] = createStore(baseState())
498-
const [cacheStore, setCacheStore] = createStore({ value: undefined as State["vcs"] })
497+
const [store, setStore] = createStore(baseState({ vcs: { branch: "main", default_branch: "main" } }))
498+
const [cacheStore, setCacheStore] = createStore({
499+
value: { branch: "main", default_branch: "main" } as State["vcs"],
500+
})
499501

500502
applyDirectoryEvent({
501503
event: { type: "vcs.branch.updated", properties: { branch: "feature/test" } },
@@ -511,8 +513,8 @@ describe("applyDirectoryEvent", () => {
511513
},
512514
})
513515

514-
expect(store.vcs).toEqual({ branch: "feature/test" })
515-
expect(cacheStore.value).toEqual({ branch: "feature/test" })
516+
expect(store.vcs).toEqual({ branch: "feature/test", default_branch: "main" })
517+
expect(cacheStore.value).toEqual({ branch: "feature/test", default_branch: "main" })
516518
})
517519

518520
test("routes disposal and lsp events to side-effect handlers", () => {

packages/app/src/context/global-sync/event-reducer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,9 @@ export function applyDirectoryEvent(input: {
271271
break
272272
}
273273
case "vcs.branch.updated": {
274-
const props = event.properties as { branch: string }
274+
const props = event.properties as { branch?: string }
275275
if (input.store.vcs?.branch === props.branch) break
276-
const next = { branch: props.branch }
276+
const next = { ...input.store.vcs, branch: props.branch }
277277
input.setStore("vcs", next)
278278
if (input.vcsCache) input.vcsCache.setStore("value", next)
279279
break

packages/app/src/i18n/en.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,8 @@ export const dict = {
535535
"session.review.noVcs.createGit.action": "Create Git repository",
536536
"session.review.noSnapshot": "Snapshot tracking is disabled in config, so session changes are unavailable",
537537
"session.review.noChanges": "No changes",
538+
"session.review.noUncommittedChanges": "No uncommitted changes yet",
539+
"session.review.noBranchChanges": "No branch changes yet",
538540

539541
"session.files.selectToOpen": "Select a file to open",
540542
"session.files.all": "All files",

0 commit comments

Comments
 (0)