Description
Problem
When using the Search & Compare view (in GitLens Inspect) to compare a branch with the Working Tree, untracked files are always shown in the "files changed" list. There is no setting to hide them.
GitLens hardcodes includeUntracked: true when comparing with the working tree. The getUntrackedFiles() method calls git ls-files --others --exclude-standard and the results are always merged into the comparison file list (in getDiffStatus and getChangedFilesCount).
The VS Code built-in setting git.untrackedChanges does not affect GitLens views.
Proposed solution
Add a setting such as gitlens.views.searchAndCompare.includeUntracked (default: true) that controls whether untracked files are included when comparing with the Working Tree in the Search & Compare view. Ideally this could also be toggled via a context menu action on the comparison result node, similar to the existing setResultsFilesFilterOnLeft / setResultsFilesFilterOnRight / setResultsFilesFilterOff commands.
Current workaround
The only workaround is to add files to exclude or .gitignore, which is not ideal since it changes git behavior globally for the repo rather than just controlling the GitLens UI.
Environment
- GitLens Version: 18.0.0
- Git Version: git version 2.50.0.windows.1
Description
Problem
When using the Search & Compare view (in GitLens Inspect) to compare a branch with the Working Tree, untracked files are always shown in the "files changed" list. There is no setting to hide them.
GitLens hardcodes
includeUntracked: truewhen comparing with the working tree. ThegetUntrackedFiles()method callsgit ls-files --others --exclude-standardand the results are always merged into the comparison file list (ingetDiffStatusandgetChangedFilesCount).The VS Code built-in setting
git.untrackedChangesdoes not affect GitLens views.Proposed solution
Add a setting such as
gitlens.views.searchAndCompare.includeUntracked(default:true) that controls whether untracked files are included when comparing with the Working Tree in the Search & Compare view. Ideally this could also be toggled via a context menu action on the comparison result node, similar to the existingsetResultsFilesFilterOnLeft/setResultsFilesFilterOnRight/setResultsFilesFilterOffcommands.Current workaround
The only workaround is to add files to
excludeor.gitignore, which is not ideal since it changes git behavior globally for the repo rather than just controlling the GitLens UI.Environment