From f33f658a855d65621105a0d21d444f6b260e89d0 Mon Sep 17 00:00:00 2001 From: xintaofei Date: Wed, 1 Apr 2026 10:39:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E2=80=9C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=88=B0VCS=E2=80=9D=E7=9A=84=E5=BC=B9=E6=A1=86?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=BA=86=E5=B7=B2=E7=BB=8F=E8=A2=ABgit?= =?UTF-8?q?=E8=B7=9F=E8=B8=AA=E7=9A=84=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/aux-panel-file-tree-tab.tsx | 5 ++- .../layout/aux-panel-git-changes-tab.tsx | 31 +++++-------------- 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/components/layout/aux-panel-file-tree-tab.tsx b/src/components/layout/aux-panel-file-tree-tab.tsx index 042d051..7e3b8cf 100644 --- a/src/components/layout/aux-panel-file-tree-tab.tsx +++ b/src/components/layout/aux-panel-file-tree-tab.tsx @@ -272,7 +272,10 @@ function filterDirectoryGitCandidates( action: DirectoryGitAction ): DirectoryGitCandidateEntry[] { if (action === "add") { - return entries.filter((entry) => entry.status.trim().length > 0) + return entries.filter((entry) => { + const fileState = classifyGitFileState(entry.status) + return fileState === "untracked" + }) } return entries.filter((entry) => { diff --git a/src/components/layout/aux-panel-git-changes-tab.tsx b/src/components/layout/aux-panel-git-changes-tab.tsx index 7dc6ddb..3792fae 100644 --- a/src/components/layout/aux-panel-git-changes-tab.tsx +++ b/src/components/layout/aux-panel-git-changes-tab.tsx @@ -201,7 +201,10 @@ function filterDirectoryGitCandidates( action: DirectoryGitAction ): DirectoryGitCandidateEntry[] { if (action === "add") { - return entries.filter((entry) => entry.status.trim().length > 0) + return entries.filter((entry) => { + const fileState = classifyGitFileState(entry.status) + return fileState === "untracked" + }) } if (action === "delete-tracked") { @@ -1001,11 +1004,7 @@ export function GitChangesTab() { > {t("actions.rollback")} - { - void handleAddToVcs(target) - }} - > + {t("actions.addToVcs")} {t("actions.rollback")} - { - void handleAddToVcs(target) - }} - > - {t("actions.addToVcs")} - + {t("actions.addToVcs")} { handleRequestDelete(target, "tracked") @@ -1110,7 +1103,6 @@ export function GitChangesTab() { }, [ handleOpenCommitWindow, - handleAddToVcs, handleRequestDelete, handleRequestRollback, openFilePreview, @@ -1380,17 +1372,10 @@ export function GitChangesTab() { > {t("actions.rollback")} - { - void handleAddToVcs({ - kind: "dir", - path: "", - name: folderName, - }) - }} - > + {t("actions.addToVcs")} + { handleRequestDelete(