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

Artem Bityutskiy dedekind1 at gmail.com
Fri Feb 7 00:50:33 PST 2014


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
 }
-- 
1.8.5.2




More information about the aiaiai mailing list