]> www.infradead.org Git - users/dedekind/aiaiai.git/commitdiff
email-lda: improve the debugging output a bit
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Thu, 6 Feb 2014 09:41:48 +0000 (11:41 +0200)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Fri, 7 Feb 2014 08:56:26 +0000 (10:56 +0200)
Improve the 'series_is_complete()' function's debugging output a bit.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
email/aiaiai-email-lda

index f00c718251e2af253bebc4f89ba09499dd983ef7..e91f1c58e1119d778b1a3e51c3f77faef2f9f78b 100755 (executable)
@@ -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
 }