Skip to content

Commit 6d2cd2c

Browse files
authored
Fix ApplyPatch Mechanism (#363)
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 548a6a7 commit 6d2cd2c

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)
@@ -102,7 +100,6 @@ function(apply_patches repo_dir patches_dir base_revision target_branch)
102100
COMMAND ${GIT_EXECUTABLE} rev-parse --verify --no-revs -q ${target_branch}
103101
WORKING_DIRECTORY ${repo_dir}
104102
RESULT_VARIABLE patches_needed
105-
ERROR_QUIET
106103
OUTPUT_QUIET
107104
)
108105
if(patches_needed) # The target branch doesn't exist
@@ -115,7 +112,6 @@ function(apply_patches repo_dir patches_dir base_revision target_branch)
115112
WORKING_DIRECTORY ${repo_dir}
116113
OUTPUT_VARIABLE repo_head
117114
OUTPUT_STRIP_TRAILING_WHITESPACE
118-
ERROR_QUIET
119115
)
120116
message(STATUS "[OPENCL-CLANG] ref ${base_revision} not exists in repository, using current HEAD:${repo_head}")
121117
set(base_revision ${repo_head})
@@ -135,10 +131,9 @@ function(apply_patches repo_dir patches_dir base_revision target_branch)
135131
message(STATUS "[OPENCL-CLANG] Patch ${patch} is already in local branch - ignore patching")
136132
else()
137133
execute_process( # Apply the patch
138-
COMMAND ${GIT_EXECUTABLE} am --3way --ignore-whitespace ${patch}
134+
COMMAND ${GIT_EXECUTABLE} am --3way --ignore-whitespace -C0 ${patch}
139135
WORKING_DIRECTORY ${repo_dir}
140136
OUTPUT_VARIABLE patching_log
141-
ERROR_QUIET
142137
)
143138
message(STATUS "[OPENCL-CLANG] Not present - ${patching_log}")
144139
endif()
@@ -147,7 +142,6 @@ function(apply_patches repo_dir patches_dir base_revision target_branch)
147142
execute_process( # Check it out
148143
COMMAND ${GIT_EXECUTABLE} checkout ${target_branch}
149144
WORKING_DIRECTORY ${repo_dir}
150-
ERROR_QUIET
151145
OUTPUT_QUIET
152146
)
153147
endif()

0 commit comments

Comments
 (0)