aboutsummaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rwxr-xr-xlibs/git34
1 files changed, 33 insertions, 1 deletions
diff --git a/libs/git b/libs/git
index 998ceae7..358d5d1f 100755
--- a/libs/git
+++ b/libs/git
@@ -169,6 +169,37 @@ git_commit() {
)
}
+git_apply() {
+ local repository_path=$1
+ local branch=$2
+ local patch=$3
+
+ (
+ export GIT_COMMITTER_NAME=$GIT_NAME
+ export GIT_COMMITTER_EMAIL=$GIT_EMAIL
+
+ cd "$repository_path"
+ git checkout "$branch" >/dev/null 2>&1
+
+ if git_apply_check "$repository_path" "$branch" "$patch"; then
+ git apply --index "$patch"
+ fi
+ )
+}
+
+git_apply_check() {
+ local repository_path=$1
+ local branch=$2
+ local patch=$3
+
+ (
+ cd "$repository_path"
+ git checkout "$branch" >/dev/null 2>&1
+
+ git apply --check "$patch"
+ )
+}
+
git_patch() {
local repository_path=$1
local branch=$2
@@ -249,7 +280,8 @@ git_project_patch_recursive() {
if [[ ${patch##*.} == patch ]]; then
git_patch "$repository_path" "$branch" "$patch"
else
- diff_patch "$repository_path" "$patch"
+ git_apply "$repository_path" "$branch" "$patch"
+ git_commit "$repository_path" "Applied ${patch##*/}"
fi
done
}