Skip to content

Add setting to hide untracked files in Search & Compare view when comparing with Working Tree #5279

@herquan-docusign

Description

@herquan-docusign

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageNeeds to be looked at
    No fields configured for Enhancement.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions