From ac462c0df361e067698f04111bad078fa7d1e1b8 Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Thu, 28 Mar 2019 11:00:28 -0400 Subject: 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. --- libs/git | 14 ++++++++------ 1 file 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##*/}" ;; *) -- cgit v1.2.3-70-g09d2