Skip to content

Commit

Permalink
Merge pull request #282 from aminya/add-remote [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya authored Oct 2, 2024
2 parents ca3ecdc + 67d723a commit f6b2b80
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion docs/src/project_options_example.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
15 changes: 7 additions & 8 deletions src/Git.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -343,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()
Expand Down
2 changes: 1 addition & 1 deletion src/Vcpkg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
2 changes: 1 addition & 1 deletion tests/install/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion tests/myproj/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion tests/myproj/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit f6b2b80

Please sign in to comment.