Skip to content

[Bug] Untracked files are not shown when comparing working tree against a specific commit #584

@KEY60228

Description

@KEY60228

Description

Untracked files are not displayed when using DiffviewOpen to compare the working tree against a specific commit (e.g., DiffviewOpen HEAD~2), even though the documentation indicates this should show all working tree changes.

Note

I noticed the code has an explicit check to only show untracked files for STAGE..LOCAL comparisons, so this might be intentional behavior. However, it seems inconsistent with the documentation which states "Diff the working tree against a specific commit". If this is by design, I apologize for the confusion, but I wanted to raise this as the current behavior was unexpected.

Expected behavior

When running :DiffviewOpen HEAD~2, untracked files should be visible in the file panel since we're comparing the working tree (which includes untracked files) against a specific commit.

Actual behavior

Untracked files are not displayed when using DiffviewOpen with any commit reference. They only appear when running DiffviewOpen without arguments (comparing index vs working tree).

Steps to reproduce

  1. Create an untracked file: echo "test" > untracked.txt
  2. Run :DiffviewOpen HEAD~1 (or any commit reference)
  3. Observe that untracked.txt is not shown in the file panel
  4. Run :DiffviewOpen without arguments
  5. Observe that untracked.txt is now visible

Health check

==============================================================================
diffview: 1 ⚠️

Checking plugin dependencies ~

  • ✅ OK nvim-web-devicons installed.

Checking VCS tools ~

  • The plugin requires at least one of the supported VCS tools to be valid.
  • ✅ OK Git found.
  • ✅ OK Git is up-to-date. (2.50.0)
  • ⚠️ WARNING Configured hg_cmd is not executable: 'hg'

Log info

No response

Neovim version

NVIM v0.11.2
Build type: Release
LuaJIT 2.1.1748459687

Operating system and version

macOS v15.5

Minimal config

return {
  "sindrets/diffview.nvim",
  lazy = false,
  keys = {},
  config = function()
    require("diffview").setup({})
  end
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions