Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Plug 'sindrets/diffview.nvim'

```lua
-- Packer
use "sindrets/diffview.nvim"
use "sindrets/diffview.nvim"
```

## Merge Tool
Expand Down
1 change: 0 additions & 1 deletion lua/diffview/debounce.lua
Original file line number Diff line number Diff line change
Expand Up @@ -243,4 +243,3 @@ function M.set_timeout(func, delay)
end

return M

22 changes: 20 additions & 2 deletions lua/diffview/vcs/adapters/git/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,16 @@ local function get_toplevel(path)
if code ~= 0 then
return nil
end
return out[1] and vim.trim(out[1])

local path = out[1] and vim.trim(out[1])

if path then
if vim.fn.has('win32') == 1 and string.sub(path, 1, 1) == '/' then
path = string.gsub(string.sub(path, 2, 2) .. ':' .. string.sub(path, 3), '/', '\\')
end
end

return path
end

---Try to find the top-level of a working tree by using the given indicative
Expand Down Expand Up @@ -279,7 +288,16 @@ function GitAdapter:get_dir(path)
if code ~= 0 then
return nil
end
return out[1] and vim.trim(out[1])

local path = out[1] and vim.trim(out[1])

if path then
if vim.fn.has('win32') == 1 and string.sub(path, 1, 1) == '/' then
path = string.gsub(string.sub(path, 2, 2) .. ':' .. string.sub(path, 3), '/', '\\')
end
end

return path
end

---Verify that a given git rev is valid.
Expand Down