Skip to content

Commit 332c1bf

Browse files
authored
Fix ApplyPatch Mechanism (#364)
This ports #358 Pass option -C0 which ignores the surrounding context of the changes. Also remove ERROR_QUIET flag which makes debugging harder. Signed-off-by: haonanya <[email protected]>
1 parent 8c2aaa2 commit 332c1bf

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

cmake/modules/CMakeFunctions.cmake

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ function(is_backport_patch_present patch_path repo_dir patch_in_branch)
5757
WORKING_DIRECTORY ${repo_dir}
5858
RESULT_VARIABLE patch_not_in_branches
5959
OUTPUT_QUIET
60-
ERROR_QUIET
6160
)
6261
if(patch_not_in_branches)
6362
set(patch_in_branch False PARENT_SCOPE) # The patch is not present in local branch
@@ -74,7 +73,6 @@ function(is_valid_revision repo_dir revision return_val)
7473
COMMAND ${GIT_EXECUTABLE} log -1 ${revision}
7574
WORKING_DIRECTORY ${repo_dir}
7675
RESULT_VARIABLE output_var
77-
ERROR_QUIET
7876
OUTPUT_QUIET
7977
)
8078
if(${output_var} EQUAL 0)
@@ -105,7 +103,6 @@ function(apply_patches repo_dir patches_dir base_revision target_branch ret)
105103
COMMAND ${GIT_EXECUTABLE} rev-parse --verify --no-revs -q ${target_branch}
106104
WORKING_DIRECTORY ${repo_dir}
107105
RESULT_VARIABLE patches_needed
108-
ERROR_QUIET
109106
OUTPUT_QUIET
110107
)
111108
if(patches_needed EQUAL 128) # not a git repo
@@ -120,7 +117,6 @@ function(apply_patches repo_dir patches_dir base_revision target_branch ret)
120117
WORKING_DIRECTORY ${repo_dir}
121118
OUTPUT_VARIABLE repo_head
122119
OUTPUT_STRIP_TRAILING_WHITESPACE
123-
ERROR_QUIET
124120
)
125121
message(STATUS "[OPENCL-CLANG] ref ${base_revision} not exists in repository, using current HEAD:${repo_head}")
126122
set(base_revision ${repo_head})
@@ -140,10 +136,9 @@ function(apply_patches repo_dir patches_dir base_revision target_branch ret)
140136
message(STATUS "[OPENCL-CLANG] Patch ${patch} is already in local branch - ignore patching")
141137
else()
142138
execute_process( # Apply the patch
143-
COMMAND ${GIT_EXECUTABLE} am --3way --ignore-whitespace ${patch}
139+
COMMAND ${GIT_EXECUTABLE} am --3way --ignore-whitespace -C0 ${patch}
144140
WORKING_DIRECTORY ${repo_dir}
145141
OUTPUT_VARIABLE patching_log
146-
ERROR_QUIET
147142
RESULT_VARIABLE ret_apply_patch
148143
)
149144
message(STATUS "[OPENCL-CLANG] Not present - ${patching_log}")
@@ -156,7 +151,6 @@ function(apply_patches repo_dir patches_dir base_revision target_branch ret)
156151
execute_process( # Check it out
157152
COMMAND ${GIT_EXECUTABLE} checkout ${target_branch}
158153
WORKING_DIRECTORY ${repo_dir}
159-
ERROR_QUIET
160154
OUTPUT_QUIET
161155
RESULT_VARIABLE ret_check_out
162156
)

0 commit comments

Comments
 (0)