修复:“添加到VCS”的弹框显示了已经被git跟踪的文件
This commit is contained in:
@@ -272,7 +272,10 @@ function filterDirectoryGitCandidates(
|
|||||||
action: DirectoryGitAction
|
action: DirectoryGitAction
|
||||||
): DirectoryGitCandidateEntry[] {
|
): DirectoryGitCandidateEntry[] {
|
||||||
if (action === "add") {
|
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) => {
|
return entries.filter((entry) => {
|
||||||
|
|||||||
@@ -201,7 +201,10 @@ function filterDirectoryGitCandidates(
|
|||||||
action: DirectoryGitAction
|
action: DirectoryGitAction
|
||||||
): DirectoryGitCandidateEntry[] {
|
): DirectoryGitCandidateEntry[] {
|
||||||
if (action === "add") {
|
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") {
|
if (action === "delete-tracked") {
|
||||||
@@ -1001,11 +1004,7 @@ export function GitChangesTab() {
|
|||||||
>
|
>
|
||||||
{t("actions.rollback")}
|
{t("actions.rollback")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
<ContextMenuItem
|
<ContextMenuItem disabled>
|
||||||
onSelect={() => {
|
|
||||||
void handleAddToVcs(target)
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{t("actions.addToVcs")}
|
{t("actions.addToVcs")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
<ContextMenuItem
|
<ContextMenuItem
|
||||||
@@ -1089,13 +1088,7 @@ export function GitChangesTab() {
|
|||||||
>
|
>
|
||||||
{t("actions.rollback")}
|
{t("actions.rollback")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
<ContextMenuItem
|
<ContextMenuItem disabled>{t("actions.addToVcs")}</ContextMenuItem>
|
||||||
onSelect={() => {
|
|
||||||
void handleAddToVcs(target)
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{t("actions.addToVcs")}
|
|
||||||
</ContextMenuItem>
|
|
||||||
<ContextMenuItem
|
<ContextMenuItem
|
||||||
onSelect={() => {
|
onSelect={() => {
|
||||||
handleRequestDelete(target, "tracked")
|
handleRequestDelete(target, "tracked")
|
||||||
@@ -1110,7 +1103,6 @@ export function GitChangesTab() {
|
|||||||
},
|
},
|
||||||
[
|
[
|
||||||
handleOpenCommitWindow,
|
handleOpenCommitWindow,
|
||||||
handleAddToVcs,
|
|
||||||
handleRequestDelete,
|
handleRequestDelete,
|
||||||
handleRequestRollback,
|
handleRequestRollback,
|
||||||
openFilePreview,
|
openFilePreview,
|
||||||
@@ -1380,17 +1372,10 @@ export function GitChangesTab() {
|
|||||||
>
|
>
|
||||||
{t("actions.rollback")}
|
{t("actions.rollback")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
<ContextMenuItem
|
<ContextMenuItem disabled>
|
||||||
onSelect={() => {
|
|
||||||
void handleAddToVcs({
|
|
||||||
kind: "dir",
|
|
||||||
path: "",
|
|
||||||
name: folderName,
|
|
||||||
})
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{t("actions.addToVcs")}
|
{t("actions.addToVcs")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
|
|
||||||
<ContextMenuItem
|
<ContextMenuItem
|
||||||
onSelect={() => {
|
onSelect={() => {
|
||||||
handleRequestDelete(
|
handleRequestDelete(
|
||||||
|
|||||||
Reference in New Issue
Block a user