File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -143,9 +143,23 @@ function(apply_patches repo_dir patches_dirs base_revision target_branch)
143143 execute_process ( # Apply the patch
144144 COMMAND ${GIT_EXECUTABLE} am --3way --keep-non-patch --ignore-whitespace -C0 ${patch}
145145 WORKING_DIRECTORY ${repo_dir}
146+ RESULT_VARIABLE ret_apply_patch
146147 OUTPUT_VARIABLE patching_log
148+ ERROR_VARIABLE patching_err
147149 )
148- message (STATUS "[OPENCL-CLANG] Not present - ${patching_log} " )
150+ message (STATUS "[OPENCL-CLANG] Applying ${patch} \n ${patching_log} " )
151+ if (ret_apply_patch)
152+ execute_process ( # Abort the half-applied am so the repo is left in a sane state
153+ COMMAND ${GIT_EXECUTABLE} am --abort
154+ WORKING_DIRECTORY ${repo_dir}
155+ OUTPUT_QUIET ERROR_QUIET
156+ )
157+ message (FATAL_ERROR
158+ "[OPENCL-CLANG] Failed to apply patch ${patch} \n "
159+ "git am exit code: ${ret_apply_patch} \n "
160+ "stdout:\n ${patching_log} \n "
161+ "stderr:\n ${patching_err} " )
162+ endif ()
149163 endif ()
150164 endforeach (patch )
151165 elseif (patches_needed EQUAL 0) # The target branch already exists
You can’t perform that action at this time.
0 commit comments