update readmes
[git-darcs-import.git] / tests / posthook.sh
blobf03508730cded7e054ea810983bd1c018e09f1cb
1 #!/usr/bin/env bash
3 set -ev
5 rm -rf temp1
6 mkdir temp1
7 cd temp1
8 darcs init
9 touch foo
10 darcs add foo
12 # Check that prompting works as expected when answering yes...
13 echo yes | darcs whatsnew -s --posthook 'touch posthook-ran'
14 test -f posthook-ran
15 rm posthook-ran
17 # Check that prompting works as expected when answering no...
18 echo no | darcs whatsnew -s --posthook 'touch posthook-ran'
19 test ! -f posthook-ran
21 # Check that prompting works as expected with defaults (yes)...
22 echo ALL --posthook touch posthook-ran > _darcs/prefs/defaults
23 echo yes | darcs whatsnew -s
24 test -f posthook-ran
25 rm posthook-ran
27 # Check that prompting works as expected with defaults (no)...
28 echo no | darcs whatsnew -s
29 test ! -f posthook-ran
31 # Check that --run-posthook works in defaults
32 echo ALL --run-posthook >> _darcs/prefs/defaults
33 darcs whatsnew -s
34 test -f posthook-ran
35 rm posthook-ran
37 # Check that --run-posthook works when specified both in defaults and on
38 # command line
39 darcs whatsnew --run-posthook -s
40 test -f posthook-ran
41 rm posthook-ran
43 # Check that --posthook works when --run-posthook is in defaults
44 echo ALL --run-posthook > _darcs/prefs/defaults
45 darcs whatsnew --posthook 'touch posthook-ran' -s
46 test -f posthook-ran
47 rm posthook-ran
49 echo Successful.
51 cd ..
52 rm -rf temp1