Skip to content

[Bug] Diffview cannot be shown when file is changed into folder #523

Open
@rosstang

Description

@rosstang

Description

When a file is deleted and a new folder is created with the same new, with some files in it, the diff view shows an error and can't do the diff.

Expected behavior

It should diff correctly.

Actual behavior

The following output is shown instead,

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 0x738851a2b2b8> co_func=...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:327
.../share/nvim/lazy/diffview.nvim/lua/diffview/renderer.lua:166: attempt to get length of local 'text' (a function value)
stack traceback:
        .../share/nvim/lazy/diffview.nvim/lua/diffview/renderer.lua: in function 'add_text'
        ...y/diffview.nvim/lua/diffview/scene/views/diff/render.lua:107: in function 'render_file_tree_recurse'
        ...y/diffview.nvim/lua/diffview/scene/views/diff/render.lua:120: in function 'render_file_tree'
        ...y/diffview.nvim/lua/diffview/scene/views/diff/render.lua:130: in function 'render_files'
        ...y/diffview.nvim/lua/diffview/scene/views/diff/render.lua:176: in function <...y/diffview.nvim/lua/diffview/scene/views/diff/render.lua:134>
        ...ffview.nvim/lua/diffview/scene/views/diff/file_panel.lua:400: in function 'render'
        ...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:465: 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:247: in function 'notify_all'
        ...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:222: in function 'step'
        ...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:399: in function <...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:391>

Steps to reproduce

  1. A simple repo is checkout: git clone [email protected]:rosstang/diffview.git
  2. In nvim, run :DiffviewOpen origin/test
  3. The above error messages show up, and the diff view is empty

Health check

Output of :checkhealth diffview
   2 diffview:
   3
   4 - ERROR No healthcheck found for "diffview" plugin.
   5

Log info

Relevant info from :DiffviewLog
############################
### PUT LOG CONTENT HERE ###
############################

Neovim version

NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713484068
Run "nvim -V1 -v" for more info

Operating system and version

Linux 6.5.0-41-generic x86_64 GNU/Linux

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