From 0850d508d86492cc254b564d2ba36fdbbadb0f12 Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 23 Mar 2021 15:22:04 +0000 Subject: [PATCH 1/4] Inherit gitattributes from the vcpkg repository when archiving tree Ensures that file endings are consistent between the ports and the versioned port under `versioning`. Fixes https://github.com/microsoft/vcpkg/issues/16615#issuecomment-804928402. Before this fix, a patch with LF endings could end up with CRLF endings on Windows causing corrupt patch issues. --- src/vcpkg/vcpkgpaths.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/vcpkg/vcpkgpaths.cpp b/src/vcpkg/vcpkgpaths.cpp index e2306aa514..d355597159 100644 --- a/src/vcpkg/vcpkgpaths.cpp +++ b/src/vcpkg/vcpkgpaths.cpp @@ -776,6 +776,7 @@ If you wish to silence this error and use classic mode, you can: auto tar_cmd_builder = git_cmd_builder(*this, dot_git_dir, dot_git_dir) .string_arg("archive") .string_arg(git_tree) + .string_arg("--worktree-attributes") .string_arg("-o") .path_arg(destination_tar); const auto tar_output = System::cmd_execute_and_capture_output(tar_cmd_builder); From 8cf3648d60c6da727d0359a73a680b0c0e9f4188 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20El=C3=ADs=20Ebenesersson?= Date: Tue, 23 Mar 2021 22:55:13 +0000 Subject: [PATCH 2/4] Explicitly set core.autocrlf as false Co-authored-by: Robert Schumacher --- src/vcpkg/vcpkgpaths.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vcpkg/vcpkgpaths.cpp b/src/vcpkg/vcpkgpaths.cpp index d355597159..eb952d657b 100644 --- a/src/vcpkg/vcpkgpaths.cpp +++ b/src/vcpkg/vcpkgpaths.cpp @@ -776,7 +776,7 @@ If you wish to silence this error and use classic mode, you can: auto tar_cmd_builder = git_cmd_builder(*this, dot_git_dir, dot_git_dir) .string_arg("archive") .string_arg(git_tree) - .string_arg("--worktree-attributes") + .string_arg("-c").string_arg("core.autocrlf=false") .string_arg("-o") .path_arg(destination_tar); const auto tar_output = System::cmd_execute_and_capture_output(tar_cmd_builder); From 741e73b43374064fedb89a9f900641450efe3682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20El=C3=ADs=20Ebenesersson?= Date: Tue, 23 Mar 2021 23:00:31 +0000 Subject: [PATCH 3/4] fix formatting --- src/vcpkg/vcpkgpaths.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vcpkg/vcpkgpaths.cpp b/src/vcpkg/vcpkgpaths.cpp index eb952d657b..1fee709296 100644 --- a/src/vcpkg/vcpkgpaths.cpp +++ b/src/vcpkg/vcpkgpaths.cpp @@ -776,7 +776,8 @@ If you wish to silence this error and use classic mode, you can: auto tar_cmd_builder = git_cmd_builder(*this, dot_git_dir, dot_git_dir) .string_arg("archive") .string_arg(git_tree) - .string_arg("-c").string_arg("core.autocrlf=false") + .string_arg("-c") + .string_arg("core.autocrlf=false") .string_arg("-o") .path_arg(destination_tar); const auto tar_output = System::cmd_execute_and_capture_output(tar_cmd_builder); From 18c6370da92101a34a1d01cfd3a7bff875d668f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20El=C3=ADs=20Ebenesersson?= Date: Tue, 23 Mar 2021 23:09:07 +0000 Subject: [PATCH 4/4] -c has to be before archive command --- src/vcpkg/vcpkgpaths.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vcpkg/vcpkgpaths.cpp b/src/vcpkg/vcpkgpaths.cpp index 1fee709296..66c98c4dc2 100644 --- a/src/vcpkg/vcpkgpaths.cpp +++ b/src/vcpkg/vcpkgpaths.cpp @@ -774,10 +774,10 @@ If you wish to silence this error and use classic mode, you can: } auto tar_cmd_builder = git_cmd_builder(*this, dot_git_dir, dot_git_dir) - .string_arg("archive") - .string_arg(git_tree) .string_arg("-c") .string_arg("core.autocrlf=false") + .string_arg("archive") + .string_arg(git_tree) .string_arg("-o") .path_arg(destination_tar); const auto tar_output = System::cmd_execute_and_capture_output(tar_cmd_builder);