Follow upstream changes -- rest
[git-darcs-import.git] / tests / send.sh
blobc5c64968ab6e61b2fe87752d20594b45fcd212d6
1 #!/usr/bin/env bash
2 set -ev
4 DARCS_EDITOR=echo
5 export DARCS_EDITOR
7 rm -rf temp1 temp2
8 mkdir temp1 temp2
10 cd temp2
11 darcs init
13 # setup test
14 cd ../temp1
15 darcs init
16 touch foo bar
17 darcs add foo bar
18 darcs record -a -m add_foo_bar -A x
20 # Test that a default preference value is not needed to send
21 darcs send --author=me -a --to=random@random --sendmail-command='grep "^To: random@random$" %<' ../temp2
23 # Test that a default preference will be used when no --to value is specified
24 echo "default@email" > ../temp2/_darcs/prefs/email
25 darcs send --author=me -a --sendmail-command='grep "^To: default@email$" %<' ../temp2
27 # Test that the --to parameter overrides the default value in the repository
28 darcs send --author=me -a --to=override@default --sendmail-command='grep "^To: override@default$" %<' ../temp2
30 # Test that the --subject parameter sets the subject
32 # Test that the --output-auto-name parameter outputs what we expect
33 darcs send --author=me -a --subject="it works" --output test1.dpatch ../temp2
34 darcs send --author=me -a --subject="it works" --output-auto-name ../temp2
35 cmp test1.dpatch add_foo_bar.dpatch
37 # test --output-auto-name works with optional argument.
38 mkdir patchdir
39 darcs send --author=me -a --subject="it works" --output-auto-name=patchdir ../temp2
40 cmp test1.dpatch patchdir/add_foo_bar.dpatch
42 # checking --output-auto-name=dir when run in different directory
43 cd patchdir
44 rm add_foo_bar.dpatch
45 darcs send --author=me -a --subject="it works" --output-auto-name=. ../../temp2
46 cmp ../test1.dpatch add_foo_bar.dpatch
47 cd ..
49 cd ..
50 rm -rf temp1 temp2