Open
Show file tree
Hide file tree
Changes from all commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Failed to load files.
Original file line numberDiff line numberDiff 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
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,6 +25,24 @@ local logger = DiffviewGlobal.logger
local pl = lazy.access(utils, "path") ---@type PathLib
local uv = vim.loop

local has_cygpath
local function normalize_cygwin_path(path)
if path and vim.fn.has('win32') == 1 and string.sub(path, 1, 1) == '/' then
if has_cygpath == nil then
has_cygpath = vim.fn.executable('cygpath') == 1
end

if has_cygpath then
path = vim.fn.system({"cygpath", "--absolute", "--windows", path})

-- remove "\n"
path = string.sub(path, 1, #path -1)
end
end

return path
end

local M = {}

---@class GitAdapter : VCSAdapter
Expand DownExpand Up@@ -177,7 +195,8 @@ local function get_toplevel(path)
if code ~= 0 then
return nil
end
return out[1] and vim.trim(out[1])

return normalize_cygwin_path(out[1])
end

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

return normalize_cygwin_path(out[1])
end

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