23/06/2020 11:29, Ciara Power:
> When all checks are completed on the specified commit logs, the script
> indicates if all are valid, or if there were some failures.
> 
> Signed-off-by: Ciara Power <ciara.po...@intel.com>
> Acked-by: Ferruh Yigit <ferruh.yi...@intel.com>
> 
> ---
> v2: Added appropriate exit codes based on failure status.
> ---
>  devtools/check-git-log.sh | 45 +++++++++++++++++++++++++--------------
>  1 file changed, 29 insertions(+), 16 deletions(-)
> 
> diff --git a/devtools/check-git-log.sh b/devtools/check-git-log.sh
> index e5b430268..86746c4ad 100755
> --- a/devtools/check-git-log.sh
> +++ b/devtools/check-git-log.sh
> -[ -z "$bad" ] || printf "Wrong headline format:\n$bad\n"
> +[ -z "$bad" ] || { printf "Wrong headline format:\n$bad\n" && failure=true;}
[...]
> +total=$(echo "$commits" | wc -l)
> +if [ -n "$failure" ] ; then
> +     printf "\nInvalid patch(es) found - checked $total patch"
> +else
> +     printf "\n$total/$total valid patch"
> +fi
> +[ $total -le 1 ] || printf 'es'
> +printf '\n'
> +[ -n "$failure" ] && exit 1 || exit 0

If $failure is initialized to false, it can be used as a real boolean:

-if [ -n "$failure" ] ; then
+if $failure ; then
        printf "\nInvalid patch(es) found - checked $total patch"
 else
        printf "\n$total/$total valid patch"
 fi
 [ $total -le 1 ] || printf 'es'
 printf '\n'
-[ -n "$failure" ] && exit 1 || exit 0
+$failure && exit 1 || exit 0

I take the liberty of doing this small improvement
without asking for a v5.


Reply via email to