Merge pull request #1752 from bashrusakh/fix/1736-branch-filter

fix(worktree): hide non-matching branches during search
This commit is contained in:
Bohdan Triapitsyn
2026-08-28 01:24:36 +03:00
committed by GitHub
10 changed files with 18 additions and 38 deletions
@@ -1207,10 +1207,10 @@ export function NewWorktreeDialog({
</div>
)}
{existingBranchRankedGroups.otherLocal.length > 0 && (
{!hasExistingBranchQuery && existingBranchRankedGroups.otherLocal.length > 0 && (
<div className="space-y-2">
<div className="typography-small font-semibold text-foreground px-2">
{hasExistingBranchQuery ? t('session.newWorktree.otherLocalBranches') : t('session.newWorktree.localBranches')}
{t('session.newWorktree.localBranches')}
</div>
<div className="space-y-1">
{existingBranchRankedGroups.otherLocal.map((branch) => (
@@ -1239,10 +1239,10 @@ export function NewWorktreeDialog({
</div>
)}
{existingBranchRankedGroups.otherRemote.length > 0 && (
{!hasExistingBranchQuery && existingBranchRankedGroups.otherRemote.length > 0 && (
<div className="space-y-2">
<div className="typography-small font-semibold text-foreground px-2">
{hasExistingBranchQuery ? t('session.newWorktree.otherRemoteBranches') : t('session.newWorktree.remoteBranches')}
{t('session.newWorktree.remoteBranches')}
</div>
<div className="space-y-1">
{existingBranchRankedGroups.otherRemote.map((branch) => (
@@ -1466,10 +1466,10 @@ export function NewWorktreeDialog({
</div>
)}
{sourceBranchRankedGroups.otherLocal.length > 0 && (
{!hasSourceBranchQuery && sourceBranchRankedGroups.otherLocal.length > 0 && (
<div className="space-y-2">
<div className="typography-small font-semibold text-foreground px-2">
{hasSourceBranchQuery ? t('session.newWorktree.otherLocalBranches') : t('session.newWorktree.localBranches')}
{t('session.newWorktree.localBranches')}
</div>
<div className="space-y-1">
{sourceBranchRankedGroups.otherLocal.map((branch) => (
@@ -1493,10 +1493,10 @@ export function NewWorktreeDialog({
</div>
)}
{sourceBranchRankedGroups.otherRemote.length > 0 && (
{!hasSourceBranchQuery && sourceBranchRankedGroups.otherRemote.length > 0 && (
<div className="space-y-2">
<div className="typography-small font-semibold text-foreground px-2">
{hasSourceBranchQuery ? t('session.newWorktree.otherRemoteBranches') : t('session.newWorktree.remoteBranches')}
{t('session.newWorktree.remoteBranches')}
</div>
<div className="space-y-1">
{sourceBranchRankedGroups.otherRemote.map((branch) => (
@@ -1675,10 +1675,9 @@ export function NewWorktreeDialog({
</div>
)}
{existingBranchRankedGroups.otherLocal.length > 0 && (
{!hasExistingBranchQuery && existingBranchRankedGroups.otherLocal.length > 0 && (
<>
{hasExistingBranchQuery && <CommandSeparator />}
<CommandGroup heading={hasExistingBranchQuery ? t('session.newWorktree.otherLocalBranches') : t('session.newWorktree.localBranches')}>
<CommandGroup heading={t('session.newWorktree.localBranches')}>
{existingBranchRankedGroups.otherLocal.map((branch) => (
<CommandItem
key={`local-${branch}`}
@@ -1700,12 +1699,12 @@ export function NewWorktreeDialog({
</>
)}
{existingBranchRankedGroups.otherRemote.length > 0 && (
{!hasExistingBranchQuery && existingBranchRankedGroups.otherRemote.length > 0 && (
<>
{(existingBranchRankedGroups.otherLocal.length > 0 || hasExistingBranchQuery) && (
{existingBranchRankedGroups.otherLocal.length > 0 && (
<CommandSeparator />
)}
<CommandGroup heading={hasExistingBranchQuery ? t('session.newWorktree.otherRemoteBranches') : t('session.newWorktree.remoteBranches')}>
<CommandGroup heading={t('session.newWorktree.remoteBranches')}>
{existingBranchRankedGroups.otherRemote.map((branch) => (
<CommandItem
key={`remote-${branch}`}
@@ -1914,10 +1913,9 @@ export function NewWorktreeDialog({
</div>
)}
{sourceBranchRankedGroups.otherLocal.length > 0 && (
{!hasSourceBranchQuery && sourceBranchRankedGroups.otherLocal.length > 0 && (
<>
{hasSourceBranchQuery && <CommandSeparator />}
<CommandGroup heading={hasSourceBranchQuery ? t('session.newWorktree.otherLocalBranches') : t('session.newWorktree.localBranches')}>
<CommandGroup heading={t('session.newWorktree.localBranches')}>
{sourceBranchRankedGroups.otherLocal.map((branch) => (
<CommandItem
key={`local-${branch}`}
@@ -1934,12 +1932,12 @@ export function NewWorktreeDialog({
</>
)}
{sourceBranchRankedGroups.otherRemote.length > 0 && (
{!hasSourceBranchQuery && sourceBranchRankedGroups.otherRemote.length > 0 && (
<>
{(sourceBranchRankedGroups.otherLocal.length > 0 || hasSourceBranchQuery) && (
{sourceBranchRankedGroups.otherLocal.length > 0 && (
<CommandSeparator />
)}
<CommandGroup heading={hasSourceBranchQuery ? t('session.newWorktree.otherRemoteBranches') : t('session.newWorktree.remoteBranches')}>
<CommandGroup heading={t('session.newWorktree.remoteBranches')}>
{sourceBranchRankedGroups.otherRemote.map((branch) => (
<CommandItem
key={`remote-${branch}`}
-2
View File
@@ -1958,8 +1958,6 @@ export const dict = {
'session.newWorktree.noMatchingBranches': 'No matching branches',
'session.newWorktree.localBranches': 'Local branches',
'session.newWorktree.remoteBranches': 'Remote branches',
'session.newWorktree.otherLocalBranches': 'Other local branches',
'session.newWorktree.otherRemoteBranches': 'Other remote branches',
'session.newWorktree.branchName': 'Branch Name',
'session.newWorktree.branchNamePlaceholder': 'feature/my-awesome-feature',
'session.newWorktree.actions.change': 'Change',
-2
View File
@@ -1936,8 +1936,6 @@ export const dict: Record<I18nKey, string> = {
"session.newWorktree.noMatchingBranches": "No hay ramas coincidentes",
"session.newWorktree.localBranches": "Ramas locales",
"session.newWorktree.remoteBranches": "Ramas remotas",
"session.newWorktree.otherLocalBranches": "Otras ramas locales",
"session.newWorktree.otherRemoteBranches": "Otras ramas remotas",
"session.newWorktree.branchName": "Nombre de la rama",
"session.newWorktree.branchNamePlaceholder": "feature/my-awesome-feature",
"session.newWorktree.actions.change": "Cambiar",
-2
View File
@@ -1716,8 +1716,6 @@ export const dict = {
'session.newWorktree.noMatchingBranches': 'Aucune branche correspondante',
'session.newWorktree.localBranches': 'Branches locales',
'session.newWorktree.remoteBranches': 'Branches du dépôt distant',
'session.newWorktree.otherLocalBranches': 'Autres branches locales',
'session.newWorktree.otherRemoteBranches': 'Autres branches du remote',
'session.newWorktree.branchName': 'Nom de la branche',
'session.newWorktree.branchNamePlaceholder': 'fonctionnalité/ma-fonctionnalité-géniale',
'session.newWorktree.actions.change': 'Changement',
-2
View File
@@ -1960,8 +1960,6 @@ export const dict: Record<I18nKey, string> = {
'session.newWorktree.noMatchingBranches': '일치하는 브랜치가 없습니다',
'session.newWorktree.localBranches': '로컬 브랜치',
'session.newWorktree.remoteBranches': '리모트 브랜치',
'session.newWorktree.otherLocalBranches': '기타 로컬 브랜치',
'session.newWorktree.otherRemoteBranches': '기타 리모트 브랜치',
'session.newWorktree.branchName': '브랜치 이름',
'session.newWorktree.branchNamePlaceholder': 'feature/my-awesome-feature',
'session.newWorktree.actions.change': '변경',
-2
View File
@@ -2833,8 +2833,6 @@ export const dict: Record<I18nKey, string> = {
'session.newWorktree.newSessionTitle': 'Nowa sesja',
'session.newWorktree.noBranchesFound': 'Nie znaleziono gałęzi',
'session.newWorktree.noMatchingBranches': 'Brak pasujących gałęzi',
'session.newWorktree.otherLocalBranches': 'Pozostałe lokalne gałęzie',
'session.newWorktree.otherRemoteBranches': 'Pozostałe zdalne gałęzie',
'session.newWorktree.prNumber': 'PR #{number}',
'session.newWorktree.remoteBranches': 'Zdalne gałęzie',
'session.newWorktree.resetToMatchBranchName': 'Zresetuj do nazwy zgodnej z gałęzią',
@@ -1936,8 +1936,6 @@ export const dict: Record<I18nKey, string> = {
"session.newWorktree.noMatchingBranches": "Não há branches coincidentes",
"session.newWorktree.localBranches": "Branches locais",
"session.newWorktree.remoteBranches": "Branches remotas",
"session.newWorktree.otherLocalBranches": "Outras branches locais",
"session.newWorktree.otherRemoteBranches": "Outras branches remotas",
"session.newWorktree.branchName": "Nome da branch",
"session.newWorktree.branchNamePlaceholder": "feature/my-awesome-feature",
"session.newWorktree.actions.change": "Alterar",
-2
View File
@@ -1936,8 +1936,6 @@ export const dict: Record<I18nKey, string> = {
"session.newWorktree.noMatchingBranches": "Немає відповідних гілок",
"session.newWorktree.localBranches": "Локальні гілки",
"session.newWorktree.remoteBranches": "Віддалені гілки",
"session.newWorktree.otherLocalBranches": "Інші локальні гілки",
"session.newWorktree.otherRemoteBranches": "Інші віддалені гілки",
"session.newWorktree.branchName": "Назва гілки",
"session.newWorktree.branchNamePlaceholder": "feature/my-awesome-feature",
"session.newWorktree.actions.change": "Змінити",
@@ -1924,8 +1924,6 @@ export const dict: Record<I18nKey, string> = {
'session.newWorktree.noMatchingBranches': '没有匹配分支',
'session.newWorktree.localBranches': '本地分支',
'session.newWorktree.remoteBranches': '远程分支',
'session.newWorktree.otherLocalBranches': '其他本地分支',
'session.newWorktree.otherRemoteBranches': '其他远程分支',
'session.newWorktree.branchName': '分支名',
'session.newWorktree.branchNamePlaceholder': 'feature/my-awesome-feature',
'session.newWorktree.actions.change': '更改',
@@ -1928,8 +1928,6 @@ export const dict: Record<I18nKey, string> = {
'session.newWorktree.noMatchingBranches': '沒有符合分支',
'session.newWorktree.localBranches': '本地分支',
'session.newWorktree.remoteBranches': '遠端分支',
'session.newWorktree.otherLocalBranches': '其他本地分支',
'session.newWorktree.otherRemoteBranches': '其他遠端分支',
'session.newWorktree.branchName': '分支名稱',
'session.newWorktree.branchNamePlaceholder': 'feature/my-awesome-feature',
'session.newWorktree.actions.change': '變更',