diff mbox

[PATCHv2] apply-and-build.sh: fixing cover-letter issue

Message ID 1432897106-12266-1-git-send-email-christophe.milard@linaro.org
State New
Headers show

Commit Message

Christophe Milard May 29, 2015, 10:58 a.m. UTC
When an empty patch (such as a cover letter) was given to
apply-and-build, the latter would fail applying the patch and all
following patches (saying OK when it could be wrong)

Signed-off-by: Christophe Milard <christophe.milard@linaro.org>
---
 apply-and-build.sh | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Anders Roxell June 1, 2015, 9:25 a.m. UTC | #1
On 2015-05-29 12:58, Christophe Milard wrote:
> When an empty patch (such as a cover letter) was given to
> apply-and-build, the latter would fail applying the patch and all
> following patches (saying OK when it could be wrong)
> 
> Signed-off-by: Christophe Milard <christophe.milard@linaro.org>
> ---
>  apply-and-build.sh | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/apply-and-build.sh b/apply-and-build.sh
> index 7195f40..d4cc0d9 100755
> --- a/apply-and-build.sh
> +++ b/apply-and-build.sh
> @@ -147,18 +147,16 @@ apply_patch() {
>  
>      echo "  Trying to apply patch"
>      git am ${patch} >> ${logfile_basename}-am.log 2>&1
> -    egrep "^Patch failed at" ${logfile_basename}-am.log > /dev/null
> -    if [ $? -eq 0 ]; then
> +    if [ $? -ne 0 ]; then
>          cat ${logfile_basename}-am.log
> -        git am --abort || exit 1
> +        git am --abort
>          git checkout . || exit 1
>          git clean -xdf || exit 1
>          git am --3way ${patch} >> ${logfile_basename}-am-3way.log 2>&1
> -        egrep "^Patch failed at" ${logfile_basename}-am-3way.log > /dev/null
> -        if [ $? -eq 0 ]; then
> +        if [ $? -ne 0 ]; then
>              cat ${logfile_basename}-am-3way.log
>              echo "  Error: Patch failed to apply"
> -            git am --abort || exit 1
> +            git am --abort
>              git checkout . || exit 1
>              git clean -xdf || exit 1
>              popd > /dev/null
> -- 
> 1.9.1
> 

Applied.

Cheers,
Anders
diff mbox

Patch

diff --git a/apply-and-build.sh b/apply-and-build.sh
index 7195f40..d4cc0d9 100755
--- a/apply-and-build.sh
+++ b/apply-and-build.sh
@@ -147,18 +147,16 @@  apply_patch() {
 
     echo "  Trying to apply patch"
     git am ${patch} >> ${logfile_basename}-am.log 2>&1
-    egrep "^Patch failed at" ${logfile_basename}-am.log > /dev/null
-    if [ $? -eq 0 ]; then
+    if [ $? -ne 0 ]; then
         cat ${logfile_basename}-am.log
-        git am --abort || exit 1
+        git am --abort
         git checkout . || exit 1
         git clean -xdf || exit 1
         git am --3way ${patch} >> ${logfile_basename}-am-3way.log 2>&1
-        egrep "^Patch failed at" ${logfile_basename}-am-3way.log > /dev/null
-        if [ $? -eq 0 ]; then
+        if [ $? -ne 0 ]; then
             cat ${logfile_basename}-am-3way.log
             echo "  Error: Patch failed to apply"
-            git am --abort || exit 1
+            git am --abort
             git checkout . || exit 1
             git clean -xdf || exit 1
             popd > /dev/null