diff options
author | Andrew Robbins <contact@andrewrobbins.info> | 2019-03-28 11:00:28 -0400 |
---|---|---|
committer | Andrew Robbins <contact@andrewrobbins.info> | 2019-03-28 11:00:28 -0400 |
commit | ac462c0df361e067698f04111bad078fa7d1e1b8 (patch) | |
tree | 4ea0277dab73594b46450d6a607b2703cdb447b0 | |
parent | e681d7cd9679244fe7f43ce9e66b8cf83f706d8a (diff) | |
download | librebootfr-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.
-rwxr-xr-x | libs/git | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -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##*/}" ;; *) |