Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] :DiffviewOpen origin/main...HEAD isn't working #491

Closed
carlos-algms opened this issue May 9, 2024 · 0 comments
Closed

[Bug] :DiffviewOpen origin/main...HEAD isn't working #491

carlos-algms opened this issue May 9, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@carlos-algms
Copy link

Description

The command to compare a remote branch with the current HEAD isn't working and throws an Error.

Expected behavior

It should work and show the diff panel comparing the remote with the local changes

Actual behavior

It opens the diff panel empty and shows the error:
InvalidArgument :: Can't diff LOCAL against LOCAL!

Steps to reproduce

run:
:DiffviewOpen origin/main...HEAD
or:
:DiffviewOpen origin/HEAD...HEAD

Health check

Output of :checkhealth diffview
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.39.3)
- WARNING Configured `hg_cmd` is not executable: 'hg'


Log info

Full error:
Error executing vim.schedule lua callback: ...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:187: The coroutine failed with this message:                            
        context: cur_thread=main co_thread=<thread 0x0108bee9c0> co_func=...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:327                                       
...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:187: The coroutine failed with this message:                                                                       
        context: cur_thread=<thread 0x0108bee9c0> co_thread=<thread 0x0108bf0c68> co_func=...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:306                      
...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:187: The coroutine failed with this message:                                                                       
        context: cur_thread=<thread 0x0108bf0c68> co_thread=<thread 0x0108bfe628> co_func=...share/nvim/lazy/diffview.nvim/lua/diffview/vcs/utils.lua:69                       
...azy/diffview.nvim/lua/diffview/vcs/adapters/git/init.lua:1479: InvalidArgument :: Can't diff LOCAL against LOCAL!                                                           
stack traceback:                                                                                                                                                               
        [C]: in function 'assert'                                                                                                                                              
        ...azy/diffview.nvim/lua/diffview/vcs/adapters/git/init.lua:1479: in function 'rev_to_args'                                                                            
        ...share/nvim/lazy/diffview.nvim/lua/diffview/vcs/utils.lua:72: in function <...share/nvim/lazy/diffview.nvim/lua/diffview/vcs/utils.lua:69>                           
        [C]: in function 'xpcall'                                                                                                                                              
        ...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:361: in function <...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:358>                         
stack traceback:                                                                                                                                                               
        [C]: in function 'error'                                                                                                                                               
        ...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:369: in function <...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:358>                         
stack traceback:                                                                                                                                                               
        [C]: in function 'error'                                                                                                                                               
        ...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:187: in function 'raise'                                                                                   
        ...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:215: in function 'step'                                                                                    
        ...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:412: in function 'diff_file_list'                                                                          
        ...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:307: in function <...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:306>                         
        [C]: in function 'xpcall'                                                                                                                                              
        ...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:361: in function <...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:358>                         
stack traceback:                                                                                                                                                               
        [C]: in function 'error'                                                                                                                                               
        ...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:369: in function <...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:358>                         
stack traceback:                                                                                                                                                               
        [C]: in function 'error'                                                                                                                                               
        ...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:187: in function 'raise'                                                                                   
        ...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:215: in function 'step'                                                                                    
        ...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:412: in function 'get_updated_files'                                                                       
        ...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:350: in function 'func'                                                                                    
        ...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:373: in function <...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:358>                         
stack traceback:                                                                                                                                                               
        [C]: in function 'error'                                                                                                                                               
        ...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:187: in function 'raise'                                                                                   
        ...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:215: in function 'step'                                                                                    
        ...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:412: in function 'fn'                                                                                      
        .../share/nvim/lazy/diffview.nvim/lua/diffview/debounce.lua:77: in function 'fn'                                                                                       
        .../share/nvim/lazy/diffview.nvim/lua/diffview/debounce.lua:32: in function 'update_files'                                                                             
        ...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:110: in function <...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:107>
Relevant info from :DiffviewLog
[INFO  2024-05-09 13:14:18.196 +0200] ...local/share/nvim/lazy/diffview.nvim/lua/diffview/lib.lua:24: [command call] :DiffviewOpen --imply-local origin/HEAD...HEAD

Neovim version

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1713773202

Operating system and version

Mac

Minimal config

-- #######################################
-- ### USAGE: nvim --clean -u mini.lua ###
-- #######################################

local root = vim.fn.stdpath("run") .. "/nvim/diffview.nvim"
vim.fn.mkdir(root, "p")

-- set stdpaths to use root
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  {
    "sindrets/diffview.nvim",
    dependencies = { "nvim-tree/nvim-web-devicons" },
    config = function()
      require("diffview").setup({
        -- ##############################################################################
        -- ### ADD DIFFVIEW.NVIM CONFIG THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE ###
        -- ##############################################################################
      })
    end,
  },
  -- ##################################################################
  -- ### ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE ###
  -- ##################################################################
}
require("lazy").setup(plugins, { root = root .. "/plugins" })
require("lazy").sync({ show = false, wait = true })

vim.opt.termguicolors = true
vim.cmd("colorscheme " .. (vim.fn.has("nvim-0.8") == 1 and "habamax" or "slate"))

-- ############################################################################
-- ### ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE ###
-- ############################################################################
@carlos-algms carlos-algms added the bug Something isn't working label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant