You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you're in a $ git rebase -i --root and hit a conflict (especially on an early first commit), :DiffviewOpen crashes.
The issue is that $ git merge-base HEAD <REBASE_HEAD_or_similar> often can't find a common ancestor and fails. Diffview's GitAdapter:get_merge_context() in lua/diffview/vcs/adapters/git/init.lua used to have an assert(code == 0) for this merge-base call.
When `$ git merge-base~ returned an error, this assert would trigger a Lua error, stopping Diffview.
I'll provide pull request to fix it later.
Expected behavior
No assertion error.
Actual behavior
Assertion error.
Error executing vim.schedule lua callback: ...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:187: The c
oroutine failed with this message:
context: cur_thread=main co_thread=<thread 0x7d37ed8c4000> co_func=...iffview.nvim/lua/diffview/scene/vie
ws/diff/diff_view.lua:327
...azy/diffview.nvim/lua/diffview/vcs/adapters/git/init.lua:329: assertion failed!
stack traceback:
[C]: in function 'assert'
...azy/diffview.nvim/lua/diffview/vcs/adapters/git/init.lua:329: in function 'get_merge_context'
...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:454: in function 'func'
...cal/share/nvim/lazy/diffview.nvim/lua/diffview/async.lua:373: in function <...cal/share/nvim/lazy/diff
view.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/diff
view.nvim/lua/diffview/async.lua:391>
Steps to reproduce
In a test repo, do $ git rebase -i --root.
Make sure a conflict happens on an early commit.
When the rebase stops, try :DiffviewOpen.
Original code: Lua error from the merge-base assert.
With the fix: Diffview should open with a 3-way diff (using empty tree as base if needed).
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.49.0)
- ⚠️ WARNING Configured `hg_cmd` is not executable: 'hg'
Description
When you're in a
$ git rebase -i --root
and hit a conflict (especially on an early first commit), :DiffviewOpen crashes.The issue is that
$ git merge-base HEAD <REBASE_HEAD_or_similar>
often can't find a common ancestor and fails. Diffview'sGitAdapter:get_merge_context()
in lua/diffview/vcs/adapters/git/init.lua used to have anassert(code == 0)
for this merge-base call.When `$ git merge-base~ returned an error, this assert would trigger a Lua error, stopping Diffview.
I'll provide pull request to fix it later.
Expected behavior
No assertion error.
Actual behavior
Assertion error.
Steps to reproduce
$ git rebase -i --root
.:DiffviewOpen
.Health check
Output of
:checkhealth diffview
Log info
Relevant info from
:DiffviewLog
Neovim version
Operating system and version
Linux 6.14.4-arch1-2 x86_64 GNU/Linux
Minimal config
The text was updated successfully, but these errors were encountered: