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(