Skip to content

Git - fix wrong file count in conflict and discard dialogs#302734

Open
xingsy97 wants to merge 1 commit intomicrosoft:mainfrom
xingsy97:wt/git-fix-dialog-counts
Open

Git - fix wrong file count in conflict and discard dialogs#302734
xingsy97 wants to merge 1 commit intomicrosoft:mainfrom
xingsy97:wt/git-fix-dialog-counts

Conversation

@xingsy97
Copy link
Member

@xingsy97 xingsy97 commented Mar 18, 2026

Fix two dialog message bugs in the git extension:

1. stageAllMerge warning shows wrong count and filename

categorizeResourceByResolution() splits merge resources into merge (all), unresolved (still have conflict markers), resolved, and deletionConflicts. The warning dialog used merge.length and merge[0] instead of unresolved.length and unresolved[0].

Before:

  • 5 files in merge group (3 resolved, 2 unresolved)
  • Dialog: "stage 5 files with merge conflicts?"
  • Single-file case may show a resolved file's name

After:

  • Dialog: "stage 2 files with merge conflicts?"
  • Single-file case shows the actual unresolved file

The nearby stage command already uses unresolved correctly.

2. Trash fallback dialog shows wrong file count

When trash deletion fails, the fallback confirmation used resources.length (all selected resources) instead of toClean.length (only untracked/ignored files to permanently delete).

Before:

  • User discards 3 untracked + 5 modified files, trash fails
  • Dialog: "Delete All 8 Files?"
  • Only 3 are actually deleted (the other 5 are restored via git checkout)

After:

  • Dialog: "Delete All 3 Files?"

Copilot AI review requested due to automatic review settings March 18, 2026 09:41
@vs-code-engineering
Copy link
Contributor

vs-code-engineering bot commented Mar 18, 2026

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@lszomoru

Matched files:

  • extensions/git/src/commands.ts
  • extensions/git/src/repository.ts

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes two user-facing dialog count/name issues in the built-in Git extension so warnings accurately reflect the set of files actually affected (unresolved merge conflicts and permanently-deleted resources).

Changes:

  • Update git.stageAllMerge warning dialog to use the unresolved set (count + single-file basename) instead of the broader merge set.
  • Update trash-deletion fallback dialog to display toClean.length (files that will be permanently deleted) instead of resources.length (all inputs).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
extensions/git/src/repository.ts Fixes “Delete All {n} Files” to reflect the actual permanently-deleted file count (toClean).
extensions/git/src/commands.ts Fixes merge-conflict staging warning to reference the unresolved conflict set for both plural/singular cases.

@xingsy97 xingsy97 force-pushed the wt/git-fix-dialog-counts branch from 5caea1f to 06486f5 Compare March 18, 2026 09:49
@xingsy97 xingsy97 changed the title git: fix incorrect file counts in merge conflict and trash fallback dialogs Git - fix incorrect file counts in merge conflict and trash fallback dialogs Mar 18, 2026
@xingsy97 xingsy97 changed the title Git - fix incorrect file counts in merge conflict and trash fallback dialogs Git - fix wrong file count in conflict and discard dialogs Mar 23, 2026
@xingsy97 xingsy97 force-pushed the wt/git-fix-dialog-counts branch from 06486f5 to d46eba8 Compare March 23, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants