Skip to content

Commit

Permalink
[vcpkg_apply_patches] Work around /etc/gitconfig: Permission denied (#…
Browse files Browse the repository at this point in the history
…14848)

Co-authored-by: Robert Schumacher <[email protected]>
  • Loading branch information
ras0219 and ras0219-msft authored Nov 30, 2020
1 parent 666589a commit 7c08030
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions scripts/cmake/vcpkg_apply_patches.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ function(vcpkg_apply_patches)
cmake_parse_arguments(PARSE_ARGV 0 _ap "QUIET" "SOURCE_PATH" "PATCHES")

find_program(GIT NAMES git git.cmd)
if(DEFINED ENV{GIT_CONFIG_NOSYSTEM})
set(GIT_CONFIG_NOSYSTEM_BACKUP "$ENV{GIT_CONFIG_NOSYSTEM}")
else()
unset(GIT_CONFIG_NOSYSTEM_BACKUP)
endif()
set(ENV{GIT_CONFIG_NOSYSTEM} 1)
set(PATCHNUM 0)
foreach(PATCH ${_ap_PATCHES})
get_filename_component(ABSOLUTE_PATCH "${PATCH}" ABSOLUTE BASE_DIR "${CURRENT_PORT_DIR}")
Expand All @@ -57,4 +63,9 @@ function(vcpkg_apply_patches)

math(EXPR PATCHNUM "${PATCHNUM}+1")
endforeach()
if(DEFINED GIT_CONFIG_NOSYSTEM_BACKUP)
set(ENV{GIT_CONFIG_NOSYSTEM} "${GIT_CONFIG_NOSYSTEM_BACKUP}")
else()
unset(ENV{GIT_CONFIG_NOSYSTEM})
endif()
endfunction()

0 comments on commit 7c08030

Please sign in to comment.