Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions lua/neogit/integrations/diffview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ local M = {}

local dv = require("diffview")
local dv_config = require("diffview.config")
local Rev = require("diffview.git.rev").Rev
local RevType = require("diffview.git.rev").RevType
local Rev = require("diffview.vcs.adapters.git.rev").GitRev
local RevType = require("diffview.vcs.rev").RevType
local CDiffView = require("diffview.api.views.diff.diff_view").CDiffView
local dv_lib = require("diffview.lib")
local dv_utils = require("diffview.utils")
Expand Down Expand Up @@ -69,14 +69,19 @@ local function root_prefix(git_root, cwd, path)
end

local function get_local_diff_view(selected_file_name)
local left = Rev(RevType.INDEX)
local left = Rev(RevType.STAGE)
local right = Rev(RevType.LOCAL)
local git_root = neogit.cli.git_root_sync()

local function update_files()
local files = {}
local repo = neogit.get_repo()
local sections = {
conflicting = {
items = vim.tbl_filter(function(o)
return o.mode and o.mode:sub(2, 2) == "U"
end, repo.untracked.items),
},
working = repo.unstaged,
staged = repo.staged,
}
Expand All @@ -87,7 +92,7 @@ local function get_local_diff_view(selected_file_name)
-- use the repo.cwd instead of current as it may change since the
-- status was refreshed
path = root_prefix(git_root, repo.cwd, item.name),
status = item.mode,
status = item.mode and item.mode:sub(1, 1),
stats = (item.diff and item.diff.stats) and {
additions = item.diff.stats.additions or 0,
deletions = item.diff.stats.deletions or 0,
Expand Down