aboutsummaryrefslogtreecommitdiff
path: root/test/test-lib.sh
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2017-09-01 20:59:47 -0300
committerDavid Bremner <david@tethera.net>2017-09-03 08:06:15 -0300
commitec37900c5f0316e1f7345fe413402e6dc8bb9547 (patch)
tree2bff1c8d3a2fff88adde6c6645c3ae00b1c550ae /test/test-lib.sh
parent46bda291ba6b73266f6e48a539af7772a4d09edf (diff)
test/crypto: remove headers more robustly
In [1], Vladimir Panteleev observed that the In-Reply-To and References headers could be wrapped in the 'default' output format of notmuch-reply, depending on the version of Emacs creating the message. In my own experiments notmuch-reply sometimes wraps headers with only one message-id if that message-id is long enough. However it happens, this causes the previous approach using grep to fail. Since I found the proposed unwrapping shell fragment in [1] a bit hard to follow, I decided to write a little python script instead. Then Tomi suggested a slight generalization of my script, and here we are. [1] id:20170817175145.3204-7-notmuch@thecybershadow.net
Diffstat (limited to 'test/test-lib.sh')
-rw-r--r--test/test-lib.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/test-lib.sh b/test/test-lib.sh
index d2b2a47f..09ee815d 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -507,6 +507,16 @@ NOTMUCH_DUMP_TAGS ()
notmuch dump --include=tags "${@}" | sed '/^#/d' | sort
}
+notmuch_drop_mail_headers ()
+{
+ $NOTMUCH_PYTHON -c "
+import email,sys
+msg=email.message_from_file(sys.stdin)
+for hdr in sys.argv[1:]: del msg[hdr]
+print(msg.as_string(False))
+" $*
+}
+
notmuch_search_sanitize ()
{
perl -pe 's/("?thread"?: ?)("?)................("?)/\1\2XXX\3/'