[PATCH 04/16] email-lda: improve the debugging output a bit

Keller, Jacob E jacob.e.keller at intel.com
Thu Feb 6 13:20:36 PST 2014


On Thu, 2014-02-06 at 18:30 +0200, Artem Bityutskiy wrote:
> From: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
> 
> Improve the 'series_is_complete()' function's debugging output a bit.
> 
> Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
> ---
>  email/aiaiai-email-lda | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/email/aiaiai-email-lda b/email/aiaiai-email-lda
> index f00c718..e91f1c5 100755
> --- a/email/aiaiai-email-lda
> +++ b/email/aiaiai-email-lda
> @@ -159,18 +159,24 @@ series_is_complete()
>  	local n="$1" ; shift
>  
>  	# First check if we have all the non-cover patches yet
> -	if [ "$(ls -1 --ignore=0 -- "$dir" | wc -l)" -eq "$n" ]; then
> +	local cnt="$(ls -1 --ignore=0 -- "$dir" | wc -l)"
> +	if [ "$cnt" -eq "$n" ]; then
>  		local first_parent="$(fetch_header "In-Reply-To" < "$dir/1")"
> -		if [ -n "$first_parent" ] && ! [ -f "$dir/0" ]; then
> -			# Series is not complete, we are missing the cover
> -			# letter
> -			return 1
> +		if [ -n "$first_parent" ]; then
> +			# The first patch has a parent, must be the cover letter
> +			if [ -f "$dir/0" ]; then
> +				message "Series in $dir is complete and has cover letter"
> +				return 0
> +			else
> +				message "Series in $dir is not complete, we are missing the cover letter"
> +				return 1
> +			fi
>  		else
> -			# Series is complete, no cover letter was sent
> +			message "Series is in $dir complete no cover letter was sent"
>  			return 0
>  		fi
>  	else
> -		# Don't have all the patches yet
> +		message "Series in $dir is not complete, we have only $cnt out of $n patches"
>  		return 1
>  	fi
>  }

Good idea!

Regards,
Jake


More information about the aiaiai mailing list