Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Vim scripts loaded on Unix systems, when git config --global core.autocrlf, fail to load #1055

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,11 @@ return {
-- then set the below to false. This should work, but is NOT supported and will
-- increase downloads a lot.
filter = true,
-- If git config --global core.autocrlf is true on a Unix/Linux system, then the git clone process
-- will give files with CRLF endings. Vi / vim / neovim cannot handle this when loading .vim scripts.
-- When true, Lazy will force git to clone with core.autocrlf=false. When false, Lazy will not
-- touch the core.autocrlf setting.
override_autocrlf = true,
},
dev = {
-- directory where you store your local plugin projects
Expand Down
5 changes: 5 additions & 0 deletions lua/lazy/core/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ M.defaults = {
-- then set the below to false. This should work, but is NOT supported and will
-- increase downloads a lot.
filter = true,
-- If git config --global core.autocrlf is true on a Unix/Linux system, then the git clone
-- process will lead to files with CRLF endings. Vi / vim / neovim cannot handle this.
-- When true, Lazy will force git to clone with core.autocrlf=false. When false, Lazy will
-- not touch the core.autocrlf setting.
override_autocrlf = true,
},
dev = {
-- directory where you store your local plugin projects
Expand Down
5 changes: 5 additions & 0 deletions lua/lazy/manage/task/git.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ M.clone = {
args[#args + 1] = "--filter=blob:none"
end

if Config.options.git.override_autocrlf == true then
args[#args + 1] = "-c"
args[#args + 1] = "core.autocrlf=false"
end

if self.plugin.submodules ~= false then
args[#args + 1] = "--recurse-submodules"
end
Expand Down