Merge branch 'darcs' into master
[git-darcs-import.git] / tests / issue612_repo_not_writeable.sh
blobd6cb290c3698f73ec3495183c2cbd5de6d14b729
1 #!/usr/bin/env bash
2 set -ev
4 # Test that darcs fails appropriately when the target repo inventory file is not writable.
5 # See issue612
7 not () { "$@" && exit 1 || :; }
9 if echo $OS | grep -i windows; then
10 echo This test does not work on Windows
11 exit 0
14 if grep old-fashioned .darcs/defaults; then
15 echo This test does not work with old-fashioned inventories
16 exit 0
19 rm -rf temp1 temp2
20 mkdir temp1
21 cd temp1
22 darcs init
23 touch t.t
24 darcs add t.t
25 darcs record -am "initial add"
26 if [ -e _darcs/inventories ]; then
27 chmod 0555 _darcs/inventories/*
28 chmod 0555 _darcs/inventories
30 if [ -e _darcs/inventory ]; then
31 chmod 0555 _darcs/inventory
33 cd ..
35 darcs get temp1 temp2
36 cd temp2
37 echo new >> t.t
38 darcs record -am "new patch"
39 not darcs push -a ../r1 2> log
40 grep failed log
41 cd ..
43 chmod -R 0755 temp1
44 rm -rf temp1 temp2