Skip to content

Commit 56f63a0

Browse files
committed
feat: Update diffview integration.
Adjustments to accommodate changes in Diffview.nvim. This also enables diffviews created from Neogit to use the merge-tool in Diffview.nvim.
1 parent fcf630b commit 56f63a0

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lua/neogit/integrations/diffview.lua

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ local M = {}
22

33
local dv = require("diffview")
44
local dv_config = require("diffview.config")
5-
local Rev = require("diffview.git.rev").Rev
6-
local RevType = require("diffview.git.rev").RevType
5+
local Rev = require("diffview.vcs.adapters.git.rev").GitRev
6+
local RevType = require("diffview.vcs.rev").RevType
77
local CDiffView = require("diffview.api.views.diff.diff_view").CDiffView
88
local dv_lib = require("diffview.lib")
99
local dv_utils = require("diffview.utils")
@@ -69,14 +69,19 @@ local function root_prefix(git_root, cwd, path)
6969
end
7070

7171
local function get_local_diff_view(selected_file_name)
72-
local left = Rev(RevType.INDEX)
72+
local left = Rev(RevType.STAGE)
7373
local right = Rev(RevType.LOCAL)
7474
local git_root = neogit.cli.git_root_sync()
7575

7676
local function update_files()
7777
local files = {}
7878
local repo = neogit.get_repo()
7979
local sections = {
80+
conflicting = {
81+
items = vim.tbl_filter(function(o)
82+
return o.mode and o.mode:sub(2, 2) == "U"
83+
end, repo.untracked.items),
84+
},
8085
working = repo.unstaged,
8186
staged = repo.staged,
8287
}
@@ -87,7 +92,7 @@ local function get_local_diff_view(selected_file_name)
8792
-- use the repo.cwd instead of current as it may change since the
8893
-- status was refreshed
8994
path = root_prefix(git_root, repo.cwd, item.name),
90-
status = item.mode,
95+
status = item.mode and item.mode:sub(1, 1),
9196
stats = (item.diff and item.diff.stats) and {
9297
additions = item.diff.stats.additions or 0,
9398
deletions = item.diff.stats.deletions or 0,

0 commit comments

Comments
 (0)