From 2b351b2fc33cf6e5642fbd1f47984189374fe0e4 Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Wed, 27 Mar 2019 22:06:38 -0400 Subject: libs/git: Fail if patching fails The recursive call in git_project_patch_recursive() is now performed last so that if a patching attempt fails, the calling functions won't attempt to apply more patches. The consequence of this change is that patches are applied in (nearly) opposite order from before. git_project_prepare_patch() is now called after git_project_prepare_blobs() so that if patching fails and the user chooses to perform additional project actions anyway, such as building, the project is already deblobbed and not a risk to their freedom. I had mistakenly reordered these function calls in a prior commit. --- libs/git | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'libs/git') diff --git a/libs/git b/libs/git index fa4434f7..a83f2246 100755 --- a/libs/git +++ b/libs/git @@ -271,16 +271,16 @@ git_project_patch_recursive() { local patches_path=$project_path/$PATCHES/$path if ! [[ -d $project_path/$PATCHES ]]; then - return + return 0 fi + for patch in "$patches_path"/[!.]*.@(patch|diff); do + git_patch "$repository_path" "$branch" "$patch" || return 1 + done + if [[ $path != . ]]; then git_project_patch_recursive "$project" "$repository" "$branch" "$(dirname "$path")" fi - - for patch in "$patches_path"/[!.]*.@(patch|diff); do - git_patch "$repository_path" "$branch" "$patch" - done } git_project_clone() { @@ -316,8 +316,8 @@ git_project_prepare() { shift git_project_prepare_revision "$project" "$repository" "$@" - git_project_prepare_patch "$project" "$repository" "$@" git_project_prepare_blobs "$project" "$repository" "$@" + git_project_prepare_patch "$project" "$repository" "$@" } git_project_prepare_blobs() { -- cgit v1.2.3-70-g09d2