aboutsummaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorAndrew Robbins <contact@andrewrobbins.info>2019-03-28 11:00:28 -0400
committerAndrew Robbins <contact@andrewrobbins.info>2019-03-28 11:00:28 -0400
commitac462c0df361e067698f04111bad078fa7d1e1b8 (patch)
tree4ea0277dab73594b46450d6a607b2703cdb447b0 /libs
parente681d7cd9679244fe7f43ce9e66b8cf83f706d8a (diff)
downloadlibrebootfr-ac462c0df361e067698f04111bad078fa7d1e1b8.tar.gz
librebootfr-ac462c0df361e067698f04111bad078fa7d1e1b8.zip
libs/git: Remove check from git_am() and git_apply()
Having a specific function for checking whether a patch would apply isn't that useful if git_am and git_apply call it internally anyway.
Diffstat (limited to 'libs')
-rwxr-xr-xlibs/git14
1 files changed, 8 insertions, 6 deletions
diff --git a/libs/git b/libs/git
index 6fbd2302..4e62873d 100755
--- a/libs/git
+++ b/libs/git
@@ -186,8 +186,10 @@ git_am() {
cd "$repository_path"
git checkout "$branch" >/dev/null 2>&1
- if git_apply_check "$repository_path" "$branch" "$patch"; then
- git am "$patch" || git am --abort
+ if ! git am "$patch"; then
+ git am --abort
+
+ exit 1
fi
)
}
@@ -201,9 +203,7 @@ git_apply() {
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 --index "$patch"
)
}
@@ -225,12 +225,14 @@ git_patch() {
local branch=$2
local patch=$3
+ git_apply_check "$repository_path" "$branch" "$patch" || return 1
+
case $patch in
*.patch)
git_am "$repository_path" "$branch" "$patch"
;;
*.diff)
- git_apply "$repository_path" "$branch" "$patch" &&
+ git_apply "$repository_path" "$branch" "$patch"
git_commit "$repository_path" "Applied ${patch##*/}"
;;
*)