sindrets / diffview.nvim

Single tabpage interface for easily cycling through diffs for all modified files for any git rev.
Other
3.57k stars 101 forks source link

[Bug] : DiffviewOpen <commit> opens not against working tree #444

Closed gabyx closed 7 months ago

gabyx commented 7 months ago

Description

When I do DiffviewOpen <commit> the diff view is not against the working tree but just shows the diffs from <commit>~..<commit>. This is not described in the docs as such...

Expected behavior

The diff should open against the working tree.

Actual behavior

The diff is opened with diffing <commit>~..<commit>.

Steps to reproduce

  1. Make a change inside a file in a repo.
  2. DiffviewOpen <commit>

Health check

Output of :checkhealth diffview ``` ============================================================================== astronvim: require("astronvim.health").check() AstroNvim ~ - AstroNvim Version: v3.38.0 - Neovim Version: v0.9.4 - OK Using stable Neovim >= 0.8.0 - OK `git` is installed: Used for core functionality such as updater and plugin management - OK `xdg-open` is installed: Used for `gx` mapping for opening files with system opener (Optional) - OK `lazygit` is installed: Used for mappings to pull up git TUI (Optional) - OK `node` is installed: Used for mappings to pull up node REPL (Optional) - WARNING `gdu` is not installed: Used for mappings to pull up disk usage analyzer (Optional) - WARNING `btm` is not installed: Used for mappings to pull up system monitor (Optional) - OK `python` is installed: Used for mappings to pull up python REPL (Optional) ============================================================================== diffview: require("diffview.health").check() 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.42.0) - WARNING Configured `hg_cmd` is not executable: 'hg' ============================================================================== gitsigns: require("gitsigns.health").check() - OK git version 2.42.0 ============================================================================== hop: require("hop.health").check() Ensuring keys are unique ~ - OK Keys are unique Checking for deprecated features ~ - OK All good ============================================================================== lazy: require("lazy.health").check() lazy.nvim ~ - OK Git installed - OK no existing packages found by other package managers - OK packer_compiled.lua not found - WARNING {telescope.nvim}: overriding - WARNING {ropevim}: unknown key - WARNING {ropevim}: unknown key ============================================================================== mason: require("mason.health").check() mason.nvim ~ - OK mason.nvim version v1.8.3 - OK PATH: prepend - OK Providers: mason.providers.registry-api mason.providers.client - OK neovim version >= 0.7.0 mason.nvim [Registries] ~ - OK Registry `github.com/mason-org/mason-registry version: 2023-12-01-vain-kokopu` is installed. mason.nvim [Core utils] ~ - OK unzip: `UnZip 6.00 of 20 April 2009, by Info-ZIP. Maintained by C. Spieler. Send` - OK wget: `GNU Wget 1.21.4 built on linux-gnu.` - OK curl: `curl 8.4.0 (x86_64-pc-linux-gnu) libcurl/8.4.0 OpenSSL/3.0.12 zlib/1.3 brotli/1.1.0 zstd/1.5.5 libidn2/2.3.4 libssh2/1.11.0 nghttp2/1.57.0` - OK gzip: `gzip 1.13` - OK tar: `tar (GNU tar) 1.35` - OK bash: `GNU bash, version 5.2.15(1)-release (x86_64-pc-linux-gnu)` - OK sh: `Ok` mason.nvim [Languages] ~ - WARNING luarocks: not available - ADVICE: - spawn: luarocks failed with exit code - and signal -. luarocks is not executable - WARNING Composer: not available - ADVICE: - spawn: composer failed with exit code - and signal -. composer is not executable - WARNING PHP: not available - ADVICE: - spawn: php failed with exit code - and signal -. php is not executable - OK cargo: `cargo 1.72.0` - OK Go: `go version go1.21.4 linux/amd64` - OK Ruby: `ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) [x86_64-linux]` - OK node: `v18.18.2` - WARNING julia: not available - ADVICE: - spawn: julia failed with exit code - and signal -. julia is not executable - OK python: `Python 3.11.5` - OK python3_host_prog: `Python 3.11.6` - WARNING pip: not available - ADVICE: - spawn: python3 failed with exit code 1 and signal 0. /nix/store/ffll6glz3gwx342z0ch8wx30p5cnqz1z-python3-3.11.5/bin/python3: No module named pip - WARNING python3_host_prog pip: not available - ADVICE: - spawn: /nix/store/x550cpl6f99r1cnd11jf9naah2jb3wwj-neovim-0.9.4/bin/nvim-python3 failed with exit code 1 and signal 0. /nix/store/b9mkn6wrfrkkyaiix1p4rbipamvmyi1f-python3-3.11.6-env/bin/python3.11: No module named pip - OK RubyGem: `3.4.22` - OK java: `openjdk version "19.0.2" 2023-01-17` - OK python venv: `Ok` - OK javac: `javac 19.0.2` - OK npm: `9.8.1` mason.nvim [GitHub] ~ - OK GitHub API rate limit. Used: 0. Remaining: 60. Limit: 60. Reset: Sat 02 Dec 2023 01:34:44 PM CET. Install and authenticate via gh-cli to increase rate limit. ============================================================================== mkdp: health#mkdp#check - Platform: linux - Nvim Version: NVIM v0.9.4 Build type: Release LuaJIT 2.1.1693350652 system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: " /nix/store/xq1si67s6h5yzj6whnxrllhy1mqnzkz6-neovim-unwrapped-0.9.4/share/nvim " Run :checkhealth for more info - Pre build: /home/nixos/.local/share/nvim/lazy/markdown-preview.nvim/app/bin/markdown-preview-linux - Pre build version: 0.0.10 - OK Using pre build ============================================================================== neoconf: require("neoconf.health").check() neoconf.nvim ~ - OK **treesitter-nvim** is installed - WARNING **TreeSitter jsonc** parser is not installed. Highlighting of jsonc files might be broken - OK **neodev.nvim** is installed - OK **lspconfig** is installed - OK **lspconfig jsonls** is installed - OK **lspconfig lua_ls** is installed ============================================================================== null-ls: require("null-ls.health").check() - OK codespell: the command "codespell" is executable. ============================================================================== nvim: require("nvim.health").check() Configuration ~ - OK no issues found Runtime ~ - OK $VIMRUNTIME: /nix/store/xq1si67s6h5yzj6whnxrllhy1mqnzkz6-neovim-unwrapped-0.9.4/share/nvim/runtime Performance ~ - OK Build type: Release Remote Plugins ~ - OK Up to date terminal ~ - key_backspace (kbs) terminfo entry: `key_backspace=^H` - key_dc (kdch1) terminfo entry: `key_dc=\E[3~` - $TERM_PROGRAM="tmux" tmux ~ - OK escape-time: 150 - OK focus-events: on - $TERM: screen-256color ============================================================================== nvim-treesitter: require("nvim-treesitter.health").check() Installation ~ - WARNING `tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall) - OK `node` found v18.18.2 (only needed for :TSInstallFromGrammar) - OK `git` executable found. - OK `gcc` executable found. Selected from { "gcc", "cc", "gcc", "clang", "cl", "zig" } Version: gcc (GCC) 12.3.0 - OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI. OS Info: { machine = "x86_64", release = "6.1.63", sysname = "Linux", version = "#1-NixOS SMP PREEMPT_DYNAMIC Mon Nov 20 10:52:19 UTC 2023" } ~ Parser/Features H L F I J - bash ✓ ✓ ✓ . ✓ - c ✓ ✓ ✓ ✓ ✓ - cmake ✓ . ✓ ✓ . - cpp ✓ ✓ ✓ ✓ ✓ - css ✓ . ✓ ✓ ✓ - dockerfile ✓ . . . ✓ - git_rebase ✓ . . . ✓ - gitcommit ✓ . . . ✓ - go ✓ ✓ ✓ ✓ ✓ - html ✓ ✓ ✓ ✓ ✓ - javascript ✓ ✓ ✓ ✓ ✓ - json ✓ ✓ ✓ ✓ . - lua ✓ ✓ ✓ ✓ ✓ - make ✓ . ✓ . ✓ - markdown ✓ . ✓ ✓ ✓ - markdown_inline ✓ . . . ✓ - nix ✓ ✓ ✓ . ✓ - python ✓ ✓ ✓ ✓ ✓ - query ✓ ✓ ✓ ✓ ✓ - rust ✓ ✓ ✓ ✓ ✓ - toml ✓ ✓ ✓ ✓ ✓ - vim ✓ ✓ ✓ . ✓ - vimdoc ✓ . . . ✓ Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections +) multiple parsers found, only one will be used x) errors found in the query, try to run :TSUpdate {lang} ~ ============================================================================== provider: health#provider#check Clipboard (optional) ~ - OK Clipboard tool found: wl-copy Python 3 provider (optional) ~ - Using: g:python3_host_prog = "/nix/store/x550cpl6f99r1cnd11jf9naah2jb3wwj-neovim-0.9.4/bin/nvim-python3" - Executable: /nix/store/x550cpl6f99r1cnd11jf9naah2jb3wwj-neovim-0.9.4/bin/nvim-python3 - Python version: 3.11.6 - pynvim version: 0.4.3 - OK Latest pynvim is installed. Python virtualenv ~ - OK no $VIRTUAL_ENV Ruby provider (optional) ~ - Ruby: ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) [x86_64-linux] - Host: /nix/store/x550cpl6f99r1cnd11jf9naah2jb3wwj-neovim-0.9.4/bin/nvim-ruby - WARNING Gem "neovim" is out-of-date. Installed: 0.9.0, latest: 0.9.1 - ADVICE: - Run in shell: gem update neovim Node.js provider (optional) ~ - Disabled (g:loaded_node_provider=0). Perl provider (optional) ~ - Disabled (g:loaded_perl_provider=0). ============================================================================== telescope: require("telescope.health").check() Checking for required plugins ~ - OK plenary installed. - OK nvim-treesitter installed. Checking external dependencies ~ - OK rg: found ripgrep 13.0.0 - OK fd: found fd 8.7.1 ===== Installed extensions ===== ~ Telescope Extension: `aerial` ~ - No healthcheck provided Telescope Extension: `fzf` ~ - OK lib working as expected - OK file_sorter correctly configured - OK generic_sorter correctly configured Telescope Extension: `media_files` ~ - No healthcheck provided Telescope Extension: `notify` ~ - No healthcheck provided ============================================================================== vim.lsp: require("vim.lsp.health").check() - LSP log level : WARN - Log path: /home/nixos/.local/state/nvim/lsp.log - Log size: 12684 KB vim.lsp: Active Clients ~ - null-ls (id=1, root_dir=/home/nixos/Desktop/Repos/wezterm) - rust_analyzer (id=2, root_dir=/home/nixos/Desktop/Repos/wezterm) - lua_ls (id=3, root_dir=/home/nixos/Desktop/Repos/wezterm) ============================================================================== vim.treesitter: require("vim.treesitter.health").check() - Nvim runtime ABI version: 14 - OK Parser: bash ABI: 14, path: /home/nixos/.local/share/nvim/lazy/nvim-treesitter/parser/bash.so - OK Parser: c ABI: 14, path: /home/nixos/.local/share/nvim/lazy/nvim-treesitter/parser/c.so - OK Parser: cmake ABI: 14, path: /home/nixos/.local/share/nvim/lazy/nvim-treesitter/parser/cmake.so - OK Parser: cpp ABI: 14, path: /home/nixos/.local/share/nvim/lazy/nvim-treesitter/parser/cpp.so - OK Parser: css ABI: 14, path: /home/nixos/.local/share/nvim/lazy/nvim-treesitter/parser/css.so - OK Parser: dockerfile ABI: 14, path: /home/nixos/.local/share/nvim/lazy/nvim-treesitter/parser/dockerfile.so - OK Parser: git_rebase ABI: 14, path: /home/nixos/.local/share/nvim/lazy/nvim-treesitter/parser/git_rebase.so - OK Parser: gitcommit ABI: 14, path: /home/nixos/.local/share/nvim/lazy/nvim-treesitter/parser/gitcommit.so - OK Parser: go ABI: 14, path: /home/nixos/.local/share/nvim/lazy/nvim-treesitter/parser/go.so - OK Parser: html ABI: 14, path: /home/nixos/.local/share/nvim/lazy/nvim-treesitter/parser/html.so - OK Parser: javascript ABI: 14, path: /home/nixos/.local/share/nvim/lazy/nvim-treesitter/parser/javascript.so - OK Parser: json ABI: 14, path: /home/nixos/.local/share/nvim/lazy/nvim-treesitter/parser/json.so - OK Parser: lua ABI: 14, path: /home/nixos/.local/share/nvim/lazy/nvim-treesitter/parser/lua.so - OK Parser: make ABI: 13, path: /home/nixos/.local/share/nvim/lazy/nvim-treesitter/parser/make.so - OK Parser: markdown ABI: 14, path: /home/nixos/.local/share/nvim/lazy/nvim-treesitter/parser/markdown.so - OK Parser: markdown_inline ABI: 14, path: /home/nixos/.local/share/nvim/lazy/nvim-treesitter/parser/markdown_inline.so - OK Parser: nix ABI: 13, path: /home/nixos/.local/share/nvim/lazy/nvim-treesitter/parser/nix.so - OK Parser: python ABI: 14, path: /home/nixos/.local/share/nvim/lazy/nvim-treesitter/parser/python.so - OK Parser: rust ABI: 14, path: /home/nixos/.local/share/nvim/lazy/nvim-treesitter/parser/rust.so - OK Parser: toml ABI: 13, path: /home/nixos/.local/share/nvim/lazy/nvim-treesitter/parser/toml.so - OK Parser: vim ABI: 14, path: /home/nixos/.local/share/nvim/lazy/nvim-treesitter/parser/vim.so - OK Parser: vimdoc ABI: 14, path: /home/nixos/.local/share/nvim/lazy/nvim-treesitter/parser/vimdoc.so - OK Parser: c ABI: 14, path: /nix/store/xq1si67s6h5yzj6whnxrllhy1mqnzkz6-neovim-unwrapped-0.9.4/lib/nvim/parser/c.so - OK Parser: lua ABI: 14, path: /nix/store/xq1si67s6h5yzj6whnxrllhy1mqnzkz6-neovim-unwrapped-0.9.4/lib/nvim/parser/lua.so - OK Parser: query ABI: 14, path: /nix/store/xq1si67s6h5yzj6whnxrllhy1mqnzkz6-neovim-unwrapped-0.9.4/lib/nvim/parser/query.so - OK Parser: vim ABI: 14, path: /nix/store/xq1si67s6h5yzj6whnxrllhy1mqnzkz6-neovim-unwrapped-0.9.4/lib/nvim/parser/vim.so - OK Parser: vimdoc ABI: 14, path: /nix/store/xq1si67s6h5yzj6whnxrllhy1mqnzkz6-neovim-unwrapped-0.9.4/lib/nvim/parser/vimdoc.so ============================================================================== which-key: require("which-key.health").check() WhichKey: checking conflicting keymaps ~ - WARNING conflicting keymap exists for mode **"n"**, lhs: **"dm"** - rhs: `lua require'marks'.delete()` - WARNING conflicting keymap exists for mode **"n"**, lhs: **" w"** - rhs: `w` - WARNING conflicting keymap exists for mode **"n"**, lhs: **"c"** - rhs: `"_c` - WARNING conflicting keymap exists for mode **"n"**, lhs: **"m"** - rhs: `lua require'marks'.set()` ```

Log info

Relevant info from :DiffviewLog ``` [INFO 2023-12-02 12:29:20.320 +0100] ...local/share/nvim/lazy/diffview.nvim/lua/diffview/lib.lua:24: [command call] :DiffviewOpen 9aa78ec3b984915a38ab20c0210cdcacef328bbe [INFO 2023-12-02 12:29:20.469 +0100] ...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:483: [DiffView] Completed update for 6 files successfully (37.977 ms) [ERROR 2023-12-02 12:34:43.506 +0100] ...lazy/diffview.nvim/lua/diffview/vcs/adapters/hg/init.lua:53: [HgAdapter] Configured `hg_cmd` is not executable: 'hg' [INFO 2023-12-02 12:35:41.084 +0100] ...local/share/nvim/lazy/diffview.nvim/lua/diffview/lib.lua:24: [command call] :DiffviewOpen 9aa78ec3b984915a38ab20c0210cdcacef328bbe [INFO 2023-12-02 12:35:41.241 +0100] ...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:483: [DiffView] Completed update for 6 files successfully (41.118 ms) :ta ```

Neovim version

NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1693350652

Operating system and version

Linux linux-nixos 6.1.63 #1-NixOS SMP PREEMPT_DYNAMIC Mon Nov 20 10:52:19 UTC 2023 x86_64 GNU/Linux

Minimal config

No response

gabyx commented 7 months ago

@sindrets : otherwise nice tool!!

sindrets commented 7 months ago

When I do DiffviewOpen <commit> the diff view is not against the working tree but just shows the diffs from <commit>~..<commit>.

That sounds really weird. What makes you think that's the case?

The resulting diff from :DiffviewOpen {REV} should have the {REV} version on the left side and the working tree version on the right side of the diff.

I can't reproduce the issue you describe. If you believe something is not working correctly here, you need to provide a minimal config starting with the one provided in the bug template.

gabyx commented 7 months ago

Sorry for the troubles, I guess I have seen an artefact, I close for now and if it happens again I can reopen.