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

Do not apply patches if repo is a not a git repo. #539

Merged
merged 3 commits into from
Jul 3, 2024
Merged
Changes from 2 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
11 changes: 7 additions & 4 deletions cmake/modules/CMakeFunctions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,11 @@ function(apply_patches repo_dir patches_dir base_revision target_branch ret)
OUTPUT_QUIET
)
if(patches_needed EQUAL 128) # not a git repo
set(ret_not_git_repo 1)
elseif(patches_needed) # The target branch doesn't exist
set(${ret} True PARENT_SCOPE)
message(STATUS "[OPENCL-CLANG] ${repo_dir} is not a git repository")
haonanya marked this conversation as resolved.
Show resolved Hide resolved
return()
endif()
if(patches_needed EQUAL 1) # The target branch doesn't exist
list(SORT patches)
is_valid_revision(${repo_dir} ${base_revision} exists_base_rev)

Expand Down Expand Up @@ -147,15 +150,15 @@ function(apply_patches repo_dir patches_dir base_revision target_branch ret)
endif()
endif()
endforeach(patch)
else() # The target branch already exists
elseif(patches_needed EQUAL 0) # The target branch already exists
execute_process( # Check it out
COMMAND ${GIT_EXECUTABLE} checkout ${target_branch}
WORKING_DIRECTORY ${repo_dir}
OUTPUT_QUIET
RESULT_VARIABLE ret_check_out
)
endif()
if (NOT (ret_not_git_repo OR ret_check_out OR ret_apply_patch))
if (NOT (ret_check_out OR ret_apply_patch))
set(${ret} True PARENT_SCOPE)
else()
message(FATAL_ERROR "[OPENCL-CLANG] Failed to apply patch!")
Expand Down
Loading