[PATCH 09/15] email-test-patchset: minor re-structuring

Artem Bityutskiy dedekind1 at gmail.com
Wed Feb 5 07:10:38 PST 2014


From: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>

This is another minor clean-up. Let's fetch all the headers we need in one
place. Just for better readability.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
---
 email/aiaiai-email-test-patchset | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/email/aiaiai-email-test-patchset b/email/aiaiai-email-test-patchset
index 040e5d7..dc93150 100755
--- a/email/aiaiai-email-test-patchset
+++ b/email/aiaiai-email-test-patchset
@@ -278,6 +278,13 @@ fi
 fetch_header_or_die subj "Subject" < "$mbox"
 fetch_header_or_die from "From" < "$mbox"
 fetch_header_or_die id "Message-Id" < "$mbox"
+to="$(fetch_header "To" < "$mbox")"
+cc="$(fetch_header "Cc" < "$mbox")"
+
+# Either "To:" or "Cc:" must exist
+if [ -z "$to" ] && [ -z "$cc" ]; then
+       die "Neither \"To:\" nor \"Cc:\" header found"
+fi
 
 printf "\n"
 verbose "Testing mbox: \"$from: $subj (Message-Id: $id)\""
@@ -291,14 +298,6 @@ tmpdir="$(mktemp --tmpdir="$cfg_workdir" -dt "$PROG.XXXX")"
 mv $verbose -- "$mbox" "$tmpdir/mbox" >&2
 mbox="$tmpdir/mbox"
 
-to="$(fetch_header "To" < "$mbox")"
-cc="$(fetch_header "Cc" < "$mbox")"
-
-# Either "To:" or "Cc:" must exist
-if [ -z "$to" ] && [ -z "$cc" ]; then
-       die "Neither \"To:\" nor \"Cc:\" header found"
-fi
-
 # Find out the project name
 prj="$(fetch_project_name "$to" "$cfg_ownmail")"
 
-- 
1.8.5.2




More information about the aiaiai mailing list