aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Robbins <contact@andrewrobbins.info>2019-07-16 22:38:34 -0500
committerAndrew Robbins <contact@andrewrobbins.info>2019-07-16 22:45:17 -0500
commit089265a306c58b52a0f90dde99b7cc6af3f25e11 (patch)
treecdeedf2cd333fa57756e55526155cb6a3695613a
parent33ddc979ce4e2247744be0979890238b6b90864c (diff)
downloadlibrebootfr-089265a306c58b52a0f90dde99b7cc6af3f25e11.tar.gz
librebootfr-089265a306c58b52a0f90dde99b7cc6af3f25e11.zip
Avoid redundant patching when recursively patching
If a path is not supplied to project_sources_patch_recursive() or git_project_patch_recursive() then it will attempt to apply the set of patches located at $PROJECTS/$project/$PATCHES (the top-level patches directory) twice. Checking to see if $path is of non-zero length avoids this issue.
-rwxr-xr-xlibs/git2
-rwxr-xr-xlibs/project2
2 files changed, 2 insertions, 2 deletions
diff --git a/libs/git b/libs/git
index 429d4783..2cde3dd3 100755
--- a/libs/git
+++ b/libs/git
@@ -312,7 +312,7 @@ git_project_patch_recursive() {
git_patch "$repository_path" "$branch" "$patch" || return 1
done
- if [[ $path != . ]]; then
+ if [[ -n $path && $path != . ]]; then
git_project_patch_recursive "$project" "$repository" "$branch" "$(dirname "$path")"
fi
}
diff --git a/libs/project b/libs/project
index 908f8942..34b139a5 100755
--- a/libs/project
+++ b/libs/project
@@ -587,7 +587,7 @@ project_sources_patch_recursive() {
diff_patch "$sources_path" "$patch" || return 1
done
- if [[ $path != . ]]; then
+ if [[ -n $path && $path != . ]]; then
project_sources_patch_recursive "$project" "$(dirname "$path")"
fi
}