Skip to content

Commit e03e0e3

Browse files
haonanya1wenju-he
andauthored
Do not apply patches if repo is a not a git repo. (#539)
Co-authored-by: Wenju He <[email protected]>
1 parent 66a54cb commit e03e0e3

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

cmake/modules/CMakeFunctions.cmake

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,11 @@ function(apply_patches repo_dir patches_dir base_revision target_branch ret)
106106
OUTPUT_QUIET
107107
)
108108
if(patches_needed EQUAL 128) # not a git repo
109-
set(ret_not_git_repo 1)
110-
elseif(patches_needed) # The target branch doesn't exist
109+
set(${ret} True PARENT_SCOPE)
110+
message(STATUS "[OPENCL-CLANG][Warning] ${repo_dir} is not a git repository, therefore, local patches are not applied")
111+
return()
112+
endif()
113+
if(patches_needed EQUAL 1) # The target branch doesn't exist
111114
list(SORT patches)
112115
is_valid_revision(${repo_dir} ${base_revision} exists_base_rev)
113116

@@ -147,15 +150,15 @@ function(apply_patches repo_dir patches_dir base_revision target_branch ret)
147150
endif()
148151
endif()
149152
endforeach(patch)
150-
else() # The target branch already exists
153+
elseif(patches_needed EQUAL 0) # The target branch already exists
151154
execute_process( # Check it out
152155
COMMAND ${GIT_EXECUTABLE} checkout ${target_branch}
153156
WORKING_DIRECTORY ${repo_dir}
154157
OUTPUT_QUIET
155158
RESULT_VARIABLE ret_check_out
156159
)
157160
endif()
158-
if (NOT (ret_not_git_repo OR ret_check_out OR ret_apply_patch))
161+
if (NOT (ret_check_out OR ret_apply_patch))
159162
set(${ret} True PARENT_SCOPE)
160163
else()
161164
message(FATAL_ERROR "[OPENCL-CLANG] Failed to apply patch!")

0 commit comments

Comments
 (0)