update readmes
[git-darcs-import.git] / tests / prehook.sh
blob6970dec71f2fa3f7f90411de234c8017866b0325
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 --prehook 'touch prehook-ran'
14 test -f prehook-ran
15 rm prehook-ran
17 # Check that prompting works as expected when answering no...
18 echo no | darcs whatsnew -s --prehook 'touch prehook-ran'
19 test ! -f prehook-ran
21 # Check that prompting works as expected with defaults (yes)...
22 echo ALL --prehook touch prehook-ran > _darcs/prefs/defaults
23 echo yes | darcs whatsnew -s
24 test -f prehook-ran
25 rm prehook-ran
27 # Check that prompting works as expected with defaults (no)...
28 echo no | darcs whatsnew -s
29 test ! -f prehook-ran
31 # Check that --run-prehook works in defaults
32 echo ALL --run-prehook >> _darcs/prefs/defaults
33 darcs whatsnew -s
34 test -f prehook-ran
35 rm prehook-ran
37 # Check that --run-prehook works when specified both in defaults and on
38 # command line
39 darcs whatsnew --run-prehook -s
40 test -f prehook-ran
41 rm prehook-ran
43 # Check that --prehook works when --run-prehook is in defaults
44 echo ALL --run-prehook > _darcs/prefs/defaults
45 darcs whatsnew --prehook 'touch prehook-ran' -s
46 test -f prehook-ran
47 rm prehook-ran
49 echo Successful.
51 cd ..
52 rm -rf temp1