From dafda3033bd7b663e150393a8f75e4a0a8e12e27 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Wed, 5 Feb 2014 14:45:46 +0200 Subject: [PATCH] email-test-patchset: minor re-structuring 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 --- 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")" -- 2.50.1