Follow upstream changes -- rest
[git-darcs-import.git] / tests / set_scripts_executable.sh
blob96d3ba94eba2a1af9bcd78a180e19527e0806882
1 #!/usr/bin/env bash
2 set -ev
4 # Some tests for the --set-scripts-executable option.
6 not () { "$@" && exit 1 || :; }
8 if echo $OS | grep -i windows; then
9 echo This test does not work on Windows
10 exit 0
13 rm -rf temp1 temp2
15 mkdir temp1
16 cd temp1
17 darcs init
18 cat > script.pl << FOO
19 #!/usr/bin/env perl
20 print "Hello\n";
21 FOO
22 chmod 0644 script.pl
23 date > nonscript
24 # pre-tests
25 test -r script.pl
26 test -r nonscript
27 test ! -x script.pl
28 test ! -x nonscript
29 darcs add script.pl nonscript
30 darcs record --patch-name 'uno' --all
31 cd ..
33 # sans --set-scripts-executable (should not be executable)
34 mkdir temp2
35 cd temp2
36 darcs init
37 darcs pull -a ../temp1
38 # sanity check
39 test -r script.pl
40 test -r nonscript
41 # nothing should be executable
42 test ! -x script.pl
43 test ! -x nonscript
44 cd ..
45 rm -rf temp2
47 # with --set-scripts-executable
48 mkdir temp2
49 cd temp2
50 darcs init
51 darcs pull -a ../temp1 --set-scripts-executable
52 # sanity check
53 test -r script.pl
54 test -r nonscript
55 # script should be executable
56 test -x script.pl
57 test ! -x nonscript
58 cd ..
59 rm -rf temp2
61 # now let's try the same thing with get
62 darcs get --set-scripts-executable temp1 temp2
63 cd temp2
64 # sanity check
65 test -r script.pl
66 test -r nonscript
67 # script should be executable
68 test -x script.pl
69 test ! -x nonscript
70 cd ..
72 rm -rf temp1 temp2