Pipe the 'patches --diff' output through the pager
[stgit/ydirson.git] / t / t1900-mail.sh
blob6a950b4b67650e0d1fef1cebd161eda919c122e0
1 #!/bin/sh
2 # Copyright (c) 2006 Karl Hasselström
3 test_description='Test the mail command'
4 . ./test-lib.sh
6 test_expect_success \
7 'Initialize the StGIT repository' \
9 for i in 1 2 3 4 5; do
10 touch foo.txt &&
11 echo "line $i" >> foo.txt &&
12 git add foo.txt &&
13 git commit -a -m "Patch $i"
14 done &&
15 stg init &&
16 stg uncommit -n 5 foo
19 test_expect_success \
20 'Put all the patches in an mbox' \
21 'stg mail --to="Inge Ström <inge@example.com>" -a -m \
22 -t ../../templates/patchmail.tmpl > mbox0'
24 test_expect_success \
25 'Import the mbox and compare' \
27 t1=$(git cat-file -p $(stg id) | grep ^tree)
28 stg pop -a &&
29 stg import -M mbox0 &&
30 t2=$(git cat-file -p $(stg id) | grep ^tree) &&
31 [ "$t1" == "$t2" ]
34 test_done