From 02346e20adcb6296e5df53ee9a4169886eaca9d3 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Wed, 2 Oct 2024 01:54:38 -0700 Subject: [PATCH 1/3] fix: remove .git extension when checking for remote existence --- src/Git.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Git.cmake b/src/Git.cmake index a73e12ad..a51815af 100644 --- a/src/Git.cmake +++ b/src/Git.cmake @@ -319,13 +319,16 @@ function(git_add_remote) find_program(GIT_EXECUTABLE "git" REQUIRED) - # ensure that the given repository's remote is the current remote + # Get the list of the remotes execute_process( COMMAND "${GIT_EXECUTABLE}" "remote" "-v" WORKING_DIRECTORY "${_fun_REPOSITORY_PATH}" COMMAND_ERROR_IS_FATAL LAST OUTPUT_VARIABLE _remote_output ) - string(FIND "${_remote_output}" "${_fun_REMOTE_URL}" _find_index) + # Remove .git from the URL + string(REGEX REPLACE "^(.*)\.git$" "\\1" _fun_REMOTE_URL_no_git "${_fun_REMOTE_URL}") + # Check if the given remote already exists in the remote list + string(FIND "${_remote_output}" "${_fun_REMOTE_URL_no_git}" _find_index) # Add the given remote if it doesn't exist if(${_find_index} EQUAL -1) From e8d99259cea22db71352aa730b436e5ba7aeeb91 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Wed, 2 Oct 2024 13:28:02 -0700 Subject: [PATCH 2/3] fix: update vcpkg rev --- README.md | 2 +- docs/src/project_options_example.md | 2 +- src/Vcpkg.cmake | 2 +- tests/install/vcpkg.json | 2 +- tests/myproj/CMakeLists.txt | 2 +- tests/myproj/vcpkg.json | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a9d62bda..de97bdf8 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ include(${_project_options_SOURCE_DIR}/Index.cmake) # install vcpkg dependencies: - should be called before defining project() run_vcpkg( VCPKG_URL "https://github.com/microsoft/vcpkg.git" - VCPKG_REV "10e052511428d6b0c7fcc63a139e8024bb146032" + VCPKG_REV "86a181505ac6460f98496a79abdee6a0f49905ec" ) # Install conan dependencies: - should be called before defining project() run_conan() diff --git a/docs/src/project_options_example.md b/docs/src/project_options_example.md index 72483b99..1788d440 100644 --- a/docs/src/project_options_example.md +++ b/docs/src/project_options_example.md @@ -30,7 +30,7 @@ include(${_project_options_SOURCE_DIR}/Index.cmake) # install vcpkg dependencies: - should be called before defining project() run_vcpkg( VCPKG_URL "https://github.com/microsoft/vcpkg.git" - VCPKG_REV "10e052511428d6b0c7fcc63a139e8024bb146032" + VCPKG_REV "86a181505ac6460f98496a79abdee6a0f49905ec" ) # Install conan dependencies: - should be called before defining project() run_conan() diff --git a/src/Vcpkg.cmake b/src/Vcpkg.cmake index 750f97b2..2cbb8984 100644 --- a/src/Vcpkg.cmake +++ b/src/Vcpkg.cmake @@ -170,7 +170,7 @@ Or by specifying the options run_vcpkg( VCPKG_URL "https://github.com/microsoft/vcpkg.git" - VCPKG_REV "10e052511428d6b0c7fcc63a139e8024bb146032" + VCPKG_REV "86a181505ac6460f98496a79abdee6a0f49905ec" ENABLE_VCPKG_UPDATE ) diff --git a/tests/install/vcpkg.json b/tests/install/vcpkg.json index c682f737..a38c3b13 100644 --- a/tests/install/vcpkg.json +++ b/tests/install/vcpkg.json @@ -2,7 +2,7 @@ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "another-project", "version-string": "0.1.0", - "builtin-baseline": "10e052511428d6b0c7fcc63a139e8024bb146032", + "builtin-baseline": "86a181505ac6460f98496a79abdee6a0f49905ec", "dependencies": [ { "name": "eigen3", diff --git a/tests/myproj/CMakeLists.txt b/tests/myproj/CMakeLists.txt index 5fb5a780..041c5456 100644 --- a/tests/myproj/CMakeLists.txt +++ b/tests/myproj/CMakeLists.txt @@ -18,7 +18,7 @@ if(ENABLE_CROSS_COMPILING) endif() run_vcpkg(VCPKG_URL "https://github.com/microsoft/vcpkg.git" VCPKG_REV - "10e052511428d6b0c7fcc63a139e8024bb146032" ENABLE_VCPKG_UPDATE + "86a181505ac6460f98496a79abdee6a0f49905ec" ENABLE_VCPKG_UPDATE ) run_conan() diff --git a/tests/myproj/vcpkg.json b/tests/myproj/vcpkg.json index c4cbbf8c..cb7a84b8 100644 --- a/tests/myproj/vcpkg.json +++ b/tests/myproj/vcpkg.json @@ -2,7 +2,7 @@ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "myproject", "version-string": "0.1.0", - "builtin-baseline": "10e052511428d6b0c7fcc63a139e8024bb146032", + "builtin-baseline": "86a181505ac6460f98496a79abdee6a0f49905ec", "dependencies": [ { "name": "eigen3", From 67d723aa9257b99c047089d5e05f135925753bf0 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Wed, 2 Oct 2024 13:58:53 -0700 Subject: [PATCH 3/3] fix: fetch git remote add in one go + non-fatal errors --- src/Git.cmake | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Git.cmake b/src/Git.cmake index a51815af..e3a19f7f 100644 --- a/src/Git.cmake +++ b/src/Git.cmake @@ -346,12 +346,8 @@ function(git_add_remote) endif() execute_process( - COMMAND "${GIT_EXECUTABLE}" "remote" "add" "${_fun_REMOTE_NAME}" "${_fun_REMOTE_URL}" - WORKING_DIRECTORY "${_fun_REPOSITORY_PATH}" COMMAND_ERROR_IS_FATAL LAST - ) - execute_process( - COMMAND "${GIT_EXECUTABLE}" "fetch" "${_fun_REMOTE_NAME}" WORKING_DIRECTORY "${_fun_REPOSITORY_PATH}" - COMMAND_ERROR_IS_FATAL LAST + COMMAND "${GIT_EXECUTABLE}" "remote" "add" "--fetch" "${_fun_REMOTE_NAME}" "${_fun_REMOTE_URL}" + WORKING_DIRECTORY "${_fun_REPOSITORY_PATH}" ) endif() endfunction()