Skip to content

Commit 8690d7a

Browse files
Copilotlewis6991
andauthored
fix: cygpath output handling for MSYS2 environments (#1463)
Co-authored-by: lewis6991 <7904185+lewis6991@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent d6482eb commit 8690d7a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lua/gitsigns/util.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,13 @@ function M.cygpath(path, mode)
440440

441441
async.schedule()
442442

443-
return assert(vim.split(stdout, '\n')[1])
443+
local result = vim.split(stdout, '\n')[1]
444+
-- Strip trailing newline/carriage return that may be present in cygpath output on MSYS2
445+
if result then
446+
result = result:match('^(.-)[\r\n]*$')
447+
end
448+
449+
return assert(result)
444450
end
445451

446452
--- Flattens a nested table structure into a flat array of strings. Only

0 commit comments

Comments
 (0)