diff --git a/e2e/gitLogToolbarMenus.spec.ts b/e2e/gitLogToolbarMenus.spec.ts index 974aed5536..ba609730ac 100644 --- a/e2e/gitLogToolbarMenus.spec.ts +++ b/e2e/gitLogToolbarMenus.spec.ts @@ -362,6 +362,41 @@ test("long Git Log filter values shorten inside their buttons", async ({ workben await expect(clear).toBeHidden(); }); +test("a click in the User filter shows only that user's commits, without check marks", async ({ workbench: page }) => { + const alice = "Alice "; + const bob = "Bob "; + await page.evaluate( + async ([alice, bob]) => { + const optionsModule = "/src/features/vcs/logOptions.ts"; + const { setLogOptions } = await import(/* @vite-ignore */ optionsModule); + // Room for the User filter on the bar. + setLogOptions({ showBranches: false, showDetails: false }); + const h = window.__ipc.handlers; + h.vcs_log_users = () => [alice, "Author ", bob]; + const log = h.vcs_log!; + h.vcs_log = (args) => { + (window as { logAuthors?: unknown }).logAuthors = (args.query as { authors: string[] }).authors; + return log(args); + }; + }, + [alice, bob], + ); + const toolbar = page.getByRole("toolbar", { name: "Log filters" }); + const user = toolbar.getByRole("button", { name: /^User/ }); + const item = (name: string) => page.getByRole("menuitem", { name, exact: true }); + const logAuthors = () => page.evaluate(() => (window as { logAuthors?: unknown }).logAuthors); + + await user.click(); + await item(alice).click(); + await expect(user).toHaveText(`User: ${alice}`); + await expect.poll(logAuthors).toEqual([alice]); + await user.click(); + await expect(page.getByRole("menuitemcheckbox", { name: alice, exact: true })).toHaveCount(0); + await item(bob).click(); + await expect(user).toHaveText(`User: ${bob}`); + await expect.poll(logAuthors).toEqual([bob]); +}); + test("Git Log puts affected changes on the changed-files toolbar and groups preview options", async ({ workbench: page, }) => { diff --git a/src/features/vcs/log/FilterBar.tsx b/src/features/vcs/log/FilterBar.tsx index 31ab64422b..f64861e84c 100644 --- a/src/features/vcs/log/FilterBar.tsx +++ b/src/features/vcs/log/FilterBar.tsx @@ -218,12 +218,13 @@ export function FilterBar({ fileHistory = false }: { fileHistory?: boolean }) { label: authors.join(", "), run: () => setLogFilters({ authors }), })), - { label: ME, checked: filters.authors.includes(ME), run: () => setLogFilters({ authors: [ME] }) }, + // A click sets the filter to that user alone, as IDEA does (several users go through Select…), so the + // rows carry no check marks that would read as a multi-select. + { label: ME, run: () => setLogFilters({ authors: [ME] }) }, ...(authors.length ? [{ kind: "separator" as const }] : []), ...authors.slice(0, 30).map((a) => ({ verbatim: true, label: a, - checked: filters.authors.includes(a), run: () => setLogFilters({ authors: [a] }), })), { kind: "separator" },