fix(#2467): remove newline in git paths when using cygwin_support (#2478)

* fix(#2467): remove newline in git paths

* fix: info size suffix and formatting (#2492)

- Now there is a whitespace between value and unit.
- Now values >= 1024 YiB are shown in YiB instead of B.
- To reuse same code a new local function was added: round().

* feat(#2312): fire `TextYankPost` event on path copy (#2489)

* feat(#2312): fire `TextYankPost` event on path copy

* stylua

* Bug fix

---------

Co-authored-by: Alexander Courtis <alex@courtis.org>

* feat: mapping and options to sort entries in help window (#2482)

* feat: add option to sort entries in help window

* stylua

* Add keymap to toggle sorting methods

* Bug fix

---------

Co-authored-by: Alexander Courtis <alex@courtis.org>

* fix(#2467): remove newline in git paths

* fix(#2467): change cygpath calls to array format
To avoid shell compatibility issues in msys2 environment on Windows

* stylua nit

---------

Co-authored-by: Alexander Courtis <alex@courtis.org>
Co-authored-by: Andrew Voynov <37143421+Andrew15-5@users.noreply.github.com>
Co-authored-by: Azad <49314270+Akmadan23@users.noreply.github.com>
This commit is contained in:
rei 2023-10-30 08:39:32 +08:00 committed by GitHub
parent 78a9ca5ed6
commit 7c5c074354
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,15 +36,20 @@ function M.get_toplevel(cwd)
-- git always returns path with forward slashes
if vim.fn.has "win32" == 1 then
-- msys2 git support
-- cygpath calls must in array format to avoid shell compatibility issues
if M.use_cygpath then
toplevel = vim.fn.system("cygpath -w " .. vim.fn.shellescape(toplevel))
toplevel = vim.fn.system { "cygpath", "-w", toplevel }
if vim.v.shell_error ~= 0 then
return nil, nil
end
git_dir = vim.fn.system("cygpath -w " .. vim.fn.shellescape(git_dir))
-- remove trailing newline(\n) character added by vim.fn.system
toplevel = toplevel:gsub("\n", "")
git_dir = vim.fn.system { "cygpath", "-w", git_dir }
if vim.v.shell_error ~= 0 then
return nil, nil
end
-- remove trailing newline(\n) character added by vim.fn.system
git_dir = git_dir:gsub("\n", "")
end
toplevel = toplevel:gsub("/", "\\")
git_dir = git_dir:gsub("/", "\\")